AVR128的程序——24C02记录复位次数
#include
#define uchar unsigned char
#define uint
#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
#define MT_DATA_NOACK 0x30
#define MR_SLA_ACK
#define MR_SLA_NOACK 0x48
#define MR_DATA_ACK 0x50
#define MR_DATA_NOACK 0x58
#define Start()
#define Stop()
#define Wait()
#define TestAck()
#define SetAck()
#define SetNoAck()
#define Twi()
#define Write8Bit(x)
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)
{
} void delay_nms(unsigned int n) { } void Delayms(uint MS) { } void display(uchar FirstBit,uchar Num) { for(i=0;i { PORTC=led_discode[10]; Delayms(5); } }
AVR12824C02复位次 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)