{"id":191,"date":"2020-05-24T12:12:51","date_gmt":"2020-05-24T04:12:51","guid":{"rendered":"https:\/\/huiyu1688.top\/?p=191"},"modified":"2021-04-12T20:49:42","modified_gmt":"2021-04-12T12:49:42","slug":"lcd1602%e6%b6%b2%e6%99%b6%e6%a8%a1%e5%9d%97c%e8%af%ad%e8%a8%80%e4%be%8b%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/hy68.top\/index.php\/2020\/05\/24\/191\/","title":{"rendered":"LCD1602\u6db2\u6676\u6a21\u5757C\u8bed\u8a00\u4f8b\u7a0b"},"content":{"rendered":"\n<p>#include&lt;reg52.h&gt;<\/p>\n\n\n\n<p>#include&lt;INTRINS.H&gt;&nbsp;<\/p>\n\n\n\n<p>#define uint unsigned int&nbsp;&nbsp;<\/p>\n\n\n\n<p>#define uchar unsigned char&nbsp;<\/p>\n\n\n\n<p>#define NOKEY&nbsp; 0xff&nbsp;&nbsp;<\/p>\n\n\n\n<p>#define KEY_WOBBLE_TIME 500&nbsp; &nbsp; &nbsp;\/\/\u6309\u952e\u53bb\u6296\u52a8\u65f6\u95f4<\/p>\n\n\n\n<p>#define KEY_OVER_TIME 15000&nbsp; &nbsp; &nbsp;\/\/\u7b49\u5f85\u8fdb\u5165\u8fde\u51fb\u65f6\u95f4(\u5f85\u5b9a)\uff0c\u8be5\u5e38\u6570\u8981\u6bd4\u6b63\u5e38\u6309\u952e\u65f6\u95f4\u8981\u957f\uff0c\u9632\u6b62\u975e\u76ee\u7684\u6027\u8fdb\u5165\u8fde\u51fb\u6a21\u5f0f&nbsp;&nbsp;<\/p>\n\n\n\n<p>#define KEY_QUICK_TIME 1000&nbsp; &nbsp; \/\/\u7b49\u5f85\u6309\u952e\u62ac\u8d77\u7684\u8fde\u51fb\u65f6\u95f4(\u5f85\u5b9a)&nbsp;<\/p>\n\n\n\n<p>\/*****************************************<\/p>\n\n\n\n<p>LCD1602\u6db2\u6676\u63a5\u53e3<\/p>\n\n\n\n<p>P2.0&#8212;&#8212;RS<\/p>\n\n\n\n<p>P2.1&#8212;&#8212;RW<\/p>\n\n\n\n<p>P2.2&#8212;&#8212;EN<\/p>\n\n\n\n<p>P1&#8212;&#8212;DB0\uff5eDB7&nbsp; &nbsp;&nbsp;<\/p>\n\n\n\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n\n\n\n<p>\u6309\u952e\u63a5\u53e3<\/p>\n\n\n\n<p>p2.4&nbsp; \u6309\u952eset<\/p>\n\n\n\n<p>p2.5&nbsp; \u6309\u952eadd<\/p>\n\n\n\n<p>p2.6&nbsp; \u6309\u952enext<\/p>\n\n\n\n<p>p2.7&nbsp; \u6309\u952eesc<\/p>\n\n\n\n<p>*****************************************\/<\/p>\n\n\n\n<p>sbit rs=P2^0;&nbsp; \/\/YM1602C LCD\u7684\u6570\u636e\/\u6307\u4ee4\u9009\u62e9\u63a7\u5236\u7ebf<\/p>\n\n\n\n<p>sbit rw=P2^1;&nbsp; \/\/YM1602C LCD\u7684\u8bfb\u5199\u63a7\u5236\u7ebf<\/p>\n\n\n\n<p>sbit en=P2^2;&nbsp; \/\/YM1602C LCD\u7684\u4f7f\u80fd\u63a7\u5236\u7ebf<\/p>\n\n\n\n<p>sbit keySET=P2^4; \/\/\u6309\u952eset<\/p>\n\n\n\n<p>sbit keyADD=P2^5; \/\/\u6309\u952eadd<\/p>\n\n\n\n<p>sbit keyNEXT=P2^6; \/\/\u6309\u952enext<\/p>\n\n\n\n<p>sbit keyESC=P2^7; \/\/\u6309\u952eesc<\/p>\n\n\n\n<p>sbit buz1=P3^7; \/\/\u97f3\u4e50\u8702\u9e23\u5668\u9ad8\u9891\u63a7\u5236\u53e3<\/p>\n\n\n\n<p>sbit buz2=P3^5; \/\/\u97f3\u4e50\u8702\u9e23\u5668\u4f4e\u9891\u63a7\u5236\u53e3<\/p>\n\n\n\n<p>\/*P1\u53e3\u63a51602\u7684D0~D7\uff0c\u6ce8\u610f\u4e0d\u8981\u63a5\u9519\u4e86\u987a\u5e8f\u3002*\/&nbsp;<\/p>\n\n\n\n<p>\/******\u5b9a\u4e49\u51fd\u6570******\/<\/p>\n\n\n\n<p>void Delay10us(); \/\/\u5ef6\u65f610us\u51fd\u6570<\/p>\n\n\n\n<p>void Delay20us();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/\/\u5ef6\u65f620us\u51fd\u6570<\/p>\n\n\n\n<p>void Delay50us(); &nbsp; &nbsp; \/\/\u5ef6\u65f620us\u51fd\u6570<\/p>\n\n\n\n<p>void delay_1ms(uint z);&nbsp; &nbsp; &nbsp;\/\/\u5ef6\u65f61ms\u51fd\u6570<\/p>\n\n\n\n<p>void delay(uint n);&nbsp;&nbsp; \/\/\u5ef6\u65f6\u51fd\u6570<\/p>\n\n\n\n<p>void lcd_init();&nbsp; &nbsp; \/\/YM1602C LCD\u521d\u59cb\u5316\u51fd\u6570<\/p>\n\n\n\n<p>void lcd_wcom(uchar com);&nbsp;&nbsp; \/\/YM1602C LCD\u5199\u547d\u4ee4\u51fd\u6570&nbsp;<\/p>\n\n\n\n<p>void lcd_wdat(uchar dat);&nbsp;&nbsp; \/\/YM1602C LCD\u5199\u6570\u636e\u51fd\u6570<\/p>\n\n\n\n<p>void v_KeyInit_f();&nbsp;&nbsp; \/\/\u6309\u952e\u521d\u59cb\u5316(\u76f8\u5e94\u7aef\u53e3\u51991)&nbsp;<\/p>\n\n\n\n<p>uchar ReadKey_f(); \/\/\u6309\u952e\u8bfb\u53d6\u626b\u63cf\u51fd\u6570<\/p>\n\n\n\n<p>uchar code table[]=&#8221;YM1602C Check Ok&#8221;;&nbsp; \/\/\u8981\u663e\u793a\u7684\u5185\u5bb91\u653e\u5165\u6570\u7ec4table<\/p>\n\n\n\n<p>uchar code table1[]=&#8221;Ready Go&#8221;;&nbsp;&nbsp; \/\/\u8981\u663e\u793a\u7684\u5185\u5bb92\u653e\u5165\u6570\u7ec4table1&nbsp;<\/p>\n\n\n\n<p>void Delay10us()<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>_nop_();&nbsp;<\/p>\n\n\n\n<p>_nop_();&nbsp;<\/p>\n\n\n\n<p>_nop_();<\/p>\n\n\n\n<p>_nop_();<\/p>\n\n\n\n<p>_nop_();<\/p>\n\n\n\n<p>_nop_();<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>void Delay20us()<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>_nop_();&nbsp;<\/p>\n\n\n\n<p>_nop_();&nbsp;<\/p>\n\n\n\n<p>_nop_();<\/p>\n\n\n\n<p>_nop_();<\/p>\n\n\n\n<p>_nop_();<\/p>\n\n\n\n<p>_nop_();<\/p>\n\n\n\n<p>_nop_();&nbsp;<\/p>\n\n\n\n<p>_nop_();&nbsp;<\/p>\n\n\n\n<p>_nop_();<\/p>\n\n\n\n<p>_nop_();<\/p>\n\n\n\n<p>_nop_();<\/p>\n\n\n\n<p>_nop_();<\/p>\n\n\n\n<p>_nop_();&nbsp;<\/p>\n\n\n\n<p>_nop_();&nbsp;<\/p>\n\n\n\n<p>_nop_();<\/p>\n\n\n\n<p>_nop_();<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>void Delay50us()<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();<\/p>\n\n\n\n<p>_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();<\/p>\n\n\n\n<p>_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();<\/p>\n\n\n\n<p>_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();<\/p>\n\n\n\n<p>_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>void delay_1ms(uint z) &nbsp; &nbsp; \/\/\u5ef6\u65f61ms\u51fd\u6570<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>uint x,y;<\/p>\n\n\n\n<p>for(x=z;z&gt;0;x&#8211;)<\/p>\n\n\n\n<p>for(y=920;y&gt;0;y&#8211;);<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>void delay(uint n)&nbsp; \/\/\u5ef6\u65f6\u51fd\u6570<\/p>\n\n\n\n<p>{&nbsp;<\/p>\n\n\n\n<p>uint x,y;&nbsp;<\/p>\n\n\n\n<p>for(x=n;x&gt;0;x&#8211;)&nbsp;&nbsp;<\/p>\n\n\n\n<p>for(y=110;y&gt;0;y&#8211;);&nbsp;<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>void lcd_init()&nbsp; &nbsp; \/\/YM1602C LCD\u521d\u59cb\u5316\u51fd\u6570<\/p>\n\n\n\n<p>{&nbsp;<\/p>\n\n\n\n<p>lcd_wcom(0x38);&nbsp;&nbsp; \/\/8\u4f4d\u6570\u636e\uff0c\u53cc\u5217\uff0c5*7\u5b57\u5f62<\/p>\n\n\n\n<p>lcd_wcom(0x0c);&nbsp; &nbsp; &nbsp;\/\/\u5f00\u542f\u663e\u793a\u5c4f\uff0c\u5173\u5149\u6807\uff0c\u5149\u6807\u4e0d\u95ea\u70c1<\/p>\n\n\n\n<p>lcd_wcom(0x06);&nbsp;&nbsp; \/\/\u663e\u793a\u5730\u5740\u9012\u589e\uff0c\u5373\u5199\u4e00\u4e2a\u6570\u636e\u540e\uff0c\u663e\u793a\u4f4d\u7f6e\u53f3\u79fb\u4e00\u4f4d<\/p>\n\n\n\n<p>lcd_wcom(0x01);&nbsp;&nbsp; \/\/\u6e05\u5c4f<\/p>\n\n\n\n<p>&nbsp; &nbsp; delay(5);<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>void lcd_wcom(uchar com)&nbsp; \/\/YM1602C LCD\u5199\u547d\u4ee4\u51fd\u6570&nbsp; &nbsp;<\/p>\n\n\n\n<p>{&nbsp;<\/p>\n\n\n\n<p>P1=com;&nbsp;&nbsp; \/\/\u628a\u547d\u4ee4\u5b57\u9001\u5165P1&nbsp;<\/p>\n\n\n\n<p>rs=0;&nbsp;&nbsp; \/\/\u9009\u62e9\u6307\u4ee4\u5bc4\u5b58\u5668<\/p>\n\n\n\n<p>rw=0;&nbsp;&nbsp; \/\/\u9009\u62e9\u5199<\/p>\n\n\n\n<p>delay(5);&nbsp;&nbsp; \/\/\u5ef6\u65f6\u4e00\u5c0f\u4f1a\u513f\uff0c\u8ba91602\u51c6\u5907\u63a5\u6536\u6570\u636e<\/p>\n\n\n\n<p>en=1;&nbsp;&nbsp; \/\/\u4f7f\u80fd\u7ebf\u7535\u5e73\u53d8\u5316\uff0c\u547d\u4ee4\u9001\u51651602\u76848\u4f4d\u6570\u636e\u53e3<\/p>\n\n\n\n<p>en=0;&nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>void lcd_wdat(uchar dat)&nbsp; \/\/YM1602C LCD\u5199\u6570\u636e\u51fd\u6570<\/p>\n\n\n\n<p>{&nbsp;<\/p>\n\n\n\n<p>P1=dat;&nbsp; &nbsp;&nbsp; \/\/\u628a\u8981\u663e\u793a\u7684\u6570\u636e\u9001\u5165P1&nbsp;<\/p>\n\n\n\n<p>rs=1;&nbsp;&nbsp; &nbsp; &nbsp; \/\/\u9009\u62e9\u6570\u636e\u5bc4\u5b58\u5668<\/p>\n\n\n\n<p>rw=0;&nbsp;&nbsp; \/\/\u9009\u62e9\u5199<\/p>\n\n\n\n<p>delay(5);&nbsp;&nbsp; \/\/\u5ef6\u65f6\u4e00\u5c0f\u4f1a\u513f\uff0c\u8ba91602\u51c6\u5907\u63a5\u6536\u6570\u636e<\/p>\n\n\n\n<p>en=1;&nbsp;&nbsp; \/\/\u4f7f\u80fd\u7ebf\u7535\u5e73\u53d8\u5316\uff0c\u6570\u636e\u9001\u51651602\u76848\u4f4d\u6570\u636e\u53e3<\/p>\n\n\n\n<p>en=0;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>void v_KeyInit_f()<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>\/\/\u6309\u952e\u521d\u59cb\u5316(\u76f8\u5e94\u7aef\u53e3\u51991)<\/p>\n\n\n\n<p>keySET=1; \/\/\u6309\u952eset<\/p>\n\n\n\n<p>keyADD=1; &nbsp; &nbsp; \/\/\u6309\u952eadd<\/p>\n\n\n\n<p>keyNEXT=1; &nbsp; &nbsp; \/\/\u6309\u952enext<\/p>\n\n\n\n<p>keyESC=1; \/\/\u6309\u952eesc&nbsp;<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>uchar ReadKey_f()&nbsp; &nbsp; &nbsp;\/\/\u6309\u952e\u8bfb\u53d6\u626b\u63cf\u51fd\u6570<\/p>\n\n\n\n<p>{&nbsp;&nbsp;<\/p>\n\n\n\n<p>static uchar LastKey = NOKEY;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/\u4fdd\u5b58\u4e0a\u4e00\u6b21\u7684\u952e\u503c&nbsp;<\/p>\n\n\n\n<p>static uint KeyCount = 0;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/\u6309\u952e\u5ef6\u65f6\u8ba1\u6570\u5668&nbsp;<\/p>\n\n\n\n<p>static uint KeyOverTime = KEY_OVER_TIME;&nbsp; \/\/\u6309\u952e\u62ac\u8d77\u65f6\u95f4&nbsp;<\/p>\n\n\n\n<p>uchar KeyTemp = NOKEY ;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; \/\/\u4e34\u65f6\u4fdd\u5b58\u8bfb\u5230\u7684\u952e\u503c&nbsp;<\/p>\n\n\n\n<p>KeyTemp = P2 &amp; 0xf0;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/\/\u8bfb\u952e\u503c&nbsp;<\/p>\n\n\n\n<p>if( KeyTemp == 0xf0 )&nbsp;<\/p>\n\n\n\n<p>{&nbsp;&nbsp;<\/p>\n\n\n\n<p>KeyCount = 0;&nbsp; &nbsp;<\/p>\n\n\n\n<p>KeyOverTime = KEY_OVER_TIME;&nbsp; &nbsp;<\/p>\n\n\n\n<p>return NOKEY;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/\/\u65e0\u952e\u6309\u4e0b\u8fd4\u56deNOKEY&nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>else&nbsp;<\/p>\n\n\n\n<p>{&nbsp;&nbsp;<\/p>\n\n\n\n<p>if( KeyTemp == LastKey )&nbsp; &nbsp; \/\/\u662f\u5426\u7b2c\u4e00\u6b21\u6309\u4e0b&nbsp;<\/p>\n\n\n\n<p>{&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<\/p>\n\n\n\n<p>if(++KeyCount == KEY_WOBBLE_TIME )&nbsp; &nbsp; \/\/\u4e0d\u662f\u7b2c\u4e00\u6b21\u6309\u4e0b\uff0c\u5219\u5224\u65ad\u6296\u52a8\u662f\u5426\u7ed3?<\/p>\n\n\n\n<p>{&nbsp;&nbsp;<\/p>\n\n\n\n<p>return KeyTemp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/\/\u53bb\u6296\u52a8\u7ed3\u675f\uff0c\u8fd4\u56de\u952e\u503c&nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>else&nbsp;<\/p>\n\n\n\n<p>{&nbsp;&nbsp;<\/p>\n\n\n\n<p>if( KeyCount &gt; KeyOverTime )&nbsp;<\/p>\n\n\n\n<p>{&nbsp;<\/p>\n\n\n\n<p>KeyCount = 0;&nbsp; &nbsp;<\/p>\n\n\n\n<p>KeyOverTime = KEY_QUICK_TIME;&nbsp;&nbsp;<\/p>\n\n\n\n<p>}&nbsp;&nbsp;<\/p>\n\n\n\n<p>return NOKEY;&nbsp;&nbsp;<\/p>\n\n\n\n<p>}&nbsp;&nbsp;<\/p>\n\n\n\n<p>}&nbsp;&nbsp;<\/p>\n\n\n\n<p>else&nbsp; &nbsp; \/\/\u662f\u7b2c\u4e00\u6b21\u6309\u4e0b\u5219\u4fdd\u5b58\u952e\u503c\uff0c\u4ee5\u4fbf\u4e0b\u6b21\u6267\u884c\u6b64\u51fd\u6570\u65f6\u4e0e\u8bfb\u5230\u7684\u952e\u503c\u4f5c\u6bd4\u8f83&nbsp;<\/p>\n\n\n\n<p>{&nbsp;&nbsp;<\/p>\n\n\n\n<p>LastKey = KeyTemp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/\/\u4fdd\u5b58\u7b2c\u4e00\u6b21\u8bfb\u5230\u7684\u952e\u503c&nbsp;<\/p>\n\n\n\n<p>KeyCount = 0;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/\/\u5ef6\u65f6\u8ba1\u6570\u5668\u6e05\u96f6&nbsp;<\/p>\n\n\n\n<p>KeyOverTime = KEY_OVER_TIME;&nbsp;&nbsp;<\/p>\n\n\n\n<p>return NOKEY;&nbsp;&nbsp;<\/p>\n\n\n\n<p>}&nbsp;&nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>void main()&nbsp;&nbsp;<\/p>\n\n\n\n<p>{&nbsp;&nbsp;<\/p>\n\n\n\n<p>uchar n,m=0;&nbsp;<\/p>\n\n\n\n<p>uchar KeyValue;<\/p>\n\n\n\n<p>lcd_init();&nbsp; &nbsp;&nbsp; \/\/YM1602 LCD\u6db2\u6676\u521d\u59cb\u5316<\/p>\n\n\n\n<p>lcd_wcom(0x80);&nbsp; &nbsp; \/\/\u663e\u793a\u5730\u5740\u8bbe\u4e3a80H\uff08\u537300H\uff0c\uff09\u4e0a\u6392\u7b2c\u4e00\u4f4d<\/p>\n\n\n\n<p>for(m=0;m&lt;16;m++)&nbsp;&nbsp; \/\/\u5c06table[]\u4e2d\u7684\u6570\u636e\u4f9d\u6b21\u5199\u51651602\u663e\u793a<\/p>\n\n\n\n<p>{&nbsp;<\/p>\n\n\n\n<p>lcd_wdat(table[m]);&nbsp;&nbsp;<\/p>\n\n\n\n<p>delay(200);&nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>lcd_wcom(0x80+0x44); \/\/\u91cd\u65b0\u8bbe\u5b9a\u663e\u793a\u5730\u5740\u4e3a0xc4,\u5373\u4e0b\u6392\u7b2c5\u4f4d<\/p>\n\n\n\n<p>for(n=0;n&lt;8;n++)&nbsp;&nbsp; &nbsp;\/\/\u5c06table1[]\u4e2d\u7684\u6570\u636e\u4f9d\u6b21\u5199\u51651602\u663e\u793a<\/p>\n\n\n\n<p>{&nbsp;&nbsp;<\/p>\n\n\n\n<p>lcd_wdat(table1[n]);&nbsp;<\/p>\n\n\n\n<p>&nbsp; &nbsp; delay(200);&nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>&nbsp; &nbsp; v_KeyInit_f();&nbsp;&nbsp; \/\/\u6309\u952e\u626b\u63cf\u521d\u59cb\u5316<\/p>\n\n\n\n<p>&nbsp; &nbsp; while(1)&nbsp;<\/p>\n\n\n\n<p>&nbsp; &nbsp; {&nbsp; &nbsp; &nbsp;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; KeyValue = ReadKey_f();&nbsp;&nbsp;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; if( KeyValue != NOKEY )&nbsp;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp;&nbsp;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if( KeyValue == 0xe0 )<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>\/\/table[]=&#8221;LCD1602 check ok&#8221;;<\/p>\n\n\n\n<p>lcd_wcom(0x80);<\/p>\n\n\n\n<p>for(m=0;m&lt;16;m++)<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>lcd_wdat(&#8216;r&#8217;);<\/p>\n\n\n\n<p>delay(100);<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>for(m=0;m&lt;20;m++)<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>buz1=0;<\/p>\n\n\n\n<p>delay(1);<\/p>\n\n\n\n<p>buz1=1;<\/p>\n\n\n\n<p>delay(10);<\/p>\n\n\n\n<p>buz1=0;<\/p>\n\n\n\n<p>delay(20);<\/p>\n\n\n\n<p>buz1=1;<\/p>\n\n\n\n<p>delay(30);<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if( KeyValue == 0xd0 )<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>lcd_wcom(0x80);<\/p>\n\n\n\n<p>for(m=0;m&lt;16;m++)<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>lcd_wdat(&#8216;t&#8217;);<\/p>\n\n\n\n<p>delay(100);<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>for(m=0;m&lt;20;m++)<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>buz1=0;<\/p>\n\n\n\n<p>delay(8);<\/p>\n\n\n\n<p>buz1=1;<\/p>\n\n\n\n<p>delay(10);<\/p>\n\n\n\n<p>buz1=0;<\/p>\n\n\n\n<p>delay(8);<\/p>\n\n\n\n<p>buz1=1;<\/p>\n\n\n\n<p>delay(10);<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if( KeyValue == 0xb0 )&nbsp;<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>lcd_wcom(0x80);<\/p>\n\n\n\n<p>for(m=0;m&lt;16;m++)<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>lcd_wdat(&#8216;c&#8217;);<\/p>\n\n\n\n<p>delay(100);<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>for(m=0;m&lt;20;m++)<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>buz1=0;<\/p>\n\n\n\n<p>delay(10);<\/p>\n\n\n\n<p>buz1=1;<\/p>\n\n\n\n<p>delay(10);<\/p>\n\n\n\n<p>buz1=0;<\/p>\n\n\n\n<p>delay(10);<\/p>\n\n\n\n<p>buz1=1;<\/p>\n\n\n\n<p>delay(10);<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if( KeyValue == 0x70 )<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>lcd_wcom(0x80);<\/p>\n\n\n\n<p>for(m=0;m&lt;16;m++)<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>lcd_wdat(&#8216;y&#8217;);<\/p>\n\n\n\n<p>delay(100);<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>for(m=0;m&lt;200;m++)<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>buz1=0;<\/p>\n\n\n\n<p>Delay10us();<\/p>\n\n\n\n<p>buz1=1;<\/p>\n\n\n\n<p>Delay20us();<\/p>\n\n\n\n<p>buz1=0;<\/p>\n\n\n\n<p>Delay50us();<\/p>\n\n\n\n<p>buz1=1;<\/p>\n\n\n\n<p>Delay10us();<\/p>\n\n\n\n<p>buz1=0;<\/p>\n\n\n\n<p>Delay10us();<\/p>\n\n\n\n<p>buz1=1;<\/p>\n\n\n\n<p>Delay20us();<\/p>\n\n\n\n<p>buz1=0;<\/p>\n\n\n\n<p>Delay20us();<\/p>\n\n\n\n<p>buz1=1;<\/p>\n\n\n\n<p>Delay10us();<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>}&nbsp; &nbsp;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp;&nbsp;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; else&nbsp;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; {&nbsp;&nbsp;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/\/SHOW_ICON<\/p>\n\n\n\n<p>&nbsp; &nbsp;\/\/lcd_wcom(0x80);<\/p>\n\n\n\n<p>\/\/for(m=0;m&lt;16;m++)<\/p>\n\n\n\n<p>\/\/ {<\/p>\n\n\n\n<p>\/\/ lcd_wdat(&#8216;k&#8217;);<\/p>\n\n\n\n<p>\/\/ delay(100);<\/p>\n\n\n\n<p>\/\/ }&nbsp;<\/p>\n\n\n\n<p>\/\/KeyValue = ReadKey_f();<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/p>\n\n\n\n<p>&nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/p>\n\n\n\n<p>\/\/while(1);&nbsp;&nbsp; &nbsp;\/\/\u52a8\u6001\u505c\u673a<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>#include&lt;reg52.h&gt; #include&lt;INTRINS.H&gt;&nbsp;&hellip;<\/p>\n","protected":false},"author":1,"featured_media":192,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,6],"tags":[37],"_links":{"self":[{"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/posts\/191"}],"collection":[{"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/comments?post=191"}],"version-history":[{"count":1,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/posts\/191\/revisions"}],"predecessor-version":[{"id":193,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/posts\/191\/revisions\/193"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/media\/192"}],"wp:attachment":[{"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/media?parent=191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/categories?post=191"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/tags?post=191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}