深圳市川航电子科技有限公司
联系人:常东
电话:0755-29035962
直线:15112585657
传真:0755-29035961
QQ:1343115013
MSN:xingyuncaocd@hotmail.com
邮箱:chuanhanglcm@163.com
网址:http://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 REST=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;
REST=0; _nop_(); _nop_(); _nop_(); _nop_(); REST=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();
}
}
注:以上程序并未完全付上,具体子程序请与店主联系,谢谢!
|