深圳市炜烨兴电子有限公司|LCD在线|智能串口液晶
注册| 登录| 通行证 生产液晶显示模块哪家强?Wayeah LCM!专业的液晶显示模块研发、生产厂家!

首页 新闻 字符型| 图形型| 定制型| 智能型| 技术应用 留言反馈 联系方式 |

当前位置液晶应用技术 >> 常用的COG12864模块C51驱动程序|ST7565/S6B0724/NT7502

常用的COG12864模块C51驱动程序|ST7565/S6B0724/NT7502

 


S6B0724/0713 ST7565 SSD1815 NT7532/7502等使用的都是相兼容的指令系统,外部硬件也相差不大。同样用来驱动128*64点阵的液晶屏(最大是132*65),单IC驱动的128*64点阵屏基本都是用这些IC。这种IC都带有串行或并行数据口,可以选择M6800或I8080接口。

S6B0724内部带有升压电路,无须外部输入驱动电压,可以通过软件来调节对比度。在A51的范例中已有通过按键来调节对比度实现示例,需要的可以向我来信申请。
 
--------------------------------------------------------------------------------

以下是S6B0724驱动12864的串行模式的C51范例。

#include //包含文件请改用自己用到的
#include //包含文件请改用自己用到的
typedef unsigned char uchar;
typedef unsigned int uint;
sbit _RS  = P3^3; /*显示数据或控制指令*/
sbit _RET = P3^4; /*复位端*/
sbit _CS  = P3^5; /*片选端*/
sbit _SID = P3^0; /*数据输入端*/
sbit _CLK = P3^1; /*同步时钟*/
uchar code bmp[];
uchar code hz1[]={/*-- 文字: 液 --*/
0x10,0x61,0x06,0xE0,0x18,0x84,0xE4,0x1C,0x84,0x65,0xBE,0x24,0xA4,0x64,0x04,0x00,
0x04,0x04,0xFF,0x00,0x01,0x00,0xFF,0x41,0x21,0x12,0x0C,0x1B,0x61,0xC0,0x40,0x00
};
uchar code hz2[]={/*-- 文字: 晶 --*/
0x00,0x00,0x00,0x00,0x7E,0x2A,0x2A,0x2A,0x2A,0x2A,0x2A,0x7E,0x00,0x00,0x00,0x00,
0x00,0x7F,0x25,0x25,0x25,0x25,0x7F,0x00,0x00,0x7F,0x25,0x25,0x25,0x25,0x7F,0x00
};
uchar code hz3[]={/*-- 文字: 在 --*/
0x00,0x04,0x04,0xC4,0x64,0x9C,0x87,0x84,0x84,0xE4,0x84,0x84,0x84,0x84,0x04,0x00,
0x04,0x02,0x01,0x7F,0x00,0x20,0x20,0x20,0x20,0x3F,0x20,0x20,0x20,0x20,0x20,0x00
};
uchar code hz4[]={/*-- 文字: 线 --*/
0x40,0x60,0x58,0xC7,0x62,0x00,0x90,0x90,0x90,0xFF,0x90,0x92,0x9C,0x94,0x80,0x00,
0x20,0x22,0x23,0x12,0x12,0x12,0x20,0x20,0x10,0x13,0x0C,0x14,0x22,0x40,0xF8,0x00
};
uchar code hz5[]={/*-- 文字: 图 --*/
0x00,0xFE,0x42,0x42,0x22,0x1E,0xAA,0x4A,0xAA,0x9A,0x0A,0x02,0x02,0xFE,0x00,0x00,
0x00,0xFF,0x42,0x42,0x41,0x41,0x48,0x72,0x54,0x40,0x41,0x43,0x41,0xFF,0x00,0x00
};
uchar code hz6[]={/*-- 文字: 形 --*/
0x40,0x42,0x42,0xFE,0x42,0x42,0xFE,0x42,0x42,0x40,0x10,0x88,0xE4,0x47,0x02,0x00,
0x80,0x40,0x30,0x0F,0x00,0x00,0x7F,0x00,0x84,0x42,0x21,0x10,0x08,0x0E,0x04,0x00
};

