#include
#include
#define uchar unsigned char
#define uint unsigned int
#define rd_device_add 0xA1
#define wr_device_add 0xA0
#define START 0x08
#define RE_START 0x10
#define MT_SLA_ACK 0x18
#define MT_SLA_NOACK 0x20
#define MT_DATA_ACK 0x28
#define MT_DATA_NOACK 0x30
#define MR_SLA_ACK 0x40
#define MR_SLA_NOACK 0x48
#define MR_DATA_ACK 0x50
#define MR_DATA_NOACK 0x58
#define Start() (TWCR=(1<
#define Stop() (TWCR=(1<
#define Wait() {while(!(TWCR&(1<
#define TestAck() (TWSR&0xf8)
#define SetAck() (TWCR|=(1<
#define SetNoAck() (TWCR&=~(1<
#define Twi() (TWCR=(1<
#define Write8Bit(x) {TWDR=(x);TWCR=(1<
void Delayms(uint MS);
void display(uchar FirstBit,uchar Num);
void i2cini(void) ;
void delay_nus(unsigned int n);
void delay_nms(unsigned int n);
unsigned char i2c_Write(unsigned char Wdata,unsigned char RomAddress) ;
unsigned char i2c_Read(unsigned char RomAddress) ;
uchar TempData[8];
uchar WeiMa[8] = {0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
uchar led_discode[11]={0xc0,0xf9,0xa4,0xb0,0x99,
void main(void)
{
uchar i;
DDRA=0XFF;
PORTA=0XFF;
DDRC=0XFF;
PORTC=0XFF;
DDRF|=0X0E;
PORTF|=0X0E;
PORTF&=0xF7;
DDRB |=0X10;
PORTB|=0X10;
i=i2c_Read(0x03);
i++;
i=i;
i2c_Write(i,0x03);
{
}
}
void i2cini(void)
{
TWSR=0;
}
unsigned char i2c_Write(unsigned char Wdata,unsigned char RomAddress)
{
}
unsigned char i2c_Read(unsigned char RomAddress)
void delay_nus(unsigned int n) //N us延时函数
{
}
void delay_nms(unsigned int n) //N ms延时函数
{
}
void Delayms(uint MS)
{
}
void display(uchar FirstBit,uchar Num)
{
for(i=0;i
{
PORTC=led_discode[10];
Delayms(5);
}
}
声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/fangan/262336.html