24c02读程序C语言详解,24c02读写c语言程序(24C02 read and write C language program).doc...

24c02读写c语言程序(24C02 read and write C language program)

24c02读写c语言程序(24C02 read and write C language program)

24C02 read and write C language program - here is the source code I prepared

2010-09-01 10:08

> below is the source code I have written, has been successfully debugged, you can use the download, the program is not very standardized

I hope you can criticize me!!!

>/***********************************************************

>** module name: 24C02 read and write

>** written: Bradley date 200551

>** modifier: Bradley

>** Function Description: 8 bytes of data into 24C02, and then read out the delivery port P1 display

>** other Description: This program is continuously read and write 8 bytes of data written by the 24C02 page

>** version: keil 7

>**********************************************************/

>#include

>#include

>//#define uchar unsigned char

>#define uint unsigned int

>#define WC24C02 0x0a0; / / device address

>#define R24C02 0x00; / / write data.

>#define W24C02 0x00; / / read data.

>sbit SDA=P3^7; / / define data line

>sbit SCL=P3^6; / / define the clock line

>bit flag;

>uint IData ucSendBuffer[8]={0x01,0x02,0x04,0x08,

> 0x10,0x20,0x40,0x80};

>uint IData ucReceData;

>uint IData ucReceiveBuffer[8]; / / multi byte data buffer is read from the device

>void, delay ();

>void, delay_10ms ();

>void, ACK ();

>void, NoACK ();

>/*********************************************************

>** Name: I2C_Start

>** function: start I2C

>** input: no

>** returns: no

>*********************************************************/

>void, I2C_Start ()

>{

> SDA=1;

> delay ();

> SCL=1;

> delay ();

> SDA=0;

> delay ();

> SCL=0; / / clamp I2C bus, ready to send data

>}

>/**********************************************************

>** Name: I2C_Stop

>** function: stop I2C

>** input: no

>** returns: no

>**********************************************************/

>void, I2C_Stop ()

>{

> SDA=0;

> delay ();

> SCL=1;

> delay ();

> SDA=1;

> delay ();

>}

>/**********************************************************

>**

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值