uchar code hz7[]={/*-- 文字: 显 --*/
0x00,0x00,0x00,0x3E,0x2A,0xEA,0x2A,0x2A,0x2A,0xEA,0x2A,0x3E,0x00,0x00,0x00,0x00,
0x20,0x21,0x22,0x2C,0x20,0x3F,0x20,0x20,0x20,0x3F,0x28,0x24,0x23,0x20,0x20,0x00
};
uchar code hz8[]={/*-- 文字: 示 --*/
0x00,0x20,0x20,0x22,0x22,0x22,0x22,0xE2,0x22,0x22,0x22,0x22,0x22,0x20,0x20,0x00,
0x10,0x08,0x04,0x03,0x00,0x40,0x80,0x7F,0x00,0x00,0x01,0x02,0x0C,0x18,0x00,0x00
};
uchar code hz9[]={/*-- 文字: 模 --*/
0x10,0xD0,0xFF,0x50,0x90,0x04,0xF4,0x54,0x5F,0x54,0x54,0x5F,0xF4,0x04,0x00,0x00,
0x03,0x00,0xFF,0x00,0x00,0x84,0x85,0x45,0x35,0x0F,0x15,0x25,0x65,0xC4,0x44,0x00
};
uchar code hz10[]={/*-- 文字: 块 --*/
0x10,0x10,0xFF,0x10,0x10,0x00,0x08,0x08,0xFF,0x08,0x08,0x08,0xF8,0x00,0x00,0x00,
0x08,0x18,0x0F,0x04,0x85,0x41,0x31,0x0D,0x03,0x05,0x09,0x11,0x31,0x61,0x21,0x00
};
void delay(void)
{
    uchar i,j;
    for (i = 0;i != 0xff;i++)
    for (j = 0;j != 0xff;j++) ;
}
void initcomm(void)/*未用到*/
{
    PCON = 0x80;
    TMOD = 0X21;
    SCON = 0X00; 
    TH1 = 0XFa;
    TL1 = 0XFa;
    TR1 = 1;
    ES = 1;
    TH0 = 0;
    TL0 = 0;
    TR0 = 1; 
    ET0 = 1;
    EA =1;
}

void send2LCM(bit rs,uchar dat )/* rs=0时写入控制指令,rs=1时写入显示数据 */
{
    uchar i;
    _RS = rs;
    _CS = 0;
    for (i=0;i<8;i++)
    {
        CLK = 0;
        if ((dat & 0x80)!=0)
        SID = 1;
    else 
        SID = 0;
        CLK = 1;
        dat = dat<<1;
    }
    _CS = 1;
}

void lcdclear(uchar dat1,uchar dat2)/*写测试数据到LCD全屏*/
{
    uchar i,j;
    for(i = 0xb0;i<0xb8;i++)
    { 
        send2LCM(0,i); //写页地址
        send2LCM(0,0x10); //写初始列地址
        send2LCM(0,0x02);
        for(j = 0x00;j<0x41;j++)
        {
            send2LCM(1,dat1); //写显示数据
            send2LCM(1,dat2);
        }
    }
}

