AVR128的程序——24C02記錄復(fù)位次數(shù)
#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延時(shí)函數(shù)
{
}
void delay_nms(unsigned int n) //N ms延時(shí)函數(shù)
{
}
void Delayms(uint MS)
{
}
void display(uchar FirstBit,uchar Num)
{
for(i=0;i
{
PORTC=led_discode[10];
Delayms(5);
}
}
關(guān)鍵詞:
AVR12824C02復(fù)位次
相關(guān)推薦
技術(shù)專區(qū)
- FPGA
- DSP
- MCU
- 示波器
- 步進(jìn)電機(jī)
- Zigbee
- LabVIEW
- Arduino
- RFID
- NFC
- STM32
- Protel
- GPS
- MSP430
- Multisim
- 濾波器
- CAN總線
- 開關(guān)電源
- 單片機(jī)
- PCB
- USB
- ARM
- CPLD
- 連接器
- MEMS
- CMOS
- MIPS
- EMC
- EDA
- ROM
- 陀螺儀
- VHDL
- 比較器
- Verilog
- 穩(wěn)壓電源
- RAM
- AVR
- 傳感器
- 可控硅
- IGBT
- 嵌入式開發(fā)
- 逆變器
- Quartus
- RS-232
- Cyclone
- 電位器
- 電機(jī)控制
- 藍(lán)牙
- PLC
- PWM
- 汽車電子
- 轉(zhuǎn)換器
- 電源管理
- 信號放大器
評論