st7565显示汉字程序(St7565 display Chinese character program).doc
st7565显示汉字程序(St7565 display Chinese character program) This is a program I downloaded from the , a little change to get, I hope useful for friends /******** LCD controller st7565 program ************/ #include <> #include <> #include <> #include """ #define uchar unsigned char #define uint unsigned int Sbit SDA=P2^1; //lcd-data Sbit SCK=P2^3; //lcd-clk Sbit DI=P2^0; //lcd-A0 Sbit CS=P2^2; //lcd-cs /*======== write a byte order ==============*/ mand (uchar CMD) { Uint i; DI=0; SCK=0; CS=0; For (i=0; i<8; i++) { SCK=0; _nop_ (); _nop_ (); SDA=cmd&0x80; Cmd=cmd<<1; _nop_ (); _nop_ (); SCK=1; _nop_ (); _nop_ (); } CS=1; } /*======== write a byte of data ==============*/ Write_data (uchar DAT) { Uint i; DI=1; SCK=0; CS=0; For (i=0; i<8; i++) { SCK=0; _nop_ (); _nop_ (); SDA=dat&0x01; Dat=dat>>1; _nop_ (); _nop_ (); SCK=1; _nop_ (); _nop_ (); } CS=1; } /////////////////////////////// LCD initialization //////////////////////////////////////////////// Void init_1815 (void) { mand (0xaf); //0xaf open display, 0xae off display mand (0x40); / / set the display start line for a total of 64 0x40-0x7f //mand (0xa0); //RAM column address and column drive in the same order 0-131 mand (0xa1); / / RAM or set the column address and column driver inverse 131-00xb0-0xb8 sequence mand (0xa6); //0xa6 positive display 0xa7 is reverse display mand (0xa4); //0xa4 normal display, 0xa5 showed full brightness mand (0xa2); //0xa2LCD bias ratio 1/9 0xa3 is bias voltage ratio 1/7 mand (0xc8); / / line driver for reverse direction //mand (0xc0); / / or set the line driving direction is positive mand (0x2F); / / start internal LCD drive power 0x28 boost voltage regulator voltage follower 0x2c step-up open voltage regulator voltage follower 0x2e step-up voltage regulator on voltage follower X2F step-up voltage regulator voltage follower. mand (0x25); / / internal resistance ratio mand (0xf8); / / boos
st7565显示汉字程序(St7565 display Chinese character program) 来自淘豆网www.taodocs.com转载请标明出处.