void initlcm(void)    /*初始化LCM*/
{    _RET = 0; //硬复位
    delay();
    _RET = 1;
    send2LCM(0,0xe2); /*软件复位*/
    delay();
    send2LCM(0,0xa2); /*LCD BIAS=1/9*/
    send2LCM(0,0xa0); /*列地址移动方向:ADC=0(SEG1->SEG132)*/
    send2LCM(0,0xc8); /*行扫描方向:SHL=1(COM64->COM1)*/
    delay();
    send2LCM(0,0x2f); /*电源控制模式:VC,VR,VF=111*/
    delay();
    send2LCM(0,0x26); /*内部调整电阻比率:R2,R1,R0=111*/
    delay();
    send2LCM(0,0x81); /*对比度寄存器模式*/
    send2LCM(0,0x3f); /*对比度寄存器值  修改这个值就可以调节对比度了   */
    send2LCM(0,0x40); /*起始行*/
    send2LCM(0,0xe0); /*写入数据时列地址自动加1,但读时不变*/
    send2LCM(0,0xaf); /*开显示*/
}
void dishz(uchar x_add,uchar y_add,uchar code *p)
{/*x_add 页地址 y_add 列地址 *p 字模数据地址*/
    uchar i,pag,colh,coll;
    pag = x_add*2+0xb0;
    colh = y_add>>4; /*取y_add的高4位*/
    colh = colh | 0xf0;
    colh = colh & 0x1f;
    coll = y_add & 0x0f; /*取y_add的低4位*/
    send2LCM(0,colh);
    send2LCM(0,coll);
    send2LCM(0,pag);
    for (i=0;i<32;i++)
    { 
        if (i == 16)
        { 
            send2LCM(0,pag+1);
            send2LCM(0,colh);
            send2LCM(0,coll);
        }
        send2LCM(1,*p++);
    }
}
void disbmp(uchar *p)/*显示一幅128*64的图片*/
{
    uchar i,j;
    for (i = 0xb0;i<0xb8;i++)
    { 
        send2LCM(0,i);
        send2LCM(0,0x10);
        send2LCM(0,0x02);
        for (j=0x02;j<0x82;j++)
            send2LCM(1,*p++);
    }
}
void main(void)
{
    uchar code *hzcode;
    initlcm();
    while(1)
    {
        lcdclear(0x55,0x55);
        delay();
        delay();
        lcdclear(0xff,0x00);
        delay();
        delay();
        lcdclear(0xaa,0x55);
        delay();
        delay();
        lcdclear(0x00,0x00);
        hzcode = hz1;
        dishz(0,2,hzcode);
        hzcode = hz2;
        dishz(0,18,hzcode);
        hzcode = hz3;
        dishz(0,34,hzcode);
        hzcode = hz4;
        dishz(0,50,hzcode);
        hzcode = hz5;
        dishz(0,66,hzcode);
        hzcode = hz6;
        dishz(0,82,hzcode);
        hzcode = hz7;
        dishz(0,98,hzcode);
        hzcode = hz8;
        dishz(0,114,hzcode);
        delay();
        delay();
        hzcode = bmp;
        disbmp(bmp);
        delay();
        delay();
        delay();
    }
}
uchar code bmp[]=
{
/*-- 调入了一幅图像:D:\WORKSPACE\datab\128642.bmp --*/
/*-- 宽度x高度=128x64 --*/
0xFF,0x01,0x01,0x01,0x21,0x61,0x41,0xC1,0xA1,0xE1,0xB1,0xB1,0xE1,0xA1,0xA1,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0xF1,0xF1,0xD1,0xD1,0xD1,0xD1,0xF1,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0xE1,0xF1,0x61,0x61,0x61,0x61,0x61,0x61,0xF1,0x61,0x01,
0x01,0x01,0x01,0x81,0x81,0x81,0xB1,0x91,0x91,0x91,0x91,0x91,0x91,0xA1,0x81,0x81,
0x81,0x81,0x01,0x01,0xA1,0x71,0x51,0x51,0x71,0xC1,0x01,0x71,0xD1,0x51,0x71,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,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,
0xFF,0x00,0x01,0x81,0x99,0x8A,0x86,0x81,0xBF,0x8A,0x8B,0x85,0x87,0x8B,0x98,0x98,
0x90,0x80,0x80,0x80,0xBE,0x9A,0x9B,0x9A,0xBE,0x80,0xBE,0xBE,0xAB,0xAA,0xAA,0xBE,
0x82,0x80,0x80,0xB0,0x90,0x96,0x95,0x91,0x9F,0x91,0x91,0x9F,0x91,0x95,0xB6,0xB0,
0x90,0x80,0x80,0x81,0x88,0x8C,0x86,0xA2,0xA0,0xBF,0x9F,0x80,0x86,0x84,0x89,0x91,
0x81,0x80,0x80,0x84,0x85,0x9D,0x97,0x97,0x9D,0x89,0x9D,0x9F,0x97,0x97,0xBF,0x84,
0x0C,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,0x00,0x00,0x00,0xFF,
0xFF,0x00,0x00,0x02,0x22,0x62,0x42,0xE2,0x42,0xC2,0xA2,0xB2,0xA2,0xA2,0x22,0xE2,
0xC2,0x02,0x02,0x82,0x82,0x82,0xB2,0x92,0x92,0x92,0x92,0x92,0x92,0xA2,0x82,0x82,
0x82,0x82,0x02,0xC2,0xA2,0xA2,0xE2,0x92,0x92,0xF2,0xF2,0xA2,0xA2,0xA2,0xF2,0x02,
0x02,0x02,0x02,0x02,0x02,0x62,0xE2,0x22,0xA2,0xB2,0x72,0x62,0xA2,0xA2,0x22,0x22,
0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
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,0x00,0x00,0x00,0x00,0xFF,
0xFF,0x00,0x00,0x01,0x19,0x19,0x0E,0x25,0x27,0x1B,0x1B,0x07,0x0B,0x1B,0x1F,0x20,
0x00,0x00,0x00,0x01,0x08,0x0C,0x06,0x22,0x20,0x3F,0x1F,0x00,0x06,0x04,0x09,0x11,
0x01,0x00,0x00,0x06,0x02,0x1F,0x3F,0x01,0x12,0x15,0x15,0x1F,0x1F,0x15,0x15,0x10,
0x10,0x00,0x00,0x08,0x08,0x0F,0x01,0x02,0x12,0x22,0x23,0x1F,0x02,0x02,0x02,0x06,
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,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,
0xFF,0x00,0x00,0x45,0xC5,0x45,0x05,0x05,0x05,0x05,0x05,0x05,0x85,0x45,0x45,0x45,
0x45,0xC5,0x05,0x45,0xC5,0x45,0x45,0x45,0x85,0x05,0x05,0x05,0x45,0x45,0xC5,0x45,
0x45,0x05,0x05,0x45,0xC5,0x85,0x05,0x05,0x45,0xC5,0x45,0x45,0xC5,0x45,0x05,0x05,
0x05,0x05,0x05,0x05,0x45,0x45,0xC5,0x45,0x45,0x05,0x05,0x45,0xC5,0x85,0x05,0x05,
0x45,0xC5,0x45,0x45,0xC0,0x40,0x40,0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x81,
0xFF,0x81,0x80,0x80,0xC0,0x00,0x70,0x88,0x88,0x70,0x00,0x00,0x50,0xA8,0xA8,0xF0,
0x80,0x00,0x70,0x88,0x89,0xFF,0x80,0x00,0x88,0xF9,0x80,0x00,0x00,0x88,0xF8,0x88,
0x08,0xF0,0x80,0x00,0xD0,0xA8,0xA8,0x98,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,
0xFF,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x80,0x00,0x3E,0xC1,0x00,0x00,0x00,
0x80,0x41,0x00,0x00,0xFF,0x00,0x00,0x00,0x80,0x7F,0x00,0x00,0x00,0x00,0xFF,0x00,
0x00,0x00,0x00,0x00,0xFF,0x01,0x06,0x38,0xC0,0xFF,0x00,0x00,0xFF,0x00,0x00,0x00,
0x00,0x80,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0x01,0x06,0x38,
0xC0,0xFF,0x00,0x00,0xFF,0x04,0x04,0x1F,0x00,0xC0,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,0x02,0x02,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,
0xFF,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x01,
0x00,0x00,0x08,0xF9,0x09,0x01,0x01,0x01,0x00,0x00,0x00,0x80,0x99,0x99,0x01,0x01,
0x01,0x00,0x80,0x81,0x01,0x01,0x00,0x80,0x80,0x01,0x00,0x81,0x81,0x81,0x81,0x81,
0x81,0x01,0x00,0x80,0x81,0x81,0x81,0x81,0x81,0x00,0x00,0x01,0x01,0x01,0x00,0x00,
0x00,0x01,0x00,0x71,0x09,0x09,0x09,0x89,0x71,0x00,0x00,0xE0,0x10,0x08,0x08,0x10,
0xE0,0x00,0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x30,0x08,0x88,0x88,0x48,
0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x10,0x08,0x08,0x10,
0xE0,0x00,0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,
0xFF,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
0x80,0x80,0xA0,0xBF,0xA0,0xA0,0xA0,0xA0,0xB0,0x80,0x80,0xA0,0xA0,0xBF,0xA0,0xA0,
0x80,0x80,0x80,0x9F,0xA0,0xA0,0xA0,0x90,0xBF,0xA0,0x80,0xA1,0xB0,0xAC,0xA2,0xA1,
0xB0,0x80,0x80,0xA1,0xB0,0xAC,0xA2,0xA1,0xB0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
0x80,0x80,0x80,0xB0,0xA8,0xA4,0xA2,0xA1,0xB0,0x80,0x80,0x8F,0x90,0xA0,0xA0,0x90,
0x8F,0x80,0x80,0x8F,0x90,0xA0,0xA0,0x90,0x8F,0x80,0x80,0x98,0xA0,0xA0,0xA0,0x91,
0x8E,0x80,0x80,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x80,0x8F,0x90,0xA0,0xA0,0x90,
0x8F,0x80,0x80,0x87,0x84,0xA4,0xA4,0xBF,0xA4,0x80,0x80,0x80,0x80,0x80,0x80,0xFF
};

[来源:深圳市炜烨兴电子有限公司] [作者:wayeah] [日期:09-03-26] [热度:]

评论

© 2004-2015 Wayeah LCM All rights reserved.

Powered by: KingCMS 5.1.0.0812

|2009旧版 | 联系方式 | 付款方式 | 淘宝店|