智能车制作
标题:
求液晶1602在S12上的驱动程序
[打印本页]
作者:
huyangtu
时间:
2008-5-19 05:09
标题:
求液晶1602在S12上的驱动程序
<
>想用液晶1602显示小车相关数据,但是把1602的驱程从51系列移植到S12上一直都没成功,不知有哪位大侠有成功移植的共享下代码</P><P>谢谢</P>
作者:
123220063
时间:
2008-10-13 04:48
标题:
Re:求液晶1602在S12上的驱动程序
<
>这里有个12864的那个1602也应该差不多把</P><P>#include <hidef.h> /* common defines and macros */<BR>#include <mc9s12dg128.h> /* derivative information */<BR>#pragma LINK_INFO DERIVATIVE "mc9s12dg128b" <BR>#define LCD_DB PTH<BR>#define LCDRW PTT_PTT6 <BR>#define LCDRS PTT_PTT5 </P><P>unsigned char TimeTable[6]={'\0'},num=0;<BR>unsigned char TimeTable1[3][6]={'\0'},num1=0;</P><P>void delay1ms(uchar time)<BR>{ int delay1ms1,delay1ms2;<BR> for (delay1ms1=0;delay1ms1<time;delay1ms1++)<BR> for (delay1ms2=0;delay1ms2<300;delay1ms2++) ;<BR>}<BR>void Lcd_command(uchar com_data)<BR>{<BR> <BR> LCD_DB=com_data;<BR> LCDRS=0;<BR> LCDRW=0;<BR> E=1;<BR> E=0;<BR> E=1;<BR> LCDRW=1;<BR> LCD_DB=0xff;<BR> LCDRS=0;<BR> DDRH=0x00;<BR> while(PTIH>=0x80);<BR> DDRH=0xff; <BR> E=0;<BR> E=1; <BR>}</P><P>void Lcd_send(uchar send_data)<BR>{<BR> <BR> <BR> LCD_DB=send_data;<BR> LCDRS=1;<BR> LCDRW=0;<BR> E=1;<BR> delay1ms(1);<BR> E=0;<BR> delay1ms(10);<BR> E=1;<BR> LCDRW=1;<BR> LCD_DB=0xff;<BR> LCDRS=0;<BR> DDRH=0x00;<BR> while(PTIH>=0x80);<BR> DDRH=0xff;<BR> E=0;<BR> E=1;<BR> </P><P> delay1ms(2);<BR>}</P><P>void Lcd_init()<BR>{ delay1ms(10); <BR> <BR> E=0; <BR> LCDRS=1;<BR> LCDRW=1;<BR> delay1ms(50); <BR> Lcd_command(0x30);<BR> delay1ms(100);<BR> Lcd_command(0x30);<BR> delay1ms(100);<BR> Lcd_command(0x0c);<BR> delay1ms(100);<BR> Lcd_command(0x01);<BR> delay1ms(100);<BR> Lcd_command(0x06);<BR> delay1ms(100); <BR>} <BR>void Display(uchar x,uchar y)<BR>{<BR>if(y==0)<BR> Lcd_command(0x80|x);<BR>if(y==1)<BR> Lcd_command(0x88|x);<BR>if(y==2)<BR> Lcd_command(0x90|x);<BR>if(y==3)<BR> Lcd_command(0x98|x);<BR>}</P><P>void Lcd_display(unsigned char *str)<BR>{<BR> while(*str!='\0')<BR> { <BR> Lcd_send(*str);<BR> str++;<BR> }<BR>}</P>
作者:
bengzhu1hao
时间:
2009-5-2 11:14
我怎么没发现主函数
作者:
xbsf-写轮眼
时间:
2009-5-13 14:07
建议你好好把1602的时序研究研究,写作框架可以参考基于51的程序!
欢迎光临 智能车制作 (http://111.231.132.190/)
Powered by Discuz! X3.2