#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)
}
上一篇:基于51单片机的GSM模块C语言发送短信程序
下一篇:基于51单片机运用LCD12864液晶显示
推荐阅读最新更新时间:2024-03-16 14:46