PCF8563时钟+AT24C02+LCD12864显示时钟程序

发布者:玉树琼花最新更新时间:2018-01-07 来源: eefocus关键字:PCF8563时钟  AT24C02  LCD12864  显示时钟 手机看文章 扫描二维码
随时随地手机看文章

//aa 00 47 13 25 63 00 04 04 
//秒 分 时  日 星期和月(最高3位0-6,代表1-7)  
#include 

#include 
#include "hcLCDdot.h"            //点阵库 
#define Uchar unsigned char 
#define Uint  unsigned int 
#define SomeNOP(); _nop_();_nop_();_nop_();  
/*LCD驱动要用到的一些口线定意*/ 
#define LCDPORT P0 
sbit D_I = P3^7; 
sbit R_W = P3^6; 
sbit E = P3^5; 
sbit CS1 = P3^2; 
sbit CS2 = P3^4; 
sbit RST = P3^3; 
/*I2C要用到的口线定意*/ 
sbit SDA = P2^7; 
sbit SCL = P2^6; 

////////////以下为函数声明/////////////////////////////// 
//LCD驱动要用到的一些函数 
void lcdwrite_cmd(Uchar cmd_dat); 
void lcdwrite_dat(Uchar dot_dat); 
void lcd_busy(); 
Uchar  lcdread_dat(void); 
void lcddispon(void); 
void lcddispoff(void); 
void lcdclrall(void); 
void lcdini(void); 
void Hz12disp(Uchar Nowrow,Uchar Nowcol,Uchar CHplace); 
void ASC12disp(Uchar Nowrow,Uchar Nowcol,Uchar ASCplace); 
void flashlogo(Uchar Bmpcol); 
void Disp128_64(Uchar BMPplace); 
void delay(void); 
//I2C驱动要用到的一些函数 
void Delay_1ms(Uchar time); 
void I2CStart(void);     
void I2CStop(void); 
void ACK(void);            //AcknowLEDge信号 
void NACK(void);            //没有Acknowledge信号 
void AutoACK(void);        //在一定的时间内自动确定ACK的信号// 
void Writex(Uchar j); 
Uchar Readx(void); 
void X24_Write(Uchar Addresshigh,Uchar Addresslow,Uchar Write_date); 
Uchar X24_Read(Uchar Addresshigh,Uchar Addresslow); 
void X24_WritePage(Uchar Addresshigh,Uchar Addresslow,Uchar idata *Writeip); 
void X24_ReadPage(Uchar Addresshigh,Uchar Addresslow,Uchar idata *ReaDIP); 
void GetPCF8563(Uchar idata *Getip); 
void SetPCF8563(Uchar idata *Setip); 
Uchar ReadPCF8563(Uchar AddrePCF); 
void WritePCF8563(Uchar AddrePCF,Uchar PCFdata); 
void SetWaring (Uchar Wyear,Uchar Wmonth,Uchar Wday); 
bit CheckTime(void); 
void rs232(void); 
void time0(void); 
/*定义一个接收的数组*/ 
Uchar data recdata[8];            // 
Uchar idata L24cxxdata[64];        //用于读出或写入24C16的数据 
Uchar idata cLOCkdata[7];        //系统时钟 
Uchar pcpointer,timecount,timecount2,*gettimeip;                //用于设定从PC接收和发的指针 
/*定义二个地址编码寄存器,设定地址线稳定时间,定时器2的延时时间参数,动画的时位置参数,发码结束后取消静音的时间*/ 
Uchar data MCaddreh,MCaddrel,MCaddtime,time2_1s,time2_10s,time2_10sx,logocol; 
Uint data nomutetime;     
Uchar newbmpcount; 
/*定义标志位存放的寄存器*/ 
Uchar bdata myflag,myflag2,bmpflag;                //定义一个用于标志寄存器存放的 
sbit nomutebit = myflag^0;        //用于开始取消静音标志 
sbit recpcokbit = myflag^1;        //用于设定接收到一个完整的控制指令码 
sbit returnbit = myflag^2;        //用于向PC回传数据标志 
sbit findokbit = myflag^3;        //寻找到明码地址 
sbit sendbit = myflag^4;        //开始发码 
sbit timenewbit = myflag^5;        //时钟更新标志 
sbit callnewbit = myflag^6;        //有新的呼叫 
sbit endnewbit=myflag^7;        //呼叫结束 

