写了一个1602的程序。仿真也OK .
但是编译后,弹出一个对话框:file has benn changed outside the editor,reload? from 1602.M51
请问,程序该怎么修改。
程序如下:
#include <reg52.h> #define uint unsigned int #define uchar unsigned char
sbit RS=P2^0; //data/command select; sbit RW=P2^1;//read&write port; sbit E=P2^2; //enable port
uchar code table[]="LCD1602 check ok"; uchar code table1[]="GA stock go";
void delay(uint z) { uint j; while(z--) { for(j=0;j<125;j++); } }
void lcd_wcom(uchar com)// write command to 1602 { RS=0; RW=0; P0=com; delay(5); E=1; E=0; }
void lcd_wdat(uchar dat) { RS=1; RW=0; P0=dat;//write data to 1602 delay(5); E=1; E=0; }
void lcd_init() { lcd_wcom(0x38);//显示模式设置 lcd_wcom(0x0c);//显示开关及光标设置 lcd_wcom(0x06); //读或写一个字符后,地址指针加一,光标加一 lcd_wcom(0x01); //清屏设置 }
void main() { uchar n,m=0; lcd_init(); lcd_wcom(0x80); for(m=0;m<16;m++) { lcd_wdat(table[m]); delay(200); } lcd_wcom(0x80+0x41); for(n=0;n<8;n++) { lcd_wdat(table1[n]); delay(200); } while(1); }
|