void lcd_write(bit start, uchar in_data) { uchar Hdata,Ldata; while(lcd_busy()); Hdata=in_data&0xf0; //取高四位 Ldata=(in_data<<4)&0xf0; //取低四位 if(start==0) LCD_RS = 0; //写入命令 else LCD_RS = 1; //写入数据 LCD_RW = 0; LCD_EN = 0; delayNOP(); P0 = Hdata; //发送高四位 LCD_EN = 1; delayNOP(); LCD_EN = 0; delayNOP(); P0 = Ldata; //发送低四位 LCD_EN = 1; delayNOP(); LCD_EN = 0; delayNOP(); }
void lcd_tx_char(char character) { while (lcd_busy()); PTH = character; PORTK |= CHARACTER_WRITE; PORTK &= REST_STATE; }
void lcd_tx_control(unsigned char control) { while (lcd_busy()); PTH = control; PORTK |= CONTROL_WRITE; PORTK &= REST_STATE; }
/*写指令*/ void WriteComm(u8 comm) { lcd_busy(); RSL; RWL; OutPutData(comm); //列地址赋值,x取值0----64 ENH; Delay(2); ENL; }
/* Schreibt ein Char auf das Display */ int lcd_wchar(int data) { int ret,temp; ret=0; if(!lcd_busy()) { temp = data >> 4; ret = lcd_write_nibble(LCD_DR,temp); temp = data & 0xf; ret = lcd_write_nibble(LCD_DR,temp); }
/*写数据*/ void WriteData(u8 data) { lcd_busy(); RSH; RWL; OutPutData(data); //数据送显 ENH; Delay(2); ENL; OutPutData(0xff); }
/*写数据 */ void write_data(uchar dat) { while(lcd_busy()); LCD_RS = 1; LCD_RW = 0; LCD_EN = 0; P2 = dat; delayNOP(); LCD_EN = 1; delayNOP(); LCD_EN = 0; }
void lcd_wdat(uchar dat) { while(lcd_busy()); LCD_RS = 1; LCD_RW = 0; LCD_EN = 0; P0 = dat; delayNOP(); LCD_EN = 1; delayNOP(); LCD_EN = 0; }
/*写指令数据到LCD */ void lcd_wcmd(uchar cmd) { while(lcd_busy()); LCD_RS = 0; LCD_RW = 0; LCD_EN = 0; _nop_(); _nop_(); P2 = cmd; delayNOP(); LCD_EN = 1; delayNOP(); LCD_EN = 0; }