sbit w24cxxbit = myflag2^0;        //设定明码表 
sbit timeoutbit =myflag2^1; 
sbit newtimebit = myflag2^2;    //设定新的系统时间 
sbit r_lbit    = bmpflag^0; 
sbit b_wbit = bmpflag^1;        //图和文字标志 
sbit newbmpbit = bmpflag^2;        //更新图片 
void main(void) 
{     
    TH0 = 0xf8;                    //2ms 
    TL0 = 0xce; 
    TH1 = 0xfd;                    //以9600Baud的速率和PC机通信 
    TL1 = 0xfd;     
    TH2 = 0x4c;                    //50ms 
    TL2 = 0x00; 
    T2CON = 0x00; 
    TMOD = 0x21;                //Time0为16位,Time1为8位常数自装 
    SCON = 0x50; 
    IP = 0x10; 
    TR0 = 1; 
    TR1 = 1; 
    TR2 = 1; 
    time2_1s=0x14; 
    time2_10s=0x0a; 
    time2_10sx=0x0c; 
    IE = 0x92;                    //Time0,Time2,RS232中断 
    timecount = 0x64; 
    timecount2 = 0x32; 
    newbmpcount = 0x01; 
    logocol =0; 
    r_lbit =0; 
    timeoutbit =0; 
    b_wbit=1; 
//    setadd(80); 

    lcdini(); 
    while(1) 
    { 
        lcdclrall(); 
        HZ12disp(0x00,0x04,0x01);            //承 
        HZ12disp(0x00,0x10,0x02);            //接 
        HZ12disp(0x00,0x1C,0x03);            //单 
        HZ12disp(0x00,0x28,0x04);            //片 
        HZ12disp(0x00,0x34,0x05);            //机 
        HZ12disp(0x00,0x40,0x06);            //开 
        HZ12disp(0x00,0x4C,0x07);            //发 
        HZ12disp(0x00,0x58,0x08);            //及     
        HZ12disp(0x00,0x64,0x09);            //解 
        HZ12disp(0x00,0x70,0x0A);            //密 

        HZ12disp(0x01,0x0A,0x0B);            //各 
        HZ12disp(0x01,0x16,0x0C);            //类 
        ASC12disp(0x01,0x22,0x0B);            //I 
        ASC12disp(0x01,0x28,0x0C);            //C 
        HZ12disp(0x01,0x2E,0x0D);            //卡 
        ASC12disp(0x01,0x3A,0x0D);            //; 
        ASC12disp(0x01,0x40,0x0A);            //P 
        ASC12disp(0x01,0x46,0x0B);            //I 
        ASC12disp(0x01,0x4C,0x0C);            //C 
        HZ12disp(0x01,0x52,0x03);            //单 
        HZ12disp(0x01,0x5E,0x04);            //片 
        HZ12disp(0x01,0x6A,0x05);            //机 
     
        ASC12disp(0x02,0x0A,0x05);            //5 
        ASC12disp(0x02,0x10,0x01);            //1 
        HZ12disp(0x02,0x16,0x0E);            //编 
        HZ12disp(0x02,0x22,0x0F);            //程 
        HZ12disp(0x02,0x2E,0x10);            //器 
        ASC12disp(0x02,0x3A,0x0D);            //; 
        ASC12disp(0x02,0x40,0x0A);            //P 
        ASC12disp(0x02,0x46,0x0B);            //I 
        ASC12disp(0x02,0x4C,0x0C);            //C 
        HZ12disp(0x02,0x52,0x0E);            //编 
        HZ12disp(0x02,0x5E,0x0F);            //程 
        HZ12disp(0x02,0x6A,0x10);            //器 
     
        HZ12disp(0x03,0x00,0x14);            //星 
        HZ12disp(0x03,0x0c,0x15);            //期 
     
        ASC12disp(0x03,0x2c,0x02);            //2 
        ASC12disp(0x03,0x32,0x00);            //0 
     
        HZ12disp(0x03,0x44,0x11);            //年 

        HZ12disp(0x03,0x5c,0x12);            //月 

        HZ12disp(0x03,0x74,0x13);            //日 


        ASC12disp(0x04,0x5c,0x0e);            //:         

        ASC12disp(0x04,0x6e,0x0e);     

        while(b_wbit==1) 
        { 
            if(timenewbit==1) 
            { 
                Uchar newtime0; 
                timenewbit=0; 

                newtime0=(clockdata[6]>>4)&0x0f; 
                ASC12disp(0x03,0x38,newtime0); 
                newtime0=clockdata[6]&0x0f; 
                ASC12disp(0x03,0x3e,newtime0); 
             
                newtime0=(clockdata[4]>>4)&0x01; 
                ASC12disp(0x03,0x50,newtime0); 
                newtime0=clockdata[4]&0x0f; 
                ASC12disp(0x03,0x56,newtime0); 
             
                newtime0=((clockdata[4]>>5)&0x07)+0x16; 
                HZ12disp(0x03,0x1B,newtime0);            //几号 
             
                newtime0=(clockdata[3]>>4)&0x03; 
                ASC12disp(0x03,0x68,newtime0); 
                newtime0=clockdata[3]&0x0f; 
                ASC12disp(0x03,0x6e,newtime0); 
             
                newtime0=(clockdata[2]>>4)&0x03; 
                ASC12disp(0x04,0x50,newtime0); 
                newtime0=clockdata[2]&0x0f; 
                ASC12disp(0x04,0x56,newtime0); 
                 
                newtime0=(clockdata[1]>>4)&0x07; 
                ASC12disp(0x04,0x62,newtime0); 
                newtime0=clockdata[1]&0x0f; 
                ASC12disp(0x04,0x68,newtime0); 
             
                newtime0=(clockdata[0]>>4)&0x07; 
                ASC12disp(0x04,0x74,newtime0); 
                newtime0=clockdata[0]&0x0f; 
                ASC12disp(0x04,0x7a,newtime0); 
            } 
            if(r_lbit==0) 
            { 
                flashlogo(logocol++); 
                if (logocol==32) 
                {r_lbit=1;} 
                lcddispon(); 
                delay(); 
            } 
            else 
            { 
                flashlogo(logocol--); 
                if(logocol==0) 
                {r_lbit =0;} 
                lcddispon(); 
                delay(); 
            }     
        } 
        while(b_wbit==0) 
        { 
            if(newbmpbit==1) 
            { 
                newbmpbit=0; 
                Disp128_64(newbmpcount); 
             
            } 
        } 
    } 


     
//以下为定时器TIME0中断程序 
void time0(void) interrupt 1 

    TH0 = 0xf8; 
    TL0 = 0xce; 
    timecount--; 
    if(timecount==0) 
    {     
        timecount = 0x64; 
        gettimeip=&clockdata[0]; 
        GetPCF8563(gettimeip); 
//        clockdata[0]=0x25; 
//        clockdata[0]=0x12; 
//        clockdata[1]=0x34; 
//        clockdata[2]=0x56; 
//        clockdata[3]=0x78; 
//        clockdata[4]=0x90; 
//        clockdata[5]=0x88; 
//        clockdata[6]=0x77; 
        timenewbit=1; 
        timecount2--; 
        if(timecount2==0) 
        { 
            timecount2=0x32; 
            b_wbit = !b_wbit; 
            if(b_wbit==0) 
            { 
                newbmpbit=1; 
                newbmpcount++; 
                if(newbmpcount==0x03) 
                {newbmpcount=0x01;} 
            } 
        } 
    } 

    if(newtimebit==1&&recpcokbit==1) 
    { 
//设定新的系统时间 
        Uchar *pcfsetip; 
        newtimebit=0; 
        recpcokbit=0; 
        pcfsetip=&recdata[1]; 
        SetPCF8563(pcfsetip); 
        WritePCF8563(0x00,0x00); 
        WritePCF8563(0x01,0x00); 
        WritePCF8563(0x0d,0x83); 
    }         


//以下为串行口中断程序,用于接收串行数据 
void rs232(void) interrupt 4 

    if(RI==1) 
    {     
         
//原输入格式为AA 秒,分,时 日,星期,月年 
        if (SBUF==0xaa) 
        { 
            newtimebit=1; 
            pcpointer=0; 
        } 
        RI = 0; 
        recdata[pcpointer++]=SBUF; 
        if(pcpointer==8) 
        { 
            pcpointer =0; 
            recpcokbit =1;        //指针还原,置收到完整的控制码             
        } 
    } 
    else 
    { 
        TI = 0; 
    }             


void time2(void) interrupt 5 

    TF2 = 0; 
    TH2 = 0x4c;                    //50ms 
    TL2 = 0x00; 


         

/*---------------LCD驱动要用到的一些子程序--------------------*/ 
/*向LCD写指令*/ 
void lcdwrite_cmd(Uchar cmd_dat) 

    D_I = 0; 
    R_W = 0; 
    E = 0; 
    LCDPORT = cmd_dat; 
    SomeNOP(); 
    E = 1; 
    SomeNOP(); 
    E = 0; 

/*向LCD写数据*/ 
void lcdwrite_dat(Uchar dot_dat) 

    D_I = 1; 
    R_W = 0; 
    E = 0; 
    LCDPORT = dot_dat; 
    SomeNOP(); 
    E = 1; 
    SomeNOP(); 
    E = 0; 

/*判断LCD是否处于*/ 
void lcd_busy() 

    Uchar i; 
    D_I = 0; 
    R_W = 1; 
    while(1) 
    { 
        E = 0; 
        LCDPORT = 0xff; 
        SomeNOP(); 
        E = 1; 
        SomeNOP(); 
        i = LCDPORT; 
        E = 0; 
        if(i<0x80) break; 
    } 


Uchar  lcdread_dat(void) 
{    Uchar i; 
    D_I = 1; 
    R_W = 1; 
    E = 0; 
    LCDPORT = 0xff; 
    SomeNOP(); 
    E =1; 
    SomeNOP(); 
    i = LCDPORT; 
    E = 0; 
    LCDPORT =0xff; 
    SomeNOP(); 
    E = 1; 
    SomeNOP(); 
    i =LCDPORT; 
    E =0; 
    return(i); 


//开LCD显示 
void lcddispon(void) 

    CS1=0;CS2=1; 
    lcdwrite_cmd(0x3f); 
    CS1=1;CS2=0; 
    lcdwrite_cmd(0x3f); 

//关LCD显示 
void lcddispoff(void) 

    CS1=0;CS2=1; 
    lcdwrite_cmd(0x3e); 
    CS1=1;CS2=0; 
    lcdwrite_cmd(0x3e); 

//对整屏清除,就是写空的数据 
void lcdclrall(void) 

    Uchar i,j; 
    for(i=0;i<8;i++) 
    { 
        CS1=0;CS2=1; 
        lcdwrite_cmd(i|0xb8); 
        lcdwrite_cmd(0x40); 
        for(j=64;j>0;j--) 
        { 
            lcdwrite_dat(0x00); 
            lcd_busy(); 
//            P3_1=!P3_1; 
        } 
             
        CS1=1;CS2=0; 
        lcdwrite_cmd(i|0xb8); 
        lcdwrite_cmd(0x40); 
        for(j=64;j>0;j--) 
        { 
            lcdwrite_dat(0x00); 
            lcd_busy(); 
        } 
    } 


//LCD初始化 
void lcdini(void) 

    CS1=0;CS2=1; 
    lcdwrite_cmd(0xc0);                //从第0行开始显示 
    CS1=1;CS2=0; 
    lcdwrite_cmd(0xc0); 
    lcddispon(); 


         
/*在指定的行列上显示12点阵的汉字*/         

void HZ12disp(Uchar Nowrow,Uchar Nowcol,Uchar CHplace) 

    Uchar i,tmp1,tmp2,k=12; 
    Uint j; 
    j = (CHplace-1)*24; 
    if((Nowrow%2)==0)            // 
    { 
        switch(Nowrow) 
        { 
            case 0: i=0;break; 
            case 2: i=3;break; 
            default: i=6; 
        } 
        while(k!=0) 
        { 
            if(Nowcol<0x40) 
                {CS1=0;CS2=1;} 
            else 
            {    if(Nowcol<0x80) 
                {CS1=1;CS2=0;} 
                else 
                {break;} 
            } 
            lcdwrite_cmd(i|0xb8); 
            lcdwrite_cmd(Nowcol|0x40); 
            lcdwrite_dat(Hzk12[j]); 
            lcd_busy(); 
            lcdwrite_cmd((i+1)|0xb8);    //到下一页 
            lcdwrite_cmd(Nowcol|0x40); 
            tmp1 = lcdread_dat(); 
            lcdwrite_cmd(Nowcol|0x40); 
            lcdwrite_dat((Hzk12[j+12]&0x0f)|(tmp1&0xf0)); 
            j++; 
            Nowcol++; 
            k--; 
        } 
    } 
    else 
    { 
        switch(Nowrow) 
        { 
            case 1: i=1;break; 
            default: i=4; 
        } 
        while(k!=0) 
        { 
            if(Nowcol<0x40) 
            {CS1=0;CS2=1;} 
            else 
            { 
                if(Nowcol<0x80) 
                {CS1=1;CS2=0;} 
                else 
                {break;} 
            } 
            lcdwrite_cmd(i|0xb8); 
            lcdwrite_cmd(Nowcol|0x40); 
            tmp1=lcdread_dat(); 
            tmp1=tmp1&0x0f; 
            tmp1=(Hzk12[j]<<4)|tmp1; 
            tmp2=(Hzk12[j+12]<<4)|(Hzk12[j]>>4); 
            lcdwrite_cmd(Nowcol|0x40); 
            lcdwrite_dat(tmp1); 
            lcd_busy(); 
            lcdwrite_cmd((i+1)|0xb8); 
            lcdwrite_cmd(Nowcol|0x40); 
            lcdwrite_dat(tmp2); 
            j++; 
            Nowcol++; 
            k--; 
        } 
    }             

//6*12点阵的ASC码显示程序 
void ASC12disp(Uchar Nowrow,Uchar Nowcol,Uchar ASCplace) 

    Uchar i,tmp1,tmp2,k=6; 
    Uint j; 
    j = ASCplace*12; 
    if((Nowrow%2)==0)            // 
    { 
        switch(Nowrow) 
        { 
            case 0: i=0;break; 
            case 2: i=3;break; 
            default: i=6; 
        } 
        while(k!=0) 
        { 
            if(Nowcol<0x40) 
                {CS1=0;CS2=1;} 
            else 
            {    if(Nowcol<0x80) 
                {CS1=1;CS2=0;} 
                else 
                {break;} 
            } 
            lcdwrite_cmd(i|0xb8); 
            lcdwrite_cmd(Nowcol|0x40); 
            lcdwrite_dat(ASC12[j]); 
            lcd_busy(); 
            lcdwrite_cmd((i+1)|0xb8);    //到下一页 
            lcdwrite_cmd(Nowcol|0x40); 
            tmp1 = lcdread_dat(); 
            lcdwrite_cmd(Nowcol|0x40); 
            lcdwrite_dat((ASC12[j+6]&0x0f)|(tmp1&0xf0)); 
            j++; 
            Nowcol++; 
            k--; 
        } 
    } 
    else 
    { 
        switch(Nowrow) 
        { 
            case 1: i=1;break; 
            default: i=4; 
        } 
        while(k!=0) 
        { 
            if(Nowcol<0x40) 
            {CS1=0;CS2=1;} 
            else 
            { 
                if(Nowcol<0x80) 
                {CS1=1;CS2=0;} 
                else 
                {break;} 
            } 
            lcdwrite_cmd(i|0xb8); 
            lcdwrite_cmd(Nowcol|0x40); 
            tmp1=lcdread_dat(); 
            tmp1=tmp1&0x0f; 
            tmp1=(ASC12[j]<<4)|tmp1; 
            tmp2=(ASC12[j+6]<<4)|(ASC12[j]>>4); 
            lcdwrite_cmd(Nowcol|0x40); 
            lcdwrite_dat(tmp1); 
            lcd_busy(); 
            lcdwrite_cmd((i+1)|0xb8); 
            lcdwrite_cmd(Nowcol|0x40); 
            lcdwrite_dat(tmp2); 
            j++; 
            Nowcol++; 
            k--; 
        } 
    }             


         



//以动画的形式显示公司的标志,入口为在水平的第几个位置,现把它做,从32到1,由2张32X16的图组成 
void flashlogo(Uchar Bmpcol) 

    Uchar i,j,p; 
//把当前要用的区间清空     
    CS1=0,CS2=1; 
    lcdwrite_cmd(0xbe); 
    lcdwrite_cmd(0x40); 
    for(i=64;i>0;i--) 
    { 
        lcdwrite_dat(0x00); 
        lcd_busy(); 
    } 
    lcdwrite_cmd(0xbf); 
    lcdwrite_cmd(0x40); 
    for(i=64;i>0;i--) 
    { 
        lcdwrite_dat(0x00); 
        lcd_busy(); 
    } 
//开始写要设定的数据(左半边)     
    lcdwrite_cmd(0xbe); 
    lcdwrite_cmd(0x40); 
    j=Bmpcol; 
    for(;j<=32;j++) 
    { 
        lcdwrite_dat(Bmp1zk[j-1]); 
        lcd_busy(); 
    } 
    lcdwrite_cmd(0xbf); 
    lcdwrite_cmd(0x40); 
    j=Bmpcol; 
    for(;j<=32;j++) 
    { 
        lcdwrite_dat(Bmp1zk[j-1+32]); 
        lcd_busy(); 
    } 
//开始写要设定的数据(右半边) 
    j=Bmpcol; 
    lcdwrite_cmd(0xbe); 
    lcdwrite_cmd((32+j-1)|0x40); 
    p=0; 
    for(;j<=32;j++) 
    { 
        lcdwrite_dat(Bmp2zk[p++]); 
        lcd_busy(); 
    } 
    j=Bmpcol; 
    lcdwrite_cmd(0xbf); 
    lcdwrite_cmd((32+j-1)|0x40); 
    p=0; 
    for(;j<=32;j++) 
    { 
        lcdwrite_dat(Bmp2zk[32+(p++)]); 
        lcd_busy(); 
    } 


//显示一幅128X64的图片,参数为图片在bmp12864放置的第几个图 
void Disp128_64(Uchar BMPplace) 

    Uchar    i,Nowcol,k; 
    Uint    j; 
    j=(BMPplace-1)*1024;    //计算出在图表格中的起始位置 
    lcdclrall(); 
    for(i=0;i<8;i++) 
    {    Nowcol=0x00; 
        k=128; 
        while(k!=0) 
        { 
            if(Nowcol<0x40) 
            {CS1=0;CS2=1;} 
            else 
            {        if(Nowcol<0x80) 
                {CS1=1;CS2=0;} 
                else 
                {break;} 
            } 
            lcdwrite_cmd(i|0xb8); 
            lcdwrite_cmd(Nowcol|0x40); 
            lcdwrite_dat(bmp12864[j]); 
            lcd_busy(); 
            Nowcol++; 
            j++; 
            k--; 
        } 
    }     
}     
void delay(void) 

    Uchar i,j,k; 
    for(i=0x02;i>0;i--) 
    { 
        for(j=0x96;j>0;j--) 
        { 
            for(k=0xfa;k>0;k--) 
            { 
                _nop_(); 
//                _nop_(); 
            } 
        } 
    } 



/*----------------------I2C要用到的一些子程序---------------------------------*/ 
/***********************以下为一些用到的子程序*********************************/ 
/*延时子程序*/ 
void Delay_1ms(Uchar time) 

    Uchar j; 
    while(time--) 
    { 
        for(j=163;j!=0;j--) 
        {;} 
    } 


/*I2C的起动程序*/ 
void I2CStart(void)     

    SDA = 1; 
    SomeNOP(); 
    SCL = 1; 
    SomeNOP(); 
    SDA = 0; 
    SomeNOP(); 
    SCL = 0; 
    SomeNOP(); 


/*I2C的停止程序*/ 
void I2CStop(void) 

    SDA = 0; 
    SomeNOP(); 
    SCL = 1; 
    SomeNOP(); 
    SDA = 1; 
    SomeNOP(); 


void ACK(void)            //Acknowledge信号 

    SDA = 0; 
    SomeNOP(); 
    SCL = 1; 
    SomeNOP(); 
    SCL = 0; 
    SomeNOP(); 


void NACK(void)            //没有Acknowledge信号 

    SDA = 1; 
    SomeNOP(); 
    SCL = 1; 
    SomeNOP(); 
    SCL = 0; 
    SomeNOP(); 


void AutoACK(void)        //在一定的时间内自动确定ACK的信号// 

    Uchar i = 0; 
    SCL = 1; 
    SomeNOP(); 
    while((SDA == 1)&&(i<255))i++; 
    SCL = 0; 
    SomeNOP(); 


     
/*I2C写数据程序(向数据线上写一个BYTE)*/ 
void Writex(Uchar j) 

    Uchar i,temp; 
    temp = j; 
    for (i=0;i<8;i++)    //串行移位,先送高位,再送低位// 
    { 
        temp =temp<<1; 
        SCL = 0; 
        SomeNOP(); 
        SDA = CY; 
        SomeNOP(); 
        SCL = 1; 
        SomeNOP(); 
    } 
    SCL = 0; 
    SomeNOP(); 
    SDA = 1; 
    SomeNOP(); 

/*I2C读数据程序(从数据线上读出一个BYTE)返回值为读出的数据(BYTE型)*/ 
Uchar Readx(void) 

    Uchar i,j,k=0; 
    SCL = 0; 
    SomeNOP(); 
    SDA = 1; 
    for (i=0;i<8;i++)    // 串行移位,先读出高位,后读出低位// 
    { 
        SomeNOP(); 
        SCL = 1; 
        SomeNOP(); 
        if(SDA ==1) j=1; 
        else    j=0; 
        k =(k<<1)|j; 
        SCL = 0; 
    } 
    SomeNOP();         
    return(k);         //返回读出的值// 


//******************以下为对24CXX系列的读写程序******************************// 
//*************24CXX的devICe address 为写0A0H,读为0A1H*********************// 
/*某个地址写数据*/ 
void X24_Write(Uchar Addresshigh,Uchar Addresslow,Uchar Write_date) 

    I2CStart(); 
    Writex(0xA0); 
    AutoACK(); 
    Writex(Addresshigh); 
    AutoACK(); 
    Writex(Addresslow); 
    AutoACK(); 
    Writex(Write_date); 
    AutoACK(); 
    I2CStop(); 
    Delay_1ms(10); 


/*对某个地址读操作,函数值为读出的数据*/ 
Uchar X24_Read(Uchar Addresshigh,Uchar Addresslow) 
{     
    Uchar i; 
    I2CStart(); 
    Writex(0xA0); 
    AutoACK(); 
    Writex(Addresshigh); 
    AutoACK(); 
    Writex(Addresslow); 
    AutoACK(); 
    I2CStart(); 
    Writex(0xA1); 
    AutoACK(); 
    i =Readx(); 
    //ACK();    //注意:这里不能有ACK应答信号// 
    I2CStop(); 
    Delay_1ms(0); 
    return(i); 


/*对内存中的数据块写入,入口为写EEPROM的地址,内存缓冲中的数据的起始地址(是IDATA的数据)*/     
void X24_WritePage(Uchar Addresshigh,Uchar Addresslow,Uchar idata *Writeip) 

    Uchar i; 
    I2CStart(); 
    Writex(0xA0); 
    AutoACK(); 
    Writex(Addresshigh); 
    AutoACK(); 
    Writex(Addresslow); 
    AutoACK(); 
    for(i=0;i<64;i++) 
    { 
        Writex(*Writeip++); 
        AutoACK(); 
    } 
    I2CStop(); 

/*把EEPROM中的数据读出来存放在内存缓冲中,起始地址为(是IDATA的数据)*/ 
void X24_ReadPage(Uchar Addresshigh,Uchar Addresslow,Uchar idata *Readip) 

    Uchar i; 
    I2CStart(); 
    Writex(0xA0); 
    AutoACK(); 
    Writex(Addresshigh); 
    AutoACK(); 
    Writex(Addresslow); 
    AutoACK(); 
    I2CStart(); 
    Writex(0xA1); 
    AutoACK(); 
    for(i=0;i<63;i++)        //PAGE读的时候最后一个BYTE不要ACK信号// 
    { 
        *Readip = Readx(); 
         Readip = Readip++; 
         ACK(); 
        } 
    *Readip = Readx(); 
    NACK(); 
    I2CStop(); 
    Delay_1ms(0); 



//*******************以下为对PCF8383/PCF8563的读写子程序********************//     
//**********时钟片device address的写地址为0A2H,读地址为0A3H******************// 
/*对PCF8563的时钟读到内存中,以IDATA指针开始的连续7个BYTE*/ 
//****读出的内容依次为“秒,分钟,小时,日,星期,月/世纪,年********************// 
//PCF8585依次为“秒,分钟,小时,日,星期月 
void GetPCF8563(Uchar idata *Getip) 

    Uchar i; 
    I2CStart(); 
    Writex(0xA2); 
    AutoACK(); 
    Writex(0x02);    //从秒地址开始读// 
    AutoACK(); 
    I2CStart(); 
    Writex(0xA3); 
    AutoACK(); 
    for(i=0;i<6;i++) 
    { 
        *Getip = Readx(); 
        Getip = Getip++; 
        ACK(); 
    } 
    *Getip = Readx(); 
    NACK(); 
    I2CStop(); 
    Delay_1ms(0); 

/*设定8563/8583的时间内容依次为“秒,分钟,小时,日,星期,月/世纪,年*/ 
//PCF8585依次为“秒,分钟,小时,日,星期月 
void SetPCF8563(Uchar idata *Setip) 

    Uchar i; 
    I2CStart(); 
    Writex(0xA2); 
    AutoACK(); 
    Writex(0x02); 
    AutoACK(); 
    for(i=0;i<7;i++) 
    { 
        Writex(*Setip++); 
        AutoACK(); 
    } 
    I2CStop(); 


Uchar ReadPCF8563(Uchar AddrePCF) 

    Uchar i; 
    I2CStart(); 
    Writex(0xA2); 
    AutoACK(); 
    Writex(AddrePCF); 
    AutoACK(); 
    I2CStart(); 
    Writex(0xA3); 
    AutoACK(); 
    i =Readx(); 
    //ACK();    //注意:这里不能有ACK应答信号// 
    I2CStop(); 
    Delay_1ms(0); 
    return(i); 

void WritePCF8563(Uchar AddrePCF,Uchar PCFdata) 

    I2CStart(); 
    Writex(0xA2); 
    AutoACK(); 
    Writex(AddrePCF); 
    AutoACK(); 
    Writex(PCFdata); 
    AutoACK(); 
    I2CStop(); 
    Delay_1ms(10); 

      
     

void SetWaring (Uchar Wyear,Uchar Wmonth,Uchar Wday) 

    X24_Write(0x07,0xf0,Wyear); 
    X24_Write(0x07,0xf1,Wmonth); 
    X24_Write(0x07,0xf2,Wday); 


     
/*返回值为1和0,1为已溢出,0为没有溢出*/     
bit CheckTime(void) 

    Uchar j,k; 
    j = X24_Read(0x07,0xcb); 
    k = ReadPCF8563(0x08 );        /*读年的时间*/ 
    if(k    { 
        return(0); 
    } 
    else  
    {     
        if(k>j) 
        { 
            return(1); 
        } 
        else 
        { 
            j = X24_Read(0x07,0xCC); 
            k = ReadPCF8563(0x07)&0x1f;    /*读月的时间*/ 
            if (k            { 
                return(0); 
            } 
            else 
            { 
                if(k>j) 
                { 
                    return(1); 
                } 
                else 
                { 
                    j = X24_Read(0x07,0xcd); 
                    k = ReadPCF8563(0x05)&0x3f;    /*读日的时间*/ 
                    if (k>j)return(1); 
                    else return(0); 
                } 
            }         
        }             
    } 



hclcddot.h


unsigned char code  Hzk12[]={
/*--  文字:  承  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0x08,0x88,0x79,0x11,0x51,0xFD,0x55,0x13,0xF9,0x10,0x08,0x00,0x02,0x01,0x00,0x01,
0x05,0x07,0x01,0x01,0x00,0x01,0x02,0x00,

/*--  文字:  接  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0x44,0x44,0xFF,0x24,0x52,0xD6,0x7A,0x53,0xDA,0x56,0x52,0x00,0x04,0x04,0x07,0x00,
0x04,0x05,0x05,0x02,0x03,0x04,0x04,0x00,

/*--  文字:  单  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0x00,0x00,0x7C,0x55,0x56,0xFC,0x56,0x55,0x54,0x7C,0x00,0x00,0x01,0x01,0x01,0x01,
0x01,0x07,0x01,0x01,0x01,0x01,0x01,0x00,

/*--  文字:  片  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0x00,0x00,0xFF,0x48,0x48,0x48,0x4F,0xC8,0x08,0x08,0x08,0x00,0x04,0x02,0x01,0x00,
0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,

/*--  文字:  机  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0x84,0x64,0xFF,0x24,0x44,0xFE,0x02,0x02,0xFF,0x02,0x00,0x00,0x01,0x00,0x07,0x04,
0x02,0x01,0x00,0x00,0x07,0x04,0x07,0x00,

/*--  文字:  开  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0x20,0x22,0x22,0xFE,0x22,0x22,0x22,0xFE,0x22,0x23,0x22,0x00,0x04,0x04,0x02,0x01,
0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,

/*--  文字:  发  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0x08,0x0E,0x88,0x78,0x2F,0xE8,0x28,0xA9,0x6A,0x08,0x08,0x00,0x04,0x02,0x05,0x04,
0x02,0x02,0x01,0x02,0x02,0x04,0x04,0x00,

/*--  文字:  及  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0x00,0x01,0x81,0x7F,0x11,0x61,0x81,0x9D,0x53,0x30,0x00,0x00,0x04,0x02,0x05,0x04,
0x02,0x02,0x01,0x01,0x02,0x04,0x04,0x00,

/*--  文字:  解  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0x08,0xFE,0xAB,0xFE,0xAA,0xF8,0xAA,0xA6,0xFA,0xAA,0xAE,0x00,0x06,0x01,0x00,0x07,
0x04,0x07,0x00,0x00,0x07,0x00,0x00,0x00,

/*--  文字:  密  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0x44,0x56,0x4A,0x3A,0x62,0x57,0x4A,0x76,0x02,0x12,0x26,0x00,0x00,0x00,0x07,0x04,
0x04,0x07,0x04,0x04,0x04,0x07,0x00,0x00,

/*--  文字:  各  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0x90,0x88,0x44,0xC7,0xAA,0x92,0xAA,0xA6,0xC2,0x40,0x40,0x00,0x00,0x00,0x00,0x07,
0x04,0x04,0x04,0x04,0x07,0x00,0x00,0x00,

/*--  文字:  类  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0xA4,0xA4,0x95,0x8E,0x84,0xDF,0x84,0x8E,0x95,0xA4,0xA4,0x00,0x04,0x04,0x04,0x02,
0x01,0x00,0x01,0x02,0x04,0x04,0x04,0x00,

/*--  文字:  卡  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0x10,0x10,0x10,0x10,0xFF,0x52,0x52,0x92,0x92,0x12,0x10,0x00,0x00,0x00,0x00,0x00,
0x07,0x00,0x00,0x00,0x00,0x01,0x00,0x00,

/*--  文字:  编  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0xD8,0xB4,0x53,0x48,0xFE,0xAA,0xEA,0xAB,0xEA,0xAA,0xEE,0x00,0x02,0x02,0x05,0x02,
0x07,0x00,0x03,0x00,0x03,0x04,0x07,0x00,

/*--  文字:  程  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0x8A,0x6A,0xFF,0x49,0x20,0xAF,0xA9,0xE9,0xA9,0xAF,0x20,0x00,0x01,0x00,0x07,0x00,
0x04,0x04,0x04,0x07,0x04,0x04,0x04,0x00,

/*--  文字:  器  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0xA0,0xAF,0xA9,0xE9,0xAF,0x30,0xAF,0xA9,0xF9,0xAF,0xA0,0x00,0x00,0x07,0x04,0x04,
0x07,0x00,0x07,0x04,0x04,0x07,0x00,0x00,

/*--  文字:  年  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0x88,0x84,0xF3,0x92,0x92,0x92,0xFE,0x92,0x92,0x92,0x82,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,

/*--  文字:  月  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0x00,0x00,0x00,0xFF,0x49,0x49,0x49,0x49,0xFF,0x00,0x00,0x00,0x00,0x04,0x02,0x01,
0x00,0x00,0x04,0x04,0x07,0x00,0x00,0x00,

/*--  文字:  日  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0x00,0x00,0xFF,0x11,0x11,0x11,0x11,0x11,0x11,0xFF,0x00,0x00,0x00,0x00,0x07,0x02,
0x02,0x02,0x02,0x02,0x02,0x07,0x00,0x00,
/*--  文字:  星  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0x00,0x80,0x7F,0x55,0x55,0xF5,0x55,0x55,0x55,0x5F,0x00,0x00,0x05,0x04,0x05,0x05,
0x05,0x07,0x05,0x05,0x05,0x05,0x04,0x00,

/*--  文字:  期  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0x82,0xFF,0xAA,0xAA,0xFF,0x82,0x00,0xFF,0x49,0x49,0xFF,0x00,0x04,0x02,0x01,0x00,
0x01,0x02,0x04,0x03,0x00,0x04,0x07,0x00,
/*--  文字:  ①  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0xF8,0x04,0x02,0x01,0x09,0xFD,0x01,0x01,0x02,0x04,0xF8,0x00,0x00,0x01,0x02,0x04,
0x05,0x05,0x05,0x04,0x02,0x01,0x00,0x00,

/*--  文字:  ②  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0xF8,0x04,0x02,0x19,0x85,0x45,0x25,0x99,0x02,0x04,0xF8,0x00,0x00,0x01,0x02,0x05,
0x05,0x05,0x05,0x05,0x02,0x01,0x00,0x00,

/*--  文字:  ③  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0xF8,0x04,0x02,0x89,0x05,0x25,0x25,0xD9,0x02,0x04,0xF8,0x00,0x00,0x01,0x02,0x04,
0x05,0x05,0x05,0x04,0x02,0x01,0x00,0x00,

/*--  文字:  ④  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0xF8,0x04,0x02,0x61,0x51,0x49,0xFD,0x41,0x02,0x04,0xF8,0x00,0x00,0x01,0x02,0x04,
0x04,0x05,0x05,0x05,0x02,0x01,0x00,0x00,

/*--  文字:  ⑤  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0xF8,0x04,0x02,0xBD,0x15,0x15,0x15,0xE5,0x02,0x04,0xF8,0x00,0x00,0x01,0x02,0x04,
0x05,0x05,0x05,0x04,0x02,0x01,0x00,0x00,

/*--  文字:  ⑥  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0xF8,0x04,0x02,0xF9,0x25,0x25,0x25,0xC9,0x02,0x04,0xF8,0x00,0x00,0x01,0x02,0x04,
0x05,0x05,0x05,0x04,0x02,0x01,0x00,0x00,

/*--  文字:  ⑦  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=12x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=12x16  --*/
0xF8,0x04,0x02,0x0D,0x05,0xC5,0x35,0x0D,0x02,0x04,0xF8,0x00,0x00,0x01,0x02,0x04,
0x04,0x05,0x04,0x04,0x02,0x01,0x00,0x00,

};
unsigned char code   ASC12[]={
/*--  文字:  0  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=6x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=6x16  --*/
0xF8,0x04,0x04,0x04,0xF8,0x00,0x01,0x02,0x02,0x02,0x01,0x00,

/*--  文字:  1  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=6x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=6x16  --*/
0x00,0x08,0xFC,0x00,0x00,0x00,0x00,0x02,0x03,0x02,0x00,0x00,

/*--  文字:  2  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=6x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=6x16  --*/
0x18,0x84,0x44,0x24,0x18,0x00,0x03,0x02,0x02,0x02,0x02,0x00,

/*--  文字:  3  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=6x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=6x16  --*/
0x08,0x04,0x24,0x24,0xD8,0x00,0x01,0x02,0x02,0x02,0x01,0x00,

/*--  文字:  4  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=6x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=6x16  --*/
0x40,0xB0,0x88,0xFC,0x80,0x00,0x00,0x00,0x00,0x03,0x02,0x00,

/*--  文字:  5  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=6x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=6x16  --*/
0x3C,0x24,0x24,0x24,0xC4,0x00,0x01,0x02,0x02,0x02,0x01,0x00,

/*--  文字:  6  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=6x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=6x16  --*/
0xF8,0x24,0x24,0x2C,0xC0,0x00,0x01,0x02,0x02,0x02,0x01,0x00,

/*--  文字:  7  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=6x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=6x16  --*/
0x0C,0x04,0xE4,0x1C,0x04,0x00,0x00,0x00,0x03,0x00,0x00,0x00,

/*--  文字:  8  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=6x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=6x16  --*/
0xD8,0x24,0x24,0x24,0xD8,0x00,0x01,0x02,0x02,0x02,0x01,0x00,

/*--  文字:  9  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=6x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=6x16  --*/
0x38,0x44,0x44,0x44,0xF8,0x00,0x00,0x03,0x02,0x02,0x01,0x00,

/*--  文字:  P  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=6x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=6x16  --*/
0x04,0xFC,0x24,0x24,0x18,0x00,0x02,0x03,0x02,0x00,0x00,0x00,

/*--  文字:  I  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=6x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=6x16  --*/
0x04,0x04,0xFC,0x04,0x04,0x00,0x02,0x02,0x03,0x02,0x02,0x00,

/*--  文字:  C  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=6x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=6x16  --*/
0xF8,0x04,0x04,0x04,0x0C,0x00,0x01,0x02,0x02,0x02,0x01,0x00,
/*--  文字:  ;  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=6x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=6x16  --*/
0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x08,0x06,0x00,0x00,0x00,
/*--  文字:  :  --*/
/*--  宋体9;  此字体下对应的点阵为:宽x高=6x12   --*/
/*--  高度不是8的倍数,现调整为:宽度x高度=6x16  --*/
0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,

};


unsigned char code   Bmp1zk[]={
/*--  调入了一幅图像:C:\prog\合创\庆丰.bmp  --*/
/*--  宽度x高度=32x16  --*/
0x00,0x00,0x00,0xF8,0x08,0x88,0x88,0x89,0xF6,0x44,0x44,0x44,0x44,0x00,0x00,0x00,
0x00,0x00,0x00,0x10,0x90,0x90,0x90,0xFF,0x48,0x48,0x48,0x08,0x00,0x00,0x00,0x00,
0x40,0x30,0x0E,0x41,0x20,0x10,0x08,0x06,0x01,0x06,0x18,0x60,0x40,0x40,0x40,0x00,
0x00,0x00,0x04,0x04,0x04,0x04,0x04,0x7F,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,
};
unsigned char code   Bmp2zk[]={
/*--  调入了一幅图像:C:\prog\合创\电子.bmp  --*/
/*--  宽度x高度=32x16  --*/
0x00,0x00,0xF0,0x10,0x90,0x90,0xFF,0x48,0x48,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,
0x00,0x80,0x80,0x84,0x84,0x84,0x94,0xE2,0x52,0x4A,0x46,0x42,0x40,0x40,0x40,0x00,
0x00,0x00,0x07,0x04,0x04,0x04,0x1F,0x22,0x22,0x22,0x23,0x20,0x20,0x38,0x00,0x00,
0x00,0x00,0x00,0x00,0x10,0x20,0x40,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};

unsigned char code bmp12864[]={
/*--  调入了一幅图像:C:\prog\合创\menuDat8.bmp  --*/
/*--  宽度x高度=128x64  --*/
0xFF,0x01,0x6D,0xB5,0xD9,0x6D,0xB5,0xD9,0x6D,0xB5,0xD9,0x6D,0xB5,0xD9,0x6D,0xB5,
0xD9,0x6D,0xB5,0xD9,0x6D,0xB5,0xD9,0x6D,0xB5,0x01,0x01,0xFD,0x09,0x31,0x09,0xFD,
0x01,0xE1,0x51,0x51,0x51,0x61,0x01,0xF1,0x21,0x11,0x11,0xE1,0x01,0xF1,0x01,0x01,
0x81,0xF1,0x01,0x01,0x01,0x01,0x01,0x01,0xE1,0x11,0x11,0x21,0xFD,0x01,0x81,0x51,
0x51,0x51,0xE1,0x01,0x11,0xFD,0x11,0x01,0x81,0x01,0x81,0x51,0x51,0x51,0xE1,0x01,
0xFD,0x01,0x01,0x01,0x01,0x01,0xE1,0x11,0x11,0x11,0xE1,0x01,0xE1,0x11,0x11,0x11,
0xF1,0x01,0xD9,0x25,0x25,0x25,0xD9,0x01,0x01,0xD9,0x6D,0xB5,0xD9,0x6D,0xB5,0xD9,
0x6D,0xB5,0xD9,0x6D,0xB5,0xD9,0x6D,0xB5,0xD9,0x6D,0xB5,0xD9,0x6D,0xB5,0x01,0xFF,
0xFF,0x00,0xF1,0x11,0x10,0x11,0x11,0x10,0x11,0x91,0x90,0x91,0x91,0x90,0x11,0x11,
0x10,0x11,0x91,0x90,0x91,0x91,0x90,0x91,0x91,0x90,0x90,0x11,0x10,0x10,0x10,0x11,
0x10,0x90,0x11,0x91,0x11,0x90,0x10,0xF1,0xE0,0x00,0x00,0x01,0x00,0xF0,0x11,0xD1,
0x50,0x51,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x51,0x51,0x51,0x51,0x90,0x90,0x11,
0x11,0x11,0x11,0x10,0x10,0x10,0x11,0x11,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x10,
0x11,0x11,0xF1,0xE1,0x01,0x00,0x00,0xF1,0x11,0x11,0x10,0x90,0x50,0x55,0x55,0x55,
0x53,0x50,0x50,0x51,0x91,0x91,0x50,0x50,0x90,0x10,0x11,0x11,0x10,0x11,0x11,0x10,
0x11,0x11,0x90,0x51,0x51,0x50,0x51,0x51,0xD0,0x11,0x11,0x10,0xF1,0xE1,0x00,0xFF,
0xFF,0x00,0xFF,0x00,0x00,0x08,0x00,0x08,0x00,0x0F,0x00,0xE0,0x20,0x2F,0x28,0xE8,
0x08,0x08,0x0F,0x00,0x00,0xE0,0x20,0x20,0xE0,0x00,0x0F,0x08,0x08,0x08,0x00,0x08,
0x00,0x0A,0x00,0xA0,0x00,0x20,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0xFF,0x00,0x1F,
0x10,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x10,0x08,0x08,0x05,
0x02,0x02,0x02,0x02,0xC2,0x42,0xC2,0x02,0x02,0x02,0xC7,0x47,0x47,0xC7,0x07,0x07,
0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0xFF,0x00,0x1E,0x09,0x04,0x04,0x04,0x0C,0xC8,
0x78,0x40,0x78,0xC8,0x04,0x04,0x08,0x08,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x80,
0x40,0x3F,0x00,0x80,0x8C,0x92,0x92,0x8D,0x82,0x41,0x3F,0x00,0xFF,0xFF,0x00,0xFF,
0xFF,0x00,0xFF,0x00,0x00,0xF2,0x10,0xE2,0x00,0xE2,0x92,0xE3,0x00,0x10,0xF0,0x13,
0x02,0xE2,0x92,0xE2,0x02,0xF3,0x00,0x00,0x03,0xE2,0x12,0xE2,0x02,0xE2,0x10,0x52,
0xC0,0x02,0xF8,0xDA,0x08,0xF8,0xF8,0x0F,0xFF,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,
0xF0,0x50,0x20,0x00,0xE0,0x90,0xE0,0x00,0xF0,0x50,0xA0,0x00,0xE0,0x90,0xE0,0x00,
0xF0,0x20,0x41,0x21,0xF1,0x00,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0xF9,0x29,0xA9,
0x88,0xF8,0x0F,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0xE0,0x10,0x10,0x10,0x00,0xE7,
0x90,0xE0,0x00,0xF7,0x00,0x00,0x00,0xF0,0x00,0xF0,0x50,0xA0,0x04,0x22,0x11,0x08,
0x04,0x02,0x01,0x00,0x00,0x00,0x00,0xF8,0xA8,0xA8,0x08,0xF8,0x0F,0xFF,0x00,0xFF,
0xFF,0x00,0xC3,0x44,0x4C,0x4D,0x4D,0x4C,0x4C,0x4D,0x4C,0x4D,0x4C,0x4C,0x4D,0x4C,
0x4C,0x4D,0x4C,0x4D,0x4C,0x4D,0x4D,0x4D,0x4C,0x4C,0x4D,0x4C,0x4C,0x4C,0x4D,0x4D,
0x4D,0x4C,0x4F,0x4A,0x4A,0x4A,0x4B,0xC8,0x8F,0x00,0x00,0x00,0x00,0xC3,0x44,0x4C,
0x4D,0x4C,0x4C,0x4C,0x4D,0x4C,0x4D,0x4C,0x4D,0x4C,0x4D,0x4C,0x4D,0x4C,0x4D,0x4C,
0x4D,0x4C,0x4C,0x4C,0x4D,0x4C,0x4D,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4F,0x4A,0x4A,
0x4A,0x4B,0xC8,0x8F,0x00,0x00,0x00,0xC3,0x44,0x4C,0x4C,0x4D,0x4D,0x4D,0x4C,0x4D,
0x4C,0x4D,0x4C,0x4D,0x4D,0x4D,0x4C,0x4D,0x4C,0x4D,0x4D,0x4C,0x4C,0x4D,0x4C,0x4C,
0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4F,0x4A,0x4A,0x4A,0x4B,0xC8,0x8F,0x00,0xFF,
0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xF8,
0x18,0xD8,0x98,0x18,0x18,0x88,0xC0,0x60,0xB0,0x18,0x08,0x04,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,
0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x60,0x18,0x60,0x80,0x00,0xE0,0x18,0x60,0x80,
0x00,0xE0,0x18,0x60,0x80,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,
0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x8C,0x9E,0xBF,0x33,0x33,0xF7,
0xF6,0xE6,0x00,0xFE,0xFE,0xFE,0x26,0x26,0x26,0x26,0x06,0x00,0x00,0xFE,0xFE,0xFE,
0x26,0x26,0x3E,0xFC,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0xFF,
0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x3F,
0x30,0x30,0x31,0x33,0x37,0x31,0x30,0x3F,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xE0,0x20,0xE0,0x20,0xE0,0x3F,0xFF,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0xE0,0xB0,0x10,0x11,
0xB3,0xE0,0x00,0x00,0x01,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x20,0xA0,
0xA0,0xE0,0x3F,0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x01,0xF3,0x13,0xD3,0xD3,0xF3,
0x03,0x01,0x00,0x93,0x93,0x93,0xF3,0x03,0xF3,0x13,0x13,0xF0,0x00,0xF3,0x13,0x13,
0xF3,0x03,0x93,0x93,0x91,0xF0,0x00,0xE0,0x20,0xA0,0xA0,0xE0,0x3F,0xFF,0x00,0xFF,
0xFF,0x80,0x8F,0x90,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,
0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,
0xB0,0xB0,0xBF,0xAE,0xAE,0xA8,0xAF,0xA0,0xBF,0x80,0x80,0x80,0x80,0x8F,0x90,0xB0,
0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB2,0xB3,0xB0,0xB0,
0xB3,0xB2,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xB0,0xBF,0xAA,0xAA,
0xA8,0xAF,0xA0,0xBF,0x80,0x80,0x80,0x8F,0x90,0xB0,0xB0,0xB3,0xB2,0xB2,0xB2,0xB3,
0xB0,0xB0,0xB0,0xB7,0xB4,0xB4,0xB4,0xB0,0xB7,0xB4,0xB4,0xB7,0xB0,0xB7,0xB4,0xB4,
0xB7,0xB0,0xB4,0xB4,0xB4,0xB7,0xB0,0xBF,0xA8,0xAA,0xA8,0xAF,0xA0,0xBF,0x80,0xFF,

/*--  调入了一幅图像:C:\prog\合创\menuAide.bmp  --*/
/*--  宽度x高度=128x64  --*/
0xFF,0x01,0x6D,0xB5,0xD9,0x6D,0xB5,0xD9,0x6D,0xB5,0xD9,0x6D,0xB5,0xD9,0x6D,0xB5,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x81,
0xC1,0x61,0x51,0x49,0x4D,0xFD,0x81,0x01,0x01,0x81,0x71,0x09,0x01,0x81,0x61,0x19,
0x09,0x09,0x09,0x89,0x79,0x01,0x81,0x61,0x39,0x29,0x29,0x09,0x09,0x09,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x6D,0xB5,0xD9,0x6D,0xB5,0xD9,0x6D,0xB5,0xD9,0x6D,0xB5,0xD9,0x6D,0xB5,0x01,0xFF,
0xFF,0x00,0x81,0x41,0x20,0x11,0x11,0x08,0x09,0x09,0x08,0x09,0x09,0x08,0x09,0x89,
0x88,0x88,0x88,0x08,0x08,0x08,0x08,0x08,0x08,0x88,0x88,0x88,0x08,0x08,0x08,0x88,
0x88,0x88,0x08,0x08,0x08,0x88,0x88,0x88,0x08,0x08,0x08,0x88,0x88,0x88,0x09,0x09,
0x08,0x08,0x08,0x08,0x08,0x09,0x09,0x08,0x08,0x09,0x08,0x08,0x08,0x09,0x09,0x09,
0x09,0x09,0x09,0x08,0x08,0x08,0x09,0x09,0x09,0x09,0x09,0x09,0x08,0x08,0x08,0x08,
0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
0x09,0x09,0x08,0x09,0x09,0x08,0x09,0x09,0x08,0x11,0x11,0x20,0x41,0x81,0x00,0xFF,
0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x21,0x4C,
0x52,0x52,0x4A,0x21,0x1E,0x00,0x00,0x00,0x41,0x60,0x50,0x48,0x47,0x00,0x3F,0x40,
0x40,0x40,0x3F,0x00,0x3F,0x40,0x40,0x40,0x3F,0x00,0x21,0x40,0x44,0x44,0x3B,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xE0,0x30,0x18,0x0C,0xCE,0x2E,0x1E,0xCE,
0x66,0x76,0x36,0x36,0x76,0xE6,0xCC,0x98,0x70,0xE0,0x80,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,
0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x80,0x40,0x40,0x40,0x40,0x80,0x00,0x00,
0x00,0x40,0x20,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xC3,0x00,0x00,0x00,0xFF,0x00,0x00,0xFF,0x01,
0x00,0x00,0x00,0x02,0xFC,0x00,0xFF,0xFF,0xFC,0x03,0xFF,0xFC,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,
0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x11,0x22,0x22,0x24,0x24,0x18,0x00,0x1E,
0x25,0x25,0x25,0x16,0x00,0x3F,0x12,0x21,0x21,0x1E,0x00,0x1A,0x25,0x25,0x15,0x3E,
0x00,0x12,0x25,0x25,0x29,0x12,0x01,0x3F,0x21,0x00,0x3F,0x00,0x1E,0x25,0x25,0x25,
0x16,0x00,0x3F,0x01,0x01,0x01,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x3F,0xFC,0xFC,0xFC,0xFF,0xF8,0xC0,0x0F,0x78,
0xC0,0x80,0x40,0xB0,0xEF,0xF0,0x7F,0xBF,0xCF,0xF0,0xFF,0x1F,0x10,0xE0,0xC0,0x80,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,
0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,
0xF0,0x90,0x90,0x90,0x90,0x00,0xF0,0x90,0x90,0x90,0x10,0x00,0xF0,0x90,0x90,0x90,
0x10,0x00,0xF0,0x90,0x90,0x90,0x90,0x60,0x00,0xC0,0x20,0x10,0x10,0x10,0x20,0xC0,
0x00,0x10,0x60,0x80,0x00,0x80,0x60,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x0F,0x0F,0x0F,0x0E,
0x0C,0x0D,0x0D,0x0D,0x0D,0x0E,0x07,0x03,0x01,0x03,0x07,0x0F,0x1E,0x3F,0x7F,0xFF,
0xFF,0xFE,0xFC,0xF8,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,
0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x08,0x08,0x07,0x00,
0x0F,0x08,0x08,0x08,0x08,0x00,0x0F,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,
0x00,0x00,0x0F,0x00,0x00,0x01,0x06,0x08,0x00,0x03,0x04,0x08,0x08,0x08,0x04,0x03,
0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,
0xFF,0x80,0x83,0x84,0x88,0x90,0x90,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,
0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,
0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,
0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,
0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,
0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,
0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,
0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0x90,0x90,0x88,0x84,0x83,0x80,0xFF,

};


关键字:PCF8563时钟  AT24C02  LCD12864  显示时钟 引用地址:PCF8563时钟+AT24C02+LCD12864显示时钟程序

上一篇:时钟芯片ds12c887的驱动程序
下一篇:1335 lcd显示C程序

推荐阅读最新更新时间:2024-03-16 15:51

单片机与控制实验(5)——重量测量并在LCD12864显示
一、实验目的和要求   掌握点阵式液晶显示屏的原理和控制方法,掌握点阵字符的显示方法。 掌握模拟/数字(A/D)转换方式, 进一步掌握使用C51语言编写程序的方法,使用C51语言编写实现重量测量的功能。 二、实验设备 单片机测控实验系统 重量测量实验板/砝码 Keil开发环境 STC-ISP程序下载工具 三、实验内容 编写C51程序,使用重量测量实验板测量标准砝码的重量,将结果(以克计)显示到液晶屏上。误差可允许的范围之间。 四、实验步骤 1. 阅读实验原理,掌握YM12864C的控制方式,编写出基本的输出命令和数据的子程序; 2. 掌握点阵字模的构成方式。使用字模软件PCtoLCD2002,设定正确的输出模式,生
[单片机]
单片机与控制实验(5)——重量测量并在<font color='red'>LCD12864</font><font color='red'>显示</font>
51单片机和LCD12864贪吃蛇
单片机源程序如下: #include 12864.h #include tcs_resource.h #define num 15 //用来描述蛇在液晶上面一个点的结构体 struct she { unsigned char x,y,value; unsigned char direction; }; struct loop_queue //利用循环数组实现循环队列,拐点不会超过15个。所以大小选15足以。 { unsigned int front; unsigned int rear; unsigned int count; struct she da
[单片机]
51单片机和<font color='red'>LCD12864</font>贪吃蛇
STC89C52+AT24C02实现设备开机次数记录
一、项目介绍 在一些设备的使用过程中,需要对设备的使用次数进行统计和记录。这可以用于评估设备的实际使用寿命、确定维护周期、预测故障风险等方面,对于提高设备的稳定性和可靠性具有重要意义。 当前项目采用STC89C52作为主控芯片,AT24C02作为存储芯片,实现了设备的开机次数记录功能。每次设备上电启动时,程序会从AT24C02中读取之前的记录值并加1,然后再将新的记录值写入AT24C02中,从而完成一次开机次数的记录。通过这种方式,可以实时、准确地记录设备的使用次数,并且不受断电影响,数据可靠性高 二、AT24C02介绍 AT24C02是一款由Atmel公司生产的串行EEPROM存储器芯片,可以存储2K(2048bit)
[单片机]
STC89C52+AT24C02实现设备开机次数记录
用51单片机控制LCD12864显示屏源程序
12864液晶在出厂时其对比度已经调好,所以用户在使用的时候第三管脚可不用接任何东西,本实验板上为了兼容多家12864液晶所以加了液晶对比度调节电位器,若用户使用我们配套的12864液晶可不用管它,液晶的第三管脚悬空就可以。有些液晶功耗比较大,用户在使用的时候可将液晶的第19、20引脚的背光不接,这样字体会很清楚。 单片机源程序如下: /**********************BST-V51实验开发板例程************************ * 平台:BST-V51 + Keil U3 + STC89C52 * 名称: * 晶振:11.0592MHZ * 说明:免费开源,不提供源代码分析. ********
[单片机]
用51单片机控制<font color='red'>LCD12864</font><font color='red'>显示</font>屏源程序
LCD12864的串口驱动(asm/c51)
串行数据传送共分三个字节完成: 第一字节:串口控制 格式 11111ABC A 为数据传送方向控制:H 表示数据从LCD 到MCU,L 表示数据从MCU 到LCD B 为数据类型选择:H 表示数据是显示数据,L 表示数据是控制指令 C 固定为0 第二字节:(并行)8 位数据的高4 位 格式 DDDD0000 第三字节:(并行)8 位数据的低4 位 格式 0000DDDD 串行接口时序参数:(测试条件:T=25℃ VDD=4.5V) ////////////////////////////////////////////////////////////////////////////
[单片机]
<font color='red'>LCD12864</font>的串口驱动(asm/c51)
51单片机OLED时钟显示
oled时钟单片机源程序如下: #include REG52.h #include oled.h #define uchar unsigned char #define uint unsigned int #include intrins.h sbit DQ = P3^6; //数据口define interface /***********************DS1302端口定义*******************************************/ sbit clock_rst=P3^5; //1302复位管脚定义 sbit clock_dat=P1^3; //13
[单片机]
I2C总线AT24C02芯片应用
I2C总线进行数据传送时,时钟信号为高电平期间,数据线上的数据必须保持稳定,只有在时钟线上的信号为低电平期间,数据线上的高电平或低电平状态才允许变化。 起始和终止信号 :SCL线为高电平期间,SDA线由高电平向低电平的变化表示起始信号;SCL线为高电平期间,SDA线由低电平向高电平的变化表示终止信号。 数据传送格式(1)字节传送与应答 每一个字节必须保证是8位长度。数据传送时,先传送最高位(MSB),每一个被传送的字节后面都必须跟随一位应答位(即一帧共有9位)。如果一段时间内没有收到从机的应答信号,则自动认为从机已正确接收到数据。 3引角对应,为当前电路中的地址选择线,三根线可选择8个芯片同时连接在电
[单片机]
I2C总线<font color='red'>AT24C02</font>芯片应用
凌阳61单片机使用7段数码管显示数字时钟的程序
#include SPCE061v004.h #include unspmacro.h //中断函数定义 void IRQ1(void) __attribute__((ISR)); void IRQ5(void) __attribute__((ISR)); void IRQ6(void) __attribute__((ISR)); enum { RUN, CHGSECOND, CHGMINUTE, CHGHOUR } clock_status; //时钟的状态 unsigned int hour,minute,second; unsigned int show_hour, show_minute, show_sec
[单片机]
小广播
添点儿料...
无论热点新闻、行业分析、技术干货……
设计资源 培训 开发板 精华推荐

最新单片机文章
何立民专栏 单片机及嵌入式宝典

北京航空航天大学教授,20余年来致力于单片机与嵌入式系统推广工作。

换一换 更多 相关热搜器件
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved