深圳市川航电子科技有限公司
:常东
:
直线:
传真:
MSN:
:
网址:https://www.szchuanhang.com
附页
C语言程序代码:
#include #include #include "clip.h"
#define uchar unsigned char #define uint unsigned int
sbit RS =P3^3; //接板上RS脚 sbit RW =P3^0; //接板上RW脚 sbit E1 =P3^1; //接板上E1脚 sbit E2 =P3^2; //接板上E2脚
sbit R*T=P3^4;
#define lcd_data P1
//================================================================
void wr_cmd1(uchar cmd) { lcd_data = 0x00; // Set the port as Output RS = 0; RW = 0; E1 = 1; lcd_data = cmd; delay_us(5); //此处*需* E1 = 0; RW = 1; lcd_data = 0xFF; delay_us(5); //此处*需* }
//----------------------------------------------------------------
void wr_data1(uchar dat) {
lcd_data = 0x00; // Set the port as Output RS = 1; RW = 0; E1 = 1; lcd_data = dat; delay_us(5); //此处*需* E1 = 0; RW = 1; lcd_data = 0xFF; delay_us(5); //此处*需* }
//----------------------------------------------------------------
//主程序 void main() { uint i;
R*T=0; _nop_(); _nop_(); _nop_(); _nop_(); R*T=1; _nop_(); _nop_();
init_lcd();
while(1) {
gotoxy1(1, 2); SendStr1("<<静夜思>>"); DELAY_CLS();
testshow(0xff,0xff); //全显 testshow(0x00,0x00); //空白 testshow(0xff,0x00); //横显 testshow(0x55,0x55); //竖显 testshow(0xaa,0x55); //雪花
gotoxy1(2, 2); SendStr1("<<静夜思>>"); DELAY_CLS();
}
}
注:以上程序并未*付上,具体子程序请与店主联系,谢谢!
|