📄 c5112864a.html
字号:
}<br>void LcdData1(char); /* Photo type of routine */<br>void LcdData1(char c)<br>{<br> PioCon = 0x0c|0x02|0x00;<br> /* Input Output<br> Port A = 0x00 0x01<br> Port B = 0x00 0x02<br> Port C = 0x00 0x0c<br> Counter = Disable<br> */<br> LcdDataPort = c;<br> LcdCtrlPort = LcdCtrlPort | LcdRegPin;<br> LcdCtrlPort = LcdCtrlPort & (LcdRWPin^0xff);<br> LcdCtrlPort = LcdCtrlPort | LcdCS1Pin;<br> LcdCtrlPort = LcdCtrlPort & (LcdCS2Pin^0xff);<br> LcdCtrlPort = LcdCtrlPort | LcdEnablePin;<br> LcdDelay();<br> LcdCtrlPort = LcdCtrlPort & (LcdEnablePin^0xff);<br> LcdDelay();<br>}<br>void LcdData2(char); /* Photo type of routine */<br>void LcdData2(char c)<br>{<br> PioCon = 0x0c|0x02|0x00;<br> /* Input Output<br> Port A = 0x00 0x01<br> Port B = 0x00 0x02<br> Port C = 0x00 0x0c<br> Counter = Disable<br> */<br> LcdDataPort = c; <br> LcdCtrlPort = LcdCtrlPort | LcdRegPin;<br> LcdCtrlPort = LcdCtrlPort & (LcdRWPin^0xff);<br> LcdCtrlPort = LcdCtrlPort & (LcdCS1Pin^0xff);<br> LcdCtrlPort = LcdCtrlPort | LcdCS2Pin;<br> LcdCtrlPort = LcdCtrlPort | LcdEnablePin;<br> LcdDelay();<br> LcdCtrlPort = LcdCtrlPort & (LcdEnablePin^0xff);<br> LcdDelay();<br>}<br>char LcdRead1(void); /* Photo type of routine */<br>char LcdRead1()<br>{ <br> data unsigned char c;<br> PioCon = 0x0c|0x00|0x00;<br> /* Input Output<br> Port A = 0x00 0x01<br> Port B = 0x00 0x02<br> Port C = 0x00 0x0c<br> Counter = Disable<br> */<br> LcdCtrlPort = LcdCtrlPort | LcdRegPin;<br> LcdCtrlPort = LcdCtrlPort | LcdRWPin;<br> LcdCtrlPort = LcdCtrlPort | LcdCS1Pin;<br> LcdCtrlPort = LcdCtrlPort & (LcdCS2Pin^0xff);<br><br> LcdCtrlPort = LcdCtrlPort | LcdEnablePin;<br> LcdDelay();<br><br> LcdCtrlPort = LcdCtrlPort & (LcdEnablePin^0xff);<br> LcdDelay();<br><br> LcdCtrlPort = LcdCtrlPort | LcdEnablePin;<br> LcdDelay();<br><br> c= LcdDataPort;<br> LcdCtrlPort = LcdCtrlPort & (LcdEnablePin^0xff);<br> LcdDelay();<br><br> return (c);<br>}<br>char LcdRead2(void); /* Photo type of routine */<br>char LcdRead2()<br>{ <br> data unsigned char c;<br> PioCon = 0x0c|0x00|0x00;<br> /* Input Output<br> Port A = 0x00 0x01<br> Port B = 0x00 0x02<br> Port C = 0x00 0x0c<br> Counter = Disable<br> */<br> LcdCtrlPort = LcdCtrlPort | LcdRegPin;<br> LcdCtrlPort = LcdCtrlPort | LcdRWPin;<br> LcdCtrlPort = LcdCtrlPort & (LcdCS1Pin^0xff);<br> LcdCtrlPort = LcdCtrlPort | LcdCS2Pin;<br><br> LcdCtrlPort = LcdCtrlPort | LcdEnablePin;<br> LcdDelay();<br><br> LcdCtrlPort = LcdCtrlPort & (LcdEnablePin^0xff);<br> LcdDelay();<br><br> LcdCtrlPort = LcdCtrlPort | LcdEnablePin;<br> LcdDelay();<br><br> c= LcdDataPort;<br> LcdCtrlPort = LcdCtrlPort & (LcdEnablePin^0xff);<br> LcdDelay();<br><br> return (c);<br>}<br>void LcdInit(void); /* LCD初始化 */<br>void LcdInit()<br>{ <br> data char i,j;<br> LcdCmd(0x3f); /* Display on/off, 0x3f = on , 0x3e = off */<br> LcdCmd(0xc0); /* Scan Start (0-63), 0xc0 to 0xff */<br> for (i=0;i<8;i++) /* Fill the screen to blank */<br> {<br> LcdCmd(0xb8|i); /* X Page (0-7), 0xb8 to 0xbf */<br> for (j=0;j<64;j++)<br> {<br> LcdCmd(0x40|j); /* Y Line (0-63), 0x40 to 0x7f */<br> LcdData(0x00); /* Access to two LCD area */<br> }<br> }<br> lcd_row=1;<br> lcd_column=1;<br> lcd_color=1;<br>}<br>void LcdClear(void); /* LCD清屏*/<br>void LcdClear()<br>{ <br> LcdInit();<br>}<br>void LcdGoto(char, char); /* 定位光标坐标 */<br>void LcdGoto(char row, char column)<br>{ <br> lcd_row=row;<br> lcd_column=column;<br>}<br><br>void LcdHgoto(char,char);/*定位汉字显示坐标<br>void LcdHgoto(char row, char column)<br>{<br> lcd_hrow=row;<br> lcd_hcolumn=column;<br> lcd_ascii=column;<br>}<br>void LcdChar(char); /* Photo type of routine */<br>void LcdChar(char c)<br>{ <br> data unsigned char loop;<br> lcd_x=(lcd_column-1)*6;<br> LcdCmd(0xb8|((lcd_row-1)&0x07)); /* X Page (0-7), 0xb8 to 0xbf */<br> for (loop=0;loop<6;loop++)<br> {<br> LcdCmd(0x40|((lcd_x+loop)&0x3f)); /* Y Line (0-63), 0x40 to 0x7f */<br> if ((lcd_x+loop)>63)<br> {<br> if (lcd_color)<br> LcdData2(Char_Bit[c-0x20][loop]);<br> else<br> LcdData2(Char_Bit[c-0x20][loop]^0xff);<br> }<br> else<br> {<br> if (lcd_color)<br> LcdData1(Char_Bit[c-0x20][loop]);<br> else<br> LcdData1(Char_Bit[c-0x20][loop]^0xff);<br> }<br> }<br> lcd_column++;<br> if (lcd_column>21)<br> {<br> lcd_column=1;<br> lcd_row++;<br> if (lcd_row>8)<br> lcd_column=1;<br>}<br>}<br><br>void LcdHchar(char); /* 显示汉字字符 */<br>void LcdHChar(char c)<br>{ <br> data unsigned char loop1,loop2;<br> loop2=0;<br> lcd_x=(lcd_hcolumn-1)*16;<br> LcdCmd(0xb8|(((lcd_hrow-1)*2)&0x07)); /* X Page (0-7), 0xb8 to 0xbf */<br> for (loop1=0;loop1<16;loop1++)<br> {<br> LcdCmd(0x40|((lcd_x+loop1)&0x3f)); /* Y Line (0-63), 0x40 to 0x7f */<br> if ((lcd_x+loop1)>63)<br> {<br> if (lcd_color)<br> LcdData2(Hchar_Bit[c][loop1]);<br> else<br> LcdData2(Hchar_Bit[c][loop1]^0xff);<br> }<br> else<br> {<br> if (lcd_color)<br> LcdData1(Hchar_Bit[c][loop1]);<br> else<br> LcdData1(Hchar_Bit[c][loop1]^0xff);<br> }<br> }<br><br> LcdCmd(0xb8|(((lcd_hrow-1)*2+1)&0x07)); /* X Page (0-7), 0xb8 to 0xbf */<br> for (;loop1<32;loop1++)<br> {<br> LcdCmd(0x40|((lcd_x+loop2)&0x3f)); /* Y Line (0-63), 0x40 to 0x7f */<br> if ((lcd_x+loop2)>63)<br> {<br> if (lcd_color)<br> LcdData2(Hchar_Bit[c][loop1]);<br> else<br> LcdData2(Hchar_Bit[c][loop1]^0xff);<br> }<br> else<br> { <br> if (lcd_color)<br> LcdData1(Hchar_Bit[c][loop1]);<br> else<br> LcdData1(Hchar_Bit[c][loop1]^0xff);<br> }<br> loop2++;<br> }<br><br> lcd_hcolumn++;<br> if (lcd_hcolumn>8)<br> { <br> lcd_column=1;<br> lcd_hrow++;<br> if (lcd_hrow>4)lcd_hcolumn=1;<br> }<br>}<br><br>void LcdStr(char *); /* 显示ASCII码字符串*/<br>void LcdStr(char *c)<br>{ <br> data unsigned char d=0;<br> while (c[d]!=0)<br> {<br> WDT^=1;<br> LcdChar(c[d++]);<br> }<br>}<br><br><br>void Lcd_Ascii(char ); /* 显示ASCII码字符*/<br>void Lcd_Ascii(char c)<br>{ <br> unsigned char loop;<br> unsigned char tempdata;<br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -