nokia3310显示屏的中文说明 3310CN.PDF
/* 3310液晶显示屏C51测试程序 接脚资料: Pin Signal Description Port 1:VDD Power Input. Logic supply voltage range VDD to GND : 2.7 to 3.3 V 2:SCLK Serial clock. Input for the clock signal: 0.0 to 4.0 Mbits/s. 3:SDIN Serial data. Input for the data line. 4:D/C Mode Select. To select either command/address or data input. 5:SCE Chip enable input. The enable pin allows data to be clocked in. The signal is active LOW. 6:GND Ground 7:VOUT Ouptut voltage. Add external 1-10 uF electrolytic capacitor from VOUT to GND 8:RES External reset. This signal will reset the device and must be applied to properly initialize the chip. The signal is active LOW. 控制芯片: PCD8544 宽×高(像素): 84×48 */
#include #define uchar unsigned char #define uint unsigned int
sbit sclk=P2^0;//时钟 sbit sdin=P2^1; //数据 sbit dc=P2^2;//1写数据,0写指令 sbit sce=P2^3;//片选 sbit res=P2^4;//复位,0复位
extern void delayus(uchar us); extern void delayms(uchar ms);
extern void lcm_writebyte(uchar dd,bit a);
extern unsigned char code bitmap1[];
void lcm_init(void) //LCM初始化 { res=0; delayus(100); res=1; sce=1; sdin=1; sclk=1; lcm_writebyte(0x21,0);//初始化Lcd,功能设定使用扩充指令 lcm_writebyte(0xd5,0);//设定液晶偏置电压(高--低) lcm_writebyte(0x20,0);//使用基本指令 lcm_writebyte(0x0C,0);//设定显示模式,正常显示 }
void lcm_writebyte(uchar datatemp,bit mod)//写一字节 mod=0,命令模式 { uchar i=8; sce=0; dc=mod; while (i--){ if (datatemp&0x80){sdin=1;} else {sdin=0;} sclk=0; sclk=1; datatemp<<=1; } dc=1; sce=1; sdin=1; }
void lcm_write(uchar bytes,bit mod)//写一字节 mod=0,命令模式 { uchar i,datatemp; sce=0; dc=mod; while (bytes--){ while (i--){ if (datatemp&0x80){sdin=1;} else {sdin=0;} sclk=0; sclk=1; datatemp<<=1; } } dc=1; sce=1; sdin=1; }
void lcm_setadd(uchar y,uchar x)//设定地址 y=0~5,x=0~83 { lcm_writebyte((y|0x40),0); lcm_writebyte((x|0x80),0); }
void lcm_clr()//清全屏 { uchar m,n; lcm_setadd(0,0); for (m=0;m<6;m++){ for (n=0;n<84;n++){ lcm_writebyte(0,1); } } }
void xp()//写一屏图 { uchar e; uchar t; uchar k; uint d=0; for (t=0;t<6;t++){ for (k=0;k<84;k++){ e=bitmap1[d]; d++; lcm_writebyte(e,1); } } }
void main(void)//主程序 { uint t;
lcm_init(); lcm_clr();//清屏 while (1){
xp();//写一屏图 for(t=0;t<60000;t++);//延时
} }
uchar code bitmap1[]= { /*----------------------------------------------------------------------------- - ; 源文件 / 文字 : E:33101qq.bmp模 ; 宽×高(像素): 84×48 ; 字模格式/大小 : 单色点阵液晶字模,纵向取模,字节倒序/504字节 ; 数据转换日期 : 2004-7-30 13:40:24*/ 0x00,0x00,0x02,0xFA,0x8A,0x8A,0x8A,0xFA,0x02,0x02,0xFE,0x03,0x02,0x00,0x40,0x4F , 0xC9,0x79,0x49,0xCF,0x00,0xFC,0x00,0x00,0xFF,0x00,0x02,0x82,0x02,0xBE,0x22,0x63 , 0xA2,0x22,0x22,0xA2,0x02,0x00,0x00,0x01,0x01,0x01,0x01,0xF9,0x09,0x05,0x03,0x01 , 0x00,0x00,0x10,0x14,0x14,0x94,0xD4,0xBF,0x94,0x5C,0x54,0x12,0x10,0x00,0x00,0xFF , 0x29,0x29,0xFF,0x00,0xFF,0x29,0x29,0xFF,0x00,0x00,0x04,0x04,0x04,0xC4,0x3F,0xD4 , 0x14,0x94,0x74,0x06,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x04,0x04,0x07,0x00 , 0x00,0x00,0x04,0x02,0x01,0x04,0x04,0x03,0x00,0x01,0x04,0x04,0x07,0x00,0x02,0x01 , 0x00,0x07,0x04,0x04,0x05,0x04,0x06,0x00,0x03,0x00,0x00,0x80,0x40,0x44,0x84,0x07 , 0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x92,0x51,0x30,0x37,0x14,0x14,0x14,0x04,0x07 , 0x00,0x00,0x26,0x21,0x44,0x84,0x07,0x02,0x01,0x04,0x04,0x07,0x00,0x00,0x04,0x02 , 0x05,0x04,0x04,0x02,0x01,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 , 0x30,0x48,0x88,0x10,0x60,0x78,0x04,0x04,0xF8,0x00,0x00,0x00,0x00,0x00,0x1C,0xE2 , 0x02,0x04,0x08,0x04,0x84,0x84,0x82,0x02,0x02,0x02,0x01,0x81,0x41,0x21,0x21,0x20 , 0x00,0x04,0x07,0x18,0x60,0x80,0x00,0x00,0xF0,0x0C,0x03,0x00,0xFC,0x00,0x00,0x04 , 0x0E,0x04,0xC0,0x60,0x62,0x37,0x12,0x90,0x16,0x19,0x7A,0xFC,0xF8,0xF0,0x80,0x40 , 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 , 0x00,0x00,0x00,0x00,0x00,0x07,0x08,0x10,0xE0,0x00,0x00,0x00,0xF8,0x07,0x00,0x00 , 0x02,0x12,0x12,0x1F,0xF4,0xA0,0x00,0x00,0x00,0x40,0x80,0x81,0x8C,0x5C,0x3C,0x2C , 0x40,0x40,0x40,0x20,0x00,0x00,0x80,0xC0,0x64,0x5F,0x45,0xC9,0x83,0x04,0x04,0x04 , 0x1B,0x20,0x40,0x80,0x80,0x01,0x00,0x00,0x00,0x00,0x10,0x14,0x23,0x21,0xA1,0x51 , 0xF1,0x3F,0x12,0xE2,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 , 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x0C,0x10,0x20 , 0x21,0x22,0x22,0x22,0x7F,0x41,0x41,0x47,0x49,0xCB,0x0F,0x06,0x06,0x04,0x0C,0x1C , 0x14,0x34,0x24,0x24,0x14,0x14,0x12,0x0A,0x06,0x01,0x00,0x00,0x00,0x00,0xE0,0x20 , 0x2F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01 , 0x01,0x01,0x00,0x00,0xF8,0x21,0x21,0x40,0x40,0x20,0xD1,0x8A,0x0C,0x10,0x20,0xC0 , 0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20 , 0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x1F,0x20 , 0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20 , 0x00,0x20,0x07,0x38,0x00,0x3F,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20 , 0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x07,0x38,0x04,0x22,0x01,0x31,0x10,0x28 , 0x08,0x24,0x04,0x23,0x00,0x20,0x00,0x20 };
|