基于51的EEPROM C语言程序
#include
#define uchar unsigned char
#define uint unsigned int
uchar code tab[]="0123456789";
sbit SID=P2^0;
sbit SCLK=P2^1;
uint tcnt;
bit write=0;
sbit scl=P3^7; //24c08 SCL
sbit sda=P3^6; //24c08 SDA
uchar a,b,c,d,e,f;
void delay(uint t)
{
uint i,j;
for(i=0; i
}
void sendbyte(uchar zdata)
{
uint i;
for(i=0; i<8; i++)
{
}
}
void write_com(uchar cmdcode)
{
sendbyte(0xf8);
sendbyte(cmdcode & 0xf0); //取cmdcode的高四位
sendbyte((cmdcode < 4) & 0xf0); //取cmdcode的第四位
delay(2);
}
void write_data(unsigned char Dispdata)
{
sendbyte(0xfa);
sendbyte(Dispdata & 0xf0);
sendbyte((Dispdata < 4) & 0xf0);
delay(2);
}
void lcdinit()
{
delay(200);
write_com(0x30);
delay(50);
write_com(0x0c);
delay(50);
write_com(0x01);
delay(50);
}
void hzkdis(unsigned char code *s)
{
while(*s > 0)
}
void delay1(unsigned char x)
{ unsigned int i;
void flash()
{ ; ; }
void x24c02_init() //24c02初始化子程序
void start()
{sda=1; flash(); scl=1; flash(); sda=0; flash(); scl=0; flash();}
void stop()
{sda=0; flash(); scl=1; flash(); sda=1; flash();}
void writex(uchar j) //写一个字节
{ uchar i,temp;
}
uchar readx()
{
}
void clock()
{
}
uchar x24c02_read(uchar address)
{
}
void x24c02_write(uchar address,uchar info)
{
}
void yejing()
{
write_com(0x90);
delay(10);
write_data(tab[a]);
delay(10);
write_data(tab[b]);
//delay(10);
//write_com(0x91);
delay(10);
write_data(tab[c]);
//write_com(0x90);
delay(10);
write_data(tab[d]);
delay(10);
write_data(tab[e]);
delay(10);
write_data(tab[f]);
}
void main(void)
{
lcdinit();
x24c02_init();
while(1)
}
51EEPROMC语言程 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)