{"id":2304,"date":"2019-04-08T13:20:20","date_gmt":"2019-04-08T13:20:20","guid":{"rendered":""},"modified":"2019-04-08T21:20:45","modified_gmt":"2019-04-08T13:20:45","slug":"%e5%8d%95%e7%89%87%e6%9c%ba%e6%95%b0%e6%8e%a7%e7%94%b5%e6%ba%90%e7%9a%84%e8%ae%be%e8%ae%a1","status":"publish","type":"post","link":"http:\/\/www.szryc.com\/?p=2304","title":{"rendered":"\u5355\u7247\u673a\u6570\u63a7\u7535\u6e90\u7684\u8bbe\u8ba1"},"content":{"rendered":"

\n\t\u8fd9\u6b21\u505a\u7684\u6570\u63a7\u7535\u6e90\u8bbe\u8ba1\u601d\u60f3\u6ca1\u4ec0\u4e48\u65b0\u610f\uff0c\u5c31\u662f\u4e00\u4e2a\u6570\u6a21\u8f6c\u6362\uff08ADC<\/u>0809\uff09\u548c\u4e00\u4e2a\u6a21\u6570\u8f6c\u6362\uff08DAC<\/u>0832\uff09\uff0c\u518d\u52a0\u4e0a\u4e24\u4e2a\u5355\u7247\u673a<\/u>\u5206\u522b\u63a7\u52360809\u548c0832\uff0c\u7ec4\u6210\u4e00\u4e2a\u53cd\u9988\u7f51\u7edc\uff0c\u6765\u5f97\u5230\u8f93\u5165\u7684\u6570\u5b57\u76f8\u5bf9\u5e94\u7684\u7535\u538b\uff0c\u7535\u538b\u8303\u56f4\u5f88\u5c0f\uff0c\u53ea\u67090~12.75V.\u663e\u793a\u90e8\u5206\u91c7\u7528\u56db\u6bb5\u5171\u9634\u6570\u7801\u7ba1<\/p>\n

\n\t\u6574\u5757\u677f\u5b50\u505a\u51fa\u6765\u4e4b\u540e\u670910*7cm\u90a3\u4e48\u5927\uff0c\u7528\u6d1e\u6d1e\u677f\u710a\u7684\u3002<\/p>\n

\n\t <\/div>\n

\n\t\u5b9e\u6d4b\u7535\u8def<\/u>\u8f93\u51fa\u7cbe\u5ea6+\/-0.05V\u572812V\u8303\u56f4\u5185\u3002<\/p>\n

\n\t\"\u5355\u7247\u673a\u6570\u63a7\u7535\u6e90\u7684\u8bbe\u8ba1\"<\/p>\n

\n\t\u786c\u4ef6\u8bbe\u8ba1\uff1a<\/p>\n

\n\t\u7b2c\u4e00\u5757\u5355\u7247\u673aP0\u53e3\u63a5\u6570\u7801\u7ba1\u4ee3\u7801\u6bb5\u7684\u9a71\u52a8\uff0cP2.4~P2.7\u63a5\u56db\u4f4d\u7684\u4f4d\u9009\u7ebf\uff0cP2.0~P2.3\u8282\u56db\u4e2a\u72ec\u7acb\u64cd\u4f5c\u6309\u952e\uff3b\u6a21\u5f0f\uff3d\uff3b\u52a0\uff3d\uff3b\u51cf\uff3d\uff3b\u786e\u5b9a\uff3d\uff0cP1\u53e3\u63a5ADC0809\u7684\u516b\u4f4d\u6570\u636e\u8f93\u51fa.P3.0~P3.3\u53e3\u63a50809\u7684\u63a7\u5236\u7ebf.P3.5~P3.7\u548c\u7b2c\u4e8c\u5757\u5355\u7247\u673a\u7684P2.0\uff0cP2.1\uff0cP2.2\u76f8\u8fde\uff0c\u7528\u6765\u63a7\u5236\u6570\u6a21\u8f93\u51fa\u589e\u51cf\u3002\u4e09\u6839\u63a7\u5236\u7ebf\u4f5c\u7528\u5206\u522b\u4e3a\uff3b\u8f93\u51fa\u6539\u53d8\u5141\u8bb8\u63a7\u5236Control_1\uff3d\uff3b\u589e\u51cf\u4fe1\u53f7Control_2\uff3d\uff3b\u589e\u51cf\u901f\u5ea6\u63a7\u5236Control_speed\uff3d<\/p>\n

\n\t\u7b2c\u4e8c\u5757\u5355\u7247\u673a\u9664\u4e86\u524d\u9762\u7684\u4e09\u6839\u63a7\u5236\u7ebf\uff0c\u5c31\u53ea\u5269\u4e0b\u548cDAC0832\u7684\u63a7\u5236\u7ebf\u4e86\uff0c\u770b\u7535\u8def\u56fe\u3002<\/p>\n

\n\t\"\u5355\u7247\u673a\u6570\u63a7\u7535\u6e90\u7684\u8bbe\u8ba1\"<\/p>\n

\n\t\u75280832\u8f93\u51fa\u63a7\u5236LM317\u53ef\u8c03\u4e09\u7aef\u7a33\u538b\u5668\u7684\u8f93\u51fa\u7535\u538b\uff1a<\/p>\n

\n\t<\/p>\n

\n\tDAC0809\u6240\u9700\u65f6\u949f<\/u>\u8109\u51b2\u7531NE555\u4ea7\u751f<\/p>\n

\n\t\"\u5355\u7247\u673a\u6570\u63a7\u7535\u6e90\u7684\u8bbe\u8ba1\"<\/p>\n

\n\t\u7cfb\u7edf\u7535\u6e90\uff1a5V12VGND-12V<\/p>\n

\n\t\"\u5355\u7247\u673a\u6570\u63a7\u7535\u6e90\u7684\u8bbe\u8ba1\"<\/p>\n

\n\t\u7a0b\u5e8f\u6e05\u5355\uff1a\u7b2c\u4e00\u5757\u5355\u7247\u673a\uff1a\uff08\u63a50809\uff0c\u56db\u6bb5\u6570\u7801\u7ba1\uff0c\u56db\u4e2a\u72ec\u7acb\u6309\u952e\uff09<\/p>\n

\n\t#include<\/p>\n

\n\t#defineucharunsignedchar<\/p>\n

\n\tinti<\/u>=0\uff0ca=0;\/\/\u5b9a\u4e49\u5faa\u73af\u7b97\u5b50<\/p>\n

\n\tucharhold=5;\/\/\u5f53\u524d\u64cd\u4f5c\u6570\uff3b0-led1\uff3d\uff3b1-led2\uff3d\uff3b2-led3\uff3d\uff3b3-led4\uff3d\uff3b4-\u5feb\u901f\u8c03\u8282\uff3d\uff3b5-\u65e0\uff3d<\/p>\n

\n\tucharGet_data=0;\/\/\u6a21\u6570\u8f6c\u6362\u5f97\u5230\u7684\u7ed3\u679c<\/p>\n

\n\tintGet_data2=0;\/\/\u5c06Get_data*5\u7528\u4ee5\u65b9\u4fbf\u8f6c\u5316\uff08\u505a\u7535\u538b\u8868\u65f6\u7528\uff09\/\/ucharled\uff3b\uff3d={0x3F\uff0c0x06\uff0c0x5B\uff0c0x4F\uff0c0x66\uff0c0x6D\uff0c0x7D\uff0c0x07\uff0c0x7F\uff0c0x6F\uff0c0x00};\/\/\u9633\u6781\u9a71\u52a8\u4e0d\u5e26\u5c0f\u6570\u70b9<\/p>\n

\n\tucharled\uff3b\uff3d={0xC0\uff0c0xF9\uff0c0xA4\uff0c0xB0\uff0c0x99\uff0c0x92\uff0c0x82\uff0c0xF8\uff0c0x80\uff0c0x90\uff0c0xFF};\/\/\u9634\u6781\u9a71\u52a8<\/p>\n

\n\t\/\/ucharpoint\uff3b\uff3d={0xBF\uff0c0x86\uff0c0xDB\uff0c0xCF\uff0c0xE6\uff0c0xED\uff0c0xFD\uff0c0x87\uff0c0xFF\uff0c0xEF\uff0c0x00};\/\/\u9633\u6781\u9a71\u52a8\u5e26\u5c0f\u6570\u70b9<\/p>\n

\n\tucharpoint\uff3b\uff3d={0x40\uff0c0x79\uff0c0x24\uff0c0x30\uff0c0x19\uff0c0x12\uff0c0x02\uff0c0x78\uff0c0x00\uff0c0x10\uff0c0xFF};<\/p>\n

\n\tucharV_list\uff3b\uff3d={30\uff0c36\uff0c60\uff0c66\uff0c90\uff0c100\uff0c120\uff0c180\uff0c240};\/\/\u7535\u538b\u503c\u5217\u8868<\/p>\n

\n\tucharV_index=6;\/\/\u9884\u7f6e\u7535\u538b\u7d22\u5f15.ucharnum\uff3b4\uff3d={10\uff0c5\uff0c0\uff0c0};\/\/\u663e\u793a\u7f13\u5b58<\/p>\n

\n\tucharV_num=100;\/\/\u663e\u793a\u7684\u7535\u538b\u5bf9\u5e94\u57280~255\u7535\u4e4b\u95f4\u7684\u503c\uff0c\u9884\u7f6e\u538b\u65705V<\/p>\n

\n\tucharTIme=0;\/\/\u63a7\u5236\u6a21\u6570\u8f6c\u6362\u9891\u7387\u53d8\u91cf<\/p>\n

\n\tucharTImes=0;\/\/\u63a7\u5236\u6309\u952e\u5141\u8bb8\u901f\u5ea6\u53d8\u91cf<\/p>\n

\n\tuchars<\/u>can<\/u>_grant=1;\/\/\u5141\u8bb8\u8f93\u5165<\/p>\n

\n\tucharhide_flag=0;\/\/\u9690\u85cf\u6807\u5fd7\uff3b0\u9690\u85cf\uff3d\uff3b1\u663e\u793a\uff3d\u548chold\u914d\u5408\u7528\u4e8e\u63a7\u5236\u67d0\u4e00\u4f4d\u6570\u7801\u7ba1\u7684\u4eae\u706d<\/p>\n

\n\tucharhide_TIme=0;\/\/\u7528\u4e8e\u63a7\u5236\u6570\u7801\u7ba1\u95ea\u70c1\u5feb\u6162<\/p>\n

\n\t\/\/ucharzhengshu\uff0cxiaoshu_1\uff0cxiaoshu_2;voiddelay\uff08ints\uff09;<\/p>\n

\n\tvoidkey_mode\uff08\uff09;<\/p>\n

\n\tvoidkey_add\uff08\uff09;<\/p>\n

\n\tvoidkey_sub\uff08\uff09;<\/p>\n

\n\tvoidkey_confirm\uff08\uff09;<\/p>\n

\n\tvoiddisplay\uff08\uff09;<\/p>\n

\n\tvoidADC\uff08\uff09;<\/p>\n

\n\tvoidconvert\uff08\uff09;\/\/\u5c06get_data\u586b\u5165\u5230num\uff3b\uff3d\u6570\u7ec4\u4e2d<\/p>\n

\n\tvoidscan_key\uff08\uff09;\/\/\u952e\u76d8\u626b\u63cf\u51fd\u6570<\/p>\n

\n\tvoidcompare\uff08\uff09;\/\/\u6bd4\u8f83\u51fd\u6570\uff08Control_1Control_2\uff09\uff3b00-\u6b63\u786e\uff3d\uff3b11-\u52a0\uff3d\uff3b10\u51cf\uff3d\/\/\u5b9a\u4e49\u4f4d\u9009\u7ebf<\/p>\n

\n\tsbitled_1=P2^7;<\/p>\n

\n\tsbitled_2=P2^6;<\/p>\n

\n\tsbitled_3=P2^5;<\/p>\n

\n\tsbitled_4=P2^4;<\/p>\n

\n\tsbitmode=P2^0;<\/p>\n

\n\tsbitadd=P2^1;<\/p>\n

\n\tsbitsub=P2^2;<\/p>\n

\n\tsbitconfirm=P2^3;<\/p>\n

\n\t\/\/0809\u56db\u6839\u63a7\u5236\u7ebf<\/p>\n

\n\tsbitALE=P3^0;<\/p>\n

\n\tsbitSTART=P3^1;<\/p>\n

\n\tsbitOE=P3^2;<\/p>\n

\n\tsbitE<\/u>OC=P3^3;<\/p>\n

\n\t\/\/\u4e24\u6839\u63a7\u5236\u7ebf<\/p>\n

\n\tsbitControl_1=P3^6;\/\/\u53d8\u5316\u63a7\u5236\u7ebf\uff3b1\u53d8\u5316\uff3d\uff3b0\u4e0d\u53d8\uff3d<\/p>\n

\n\tsbitControl_2=P3^7;\/\/\u589e\u51cf\u63a7\u5236\u7ebf\uff3b1\u589e\uff3d\uff3b0\u51cf\uff3d<\/p>\n

\n\tsbitControl_speed=P3^5;\/\/\u63a7\u5236\u53d8\u5316\u901f\u5ea6<\/p>\n

\n\tsbitclose=P3^4;\/\/\u5f53\u7535\u538b\u7a33\u5b9a\u65f6\u4e3a0;voidmai<\/u>n\uff08\uff09<\/p>\n

\n\t{<\/p>\n

\n\t\/\/\u521d\u59cb\u5316<\/p>\n

\n\tled_1=0;<\/p>\n

\n\tled_2=0;<\/p>\n

\n\tled_3=0;<\/p>\n

\n\tled_4=0;<\/p>\n

\n\t\/\/\u521d\u59cb\u5316\u5b9a\u65f6\u5668<\/u><\/p>\n

\n\tTMOD=0x01;\/\/\u5b9a\u65f6\u56680\uff0c\u65b9\u5f0f1<\/p>\n

\n\tTH0=0x3c;<\/p>\n

\n\tTL0=0xb0;<\/p>\n

\n\tET0=1;\/\/\u5141\u8bb8\u5b9a\u65f6\u56680\u4e2d\u65ad<\/p>\n

\n\tTR0=1;\/\/\u542f\u52a8\u5b9a\u65f6\u56680\u8fd0\u884c<\/p>\n

\n\tEA=1;\/\/\u5168\u90e8\u4e2d\u65ad\u5141\u8bb8<\/p>\n

\n\tControl_1=0;<\/p>\n

\n\tControl_2=0;<\/p>\n

\n\twhile\uff081\uff09<\/p>\n

\n\t{<\/p>\n

\n\tTIme++;<\/p>\n

\n\tif\uff08time\u300b=10\uff09<\/p>\n

\n\t{<\/p>\n

\n\ttime=0;<\/p>\n

\n\t\/\/\u626b\u63cf\u952e\u76d8<\/p>\n

\n\tif\uff08hold==5\uff09<\/p>\n

\n\t{<\/p>\n

\n\tADC\uff08\uff09;\/\/\u6a21\u6570\u8f6c\u6362<\/p>\n

\n\tcompare\uff08\uff09;\/\/\u8f6c\u6362\u7ed3\u679c\u6bd4\u8f83\uff0c\u4fee\u6539\u63a7\u5236\u53d8\u91cf<\/p>\n

\n\t}<\/p>\n

\n\telse<\/p>\n

\n\t{<\/p>\n

\n\tControl_1=0;<\/p>\n

\n\tControl_2=0;<\/p>\n

\n\t}<\/p>\n

\n\t}<\/p>\n

\n\tif\uff08scan_grant==0\uff09<\/p>\n

\n\t{<\/p>\n

\n\tscan_key\uff08\uff09;<\/p>\n

\n\tconvert\uff08\uff09;<\/p>\n

\n\tscan_grant=1;<\/p>\n

\n\tEA=1;<\/p>\n

\n\t}<\/p>\n

\n\thide_time++;<\/p>\n

\n\tif\uff08hide_time\u300b=80\uff09<\/p>\n

\n\t{<\/p>\n

\n\thide_time=0;<\/p>\n

\n\tif\uff08hide_flag==1\uff09<\/p>\n

\n\t{hide_flag=0;}<\/p>\n

\n\telse<\/p>\n

\n\t{hide_flag=1;}<\/p>\n

\n\t}<\/p>\n

\n\tdisplay\uff08\uff09;<\/p>\n

\n\t}<\/p>\n

\n\t}<\/p>\n

\n\t\/\/\u5ef6\u65f6\u51fd\u6570<\/p>\n

\n\tvoiddelay\uff08ints\uff09<\/p>\n

\n\t{<\/p>\n

\n\tfor\uff08i=0;i{}<\/p>\n

\n\t}<\/p>\n

\n\t\/\/\u6309\u952e\u5904\u7406------------------------------------<\/p>\n

\n\tvoidkey_mode\uff08\uff09<\/p>\n

\n\t{<\/p>\n

\n\tdelay\uff081000\uff09;<\/p>\n

\n\tif\uff08mode==0\uff09<\/p>\n

\n\t{<\/p>\n

\n\thold++;<\/p>\n

\n\tif\uff08hold\u300b=6\uff09<\/p>\n

\n\t{hold=1;}<\/p>\n

\n\t}<\/p>\n

\n\t}<\/p>\n

\n\tvoidkey_add\uff08\uff09\/\/\u52a0\u51fd\u6570<\/p>\n

\n\t{<\/p>\n

\n\tdelay\uff081000\uff09;<\/p>\n

\n\tif\uff08add==0\uff09<\/p>\n

\n\t{<\/p>\n

\n\tif\uff08hold==0\uff09\/\/\u5f53\u524d\u64cd\u4f5c\u6570\uff3b0-led1\u5373num\uff3b0\uff3d\uff3d<\/p>\n

\n\t{<\/p>\n

\n\t}<\/p>\n

\n\tif\uff08hold==1\uff09\/\/\u5f53\u524d\u64cd\u4f5c\u6570\uff3b1-led2\u5373num\uff3b1\uff3d\uff3d<\/p>\n

\n\t{<\/p>\n

\n\tif\uff08V_num\u300a=235\uff09<\/p>\n

\n\t{V_num=V_num+20;}\/\/\u52a01V<\/p>\n

\n\t}<\/p>\n

\n\tif\uff08hold==2\uff09\/\/\u5f53\u524d\u64cd\u4f5c\u6570\uff3b2-led3\u5373num\uff3b2\uff3d\uff3d<\/p>\n

\n\t{<\/p>\n

\n\tif\uff08V_num\u300a=253\uff09<\/p>\n

\n\t{V_num=V_num+2;}\/\/\u52a00.1V<\/p>\n

\n\t}<\/p>\n

\n\tif\uff08hold==3\uff09\/\/\u5f53\u524d\u64cd\u4f5c\u6570\uff3b3-led4\u5373num\uff3b3\uff3d\uff3d<\/p>\n

\n\t{<\/p>\n

\n\tif\uff08V_num\u300a=254\uff09<\/p>\n

\n\t{V_num++;}\/\/\u52a00.05V<\/p>\n

\n\t}<\/p>\n

\n\tif\uff08hold==4\uff09\/\/\u5f53\u524d\u64cd\u4f5c\u6570\uff3b4-\u5feb\u901f\u8c03\u8282\u5373V_index\uff3d<\/p>\n

\n\t{<\/p>\n

\n\tif\uff08V_index\u300a=7\uff09<\/p>\n

\n\t{V_index++;}<\/p>\n

\n\tV_num=V_list\uff3bV_index\uff3d;<\/p>\n

\n\t}<\/p>\n

\n\tif\uff08hold==5\uff09\/\/\u5f53\u524d\u64cd\u4f5c\u6570\uff3b5-\u65e0\uff3d<\/p>\n

\n\t{<\/p>\n

\n\t}<\/p>\n

\n\t}<\/p>\n

\n\t}<\/p>\n

\n\tvoidkey_sub\uff08\uff09\/\/\u51cf\u51fd\u6570<\/p>\n

\n\t{<\/p>\n

\n\tdelay\uff081000\uff09;<\/p>\n

\n\tif\uff08sub==0\uff09<\/p>\n

\n\t{<\/p>\n

\n\tif\uff08hold==0\uff09\/\/\u5f53\u524d\u64cd\u4f5c\u6570\uff3b0-led1\u5373num\uff3b0\uff3d\uff3d<\/p>\n

\n\t{<\/p>\n

\n\t}<\/p>\n

\n\tif\uff08hold==1\uff09\/\/\u5f53\u524d\u64cd\u4f5c\u6570\uff3b1-led2\u5373num\uff3b1\uff3d\uff3d<\/p>\n

\n\t{<\/p>\n

\n\tif\uff08V_num\u300b=20\uff09<\/p>\n

\n\t{V_num=V_num-20;}\/\/\u51cf1V<\/p>\n

\n\t}<\/p>\n

\n\tif\uff08hold==2\uff09\/\/\u5f53\u524d\u64cd\u4f5c\u6570\uff3b2-led3\u5373num\uff3b2\uff3d\uff3d<\/p>\n

\n\t{<\/p>\n

\n\tif\uff08V_num\u300b=2\uff09<\/p>\n

\n\t{V_num=V_num-2;}\/\/\u51cf0.1V<\/p>\n

\n\t}<\/p>\n

\n\tif\uff08hold==3\uff09\/\/\u5f53\u524d\u64cd\u4f5c\u6570\uff3b3-led4\u5373num\uff3b3\uff3d\uff3d<\/p>\n

\n\t{<\/p>\n

\n\tif\uff08V_num\u300b=1\uff09<\/p>\n

\n\t{V_num--;}\/\/\u51cf0.05V<\/p>\n

\n\t}<\/p>\n

\n\tif\uff08hold==4\uff09\/\/\u5f53\u524d\u64cd\u4f5c\u6570\uff3b4-\u5feb\u901f\u8c03\u8282\u5373V_index\uff3d<\/p>\n

\n\t{<\/p>\n

\n\tif\uff08V_index\u300b=1\uff09<\/p>\n

\n\t{V_index--;}<\/p>\n

\n\tV_num=V_list\uff3bV_index\uff3d;<\/p>\n

\n\t}<\/p>\n

\n\tif\uff08hold==5\uff09\/\/\u5f53\u524d\u64cd\u4f5c\u6570\uff3b5-\u65e0\uff3d<\/p>\n

\n\t{<\/p>\n

\n\t}<\/p>\n

\n\t}<\/p>\n

\n\t}<\/p>\n

\n\tvoidkey_confirm\uff08\uff09<\/p>\n

\n\t{<\/p>\n

\n\tdelay\uff081000\uff09;<\/p>\n

\n\tif\uff08confirm==0\uff09<\/p>\n

\n\t{<\/p>\n

\n\thold=5;<\/p>\n

\n\t}<\/p>\n

\n\t}<\/p>\n

\n\t\/\/-------------------------------------------------------------<\/p>\n

\n\tvoiddisplay\uff08\uff09<\/p>\n

\n\t{<\/p>\n

\n\t\/*led_1=1;<\/p>\n

\n\tif\uff08num\uff3b0\uff3d==0\uff09\/\/\u5982\u679c\u7b2c\u4e00\u4f4d\u662f0\u7684\u8bdd\u5c31\u4e0d\u663e\u793a\uff0cled\uff3b10\uff3d\u662f\u7a7a<\/p>\n

\n\t{P0=led\uff3b10\uff3d;}<\/p>\n

\n\telse<\/p>\n

\n\t{P0=led\uff3bnum\uff3b0\uff3d\uff3d;}delay\uff08100\uff09;<\/p>\n

\n\tled_1=0;<\/p>\n

\n\tP0=0xFF;led_2=1;<\/p>\n

\n\tP0=point\uff3bnum\uff3b1\uff3d\uff3d;<\/p>\n

\n\tdelay\uff08100\uff09;<\/p>\n

\n\tled_2=0;<\/p>\n

\n\tP0=0xFF;led_3=1;<\/p>\n

\n\tP0=led\uff3bnum\uff3b2\uff3d\uff3d;<\/p>\n

\n\tdelay\uff08100\uff09;<\/p>\n

\n\tled_3=0;<\/p>\n

\n\tP0=0xFF;led_4=1;<\/p>\n

\n\tP0=led\uff3bnum\uff3b3\uff3d\uff3d;<\/p>\n

\n\tdelay\uff08100\uff09;<\/p>\n

\n\tled_4=0;<\/p>\n

\n\tP0=0xFF;*\/<\/p>\n

\n\tif\uff08hide_flag==1\uff09<\/p>\n

\n\t{<\/p>\n

\n\tif\uff08hold==4\uff09<\/p>\n

\n\t{<\/p>\n

\n\tdelay\uff08400\uff09;<\/p>\n

\n\treturn;<\/p>\n

\n\t}<\/p>\n

\n\tif\uff08hold\uff01=1\uff09<\/p>\n

\n\t{<\/p>\n

\n\tled_1=1;<\/p>\n

\n\tif\uff08num\uff3b0\uff3d==0\uff09\/\/\u5982\u679c\u7b2c\u4e00\u4f4d\u662f0\u7684\u8bdd\u5c31\u4e0d\u663e\u793a\uff0cled\uff3b10\uff3d\u662f\u7a7a<\/p>\n

\n\t{P0=led\uff3b10\uff3d;}<\/p>\n

\n\telse<\/p>\n

\n\t{P0=led\uff3bnum\uff3b0\uff3d\uff3d;}<\/p>\n

\n\tdelay\uff08100\uff09;<\/p>\n

\n\tled_1=0;<\/p>\n

\n\tP0=0xFF;<\/p>\n

\n\tled_2=1;<\/p>\n

\n\tP0=point\uff3bnum\uff3b1\uff3d\uff3d;<\/p>\n

\n\tdelay\uff08100\uff09;<\/p>\n

\n\tled_2=0;<\/p>\n

\n\tP0=0xFF;<\/p>\n

\n\t}<\/p>\n

\n\tif\uff08hold\uff01=2\uff09<\/p>\n

\n\t{<\/p>\n

\n\tled_3=1;<\/p>\n

\n\tP0=led\uff3bnum\uff3b2\uff3d\uff3d;<\/p>\n

\n\tdelay\uff08100\uff09;<\/p>\n

\n\tled_3=0;<\/p>\n

\n\tP0=0xFF;<\/p>\n

\n\t}<\/p>\n

\n\tif\uff08hold\uff01=3\uff09<\/p>\n

\n\t{<\/p>\n

\n\tled_4=1;<\/p>\n

\n\tP0=led\uff3bnum\uff3b3\uff3d\uff3d;<\/p>\n

\n\tdelay\uff08100\uff09;<\/p>\n

\n\tled_4=0;<\/p>\n

\n\tP0=0xFF;<\/p>\n

\n\t}<\/p>\n

\n\t}if\uff08hide_flag==0\uff09<\/p>\n

\n\t{<\/p>\n

\n\tled_1=1;<\/p>\n

\n\tif\uff08num\uff3b0\uff3d==0\uff09\/\/\u5982\u679c\u7b2c\u4e00\u4f4d\u662f0\u7684\u8bdd\u5c31\u4e0d\u663e\u793a\uff0cled\uff3b10\uff3d\u662f\u7a7a<\/p>\n

\n\t{P0=led\uff3b10\uff3d;}<\/p>\n

\n\telse<\/p>\n

\n\t{P0=led\uff3bnum\uff3b0\uff3d\uff3d;}<\/p>\n

\n\tdelay\uff08100\uff09;<\/p>\n

\n\tled_1=0;<\/p>\n

\n\tP0=0xFF;<\/p>\n

\n\tled_2=1;<\/p>\n

\n\tP0=point\uff3bnum\uff3b1\uff3d\uff3d;<\/p>\n

\n\tdelay\uff08100\uff09;<\/p>\n

\n\tled_2=0;<\/p>\n

\n\tP0=0xFF;<\/p>\n

\n\tled_3=1;<\/p>\n

\n\tP0=led\uff3bnum\uff3b2\uff3d\uff3d;<\/p>\n

\n\tdelay\uff08100\uff09;<\/p>\n

\n\tled_3=0;<\/p>\n

\n\tP0=0xFF;<\/p>\n

\n\tled_4=1;<\/p>\n

\n\tP0=led\uff3bnum\uff3b3\uff3d\uff3d;<\/p>\n

\n\tdelay\uff08100\uff09;<\/p>\n

\n\tled_4=0;<\/p>\n

\n\tP0=0xFF;<\/p>\n

\n\t}<\/p>\n

\n\t}<\/p>\n

\n\tvoidADC\uff08\uff09<\/p>\n

\n\t{<\/p>\n

\n\tSTART=0;<\/p>\n

\n\tOE=0;<\/p>\n

\n\tSTART=1;<\/p>\n

\n\tdelay\uff0865\uff09;<\/p>\n

\n\tSTART=0;<\/p>\n

\n\twhile\uff08EOC==1\uff09<\/p>\n

\n\t{}<\/p>\n

\n\tOE=1;<\/p>\n

\n\tdelay\uff0865\uff09;<\/p>\n

\n\tGet_data=P1;<\/p>\n

\n\tOE=0;<\/p>\n

\n\t\/\/convert\uff08\uff09;<\/p>\n

\n\t}<\/p>\n

\n\tvoidconvert\uff08\uff09<\/p>\n

\n\t{<\/p>\n

\n\t\/\/\u57fa\u51c6\u7535\u538b\u8981\u4e3a12.8V<\/p>\n

\n\t\/*Get_data2=Get_data*5;<\/p>\n

\n\tnum\uff3b0\uff3d=Get_data2\/1000;<\/p>\n

\n\tGet_data2=Get_data2%1000;<\/p>\n

\n\tnum\uff3b1\uff3d=Get_data2\/100;<\/p>\n

\n\tGet_data2=Get_data2%100;<\/p>\n

\n\tnum\uff3b2\uff3d=Get_data2\/10;<\/p>\n

\n\tGet_data2=Get_data2%10;<\/p>\n

\n\tnum\uff3b3\uff3d=Get_data2;*\/<\/p>\n

\n\tGet_data2=V_num*5;<\/p>\n

\n\t\/\/Get_data2=Get_data*5;<\/p>\n

\n\tnum\uff3b0\uff3d=Get_data2\/1000;<\/p>\n

\n\tGet_data2=Get_data2%1000;<\/p>\n

\n\tnum\uff3b1\uff3d=Get_data2\/100;<\/p>\n

\n\tGet_data2=Get_data2%100;<\/p>\n

\n\tnum\uff3b2\uff3d=Get_data2\/10;<\/p>\n

\n\tGet_data2=Get_data2%10;<\/p>\n

\n\tnum\uff3b3\uff3d=Get_data2;<\/p>\n

\n\t}<\/p>\n

\n\tvoidscan_key\uff08\uff09\/\/\u952e\u76d8\u626b\u63cf\u540e\u51fd\u6570\u5206\u914d<\/p>\n

\n\t{<\/p>\n

\n\tif\uff08mode==0\uff09<\/p>\n

\n\tkey_mode\uff08\uff09;<\/p>\n

\n\tif\uff08add==0\uff09<\/p>\n

\n\tkey_add\uff08\uff09;<\/p>\n

\n\tif\uff08sub==0\uff09<\/p>\n

\n\tkey_sub\uff08\uff09;<\/p>\n

\n\tif\uff08confirm==0\uff09<\/p>\n

\n\tkey_confirm\uff08\uff09;<\/p>\n

\n\t}voidcompare\uff08\uff09\/\/\u6bd4\u8f83\u51fd\u6570\uff08Control_1Control_2\uff09\uff3b00-\u6b63\u786e\uff3d\uff3b11-\u52a0\uff3d\uff3b10\u51cf\uff3d<\/p>\n

\n\t{<\/p>\n

\n\tControl_1=0;<\/p>\n

\n\tControl_2=0;if\uff08V_num\u300a\uff08Get_data-1\uff09\uff09<\/p>\n

\n\t{<\/p>\n

\n\tControl_1=1;<\/p>\n

\n\tControl_2=0;<\/p>\n

\n\tif\uff08\uff08Get_data-V_num\uff09\u300b=10\uff09<\/p>\n

\n\t{<\/p>\n

\n\tControl_speed=1;<\/p>\n

\n\tclose=1;<\/p>\n

\n\t}<\/p>\n

\n\telse<\/p>\n

\n\t{<\/p>\n

\n\tControl_speed=0;<\/p>\n

\n\tclose=0;<\/p>\n

\n\t}<\/p>\n

\n\t}<\/p>\n

\n\tif\uff08V_num\u300b\uff08Get_data+1\uff09\uff09<\/p>\n

\n\t{<\/p>\n

\n\tControl_1=1;<\/p>\n

\n\tControl_2=1;<\/p>\n

\n\tif\uff08\uff08V_num-Get_data\uff09\u300b=10\uff09<\/p>\n

\n\t{<\/p>\n

\n\tControl_speed=1;<\/p>\n

\n\tclose=1;<\/p>\n

\n\t}<\/p>\n

\n\telse<\/p>\n

\n\t{<\/p>\n

\n\tControl_speed=0;<\/p>\n

\n\tclose=0;<\/p>\n

\n\t}<\/p>\n

\n\t}<\/p>\n

\n\t}<\/p>\n

\n\t\/\/\u4e2d\u65ad\u51fd\u6570\uff1a<\/p>\n

\n\t\/\/\u5b9a\u65f6\u5668\u4e2d\u65adT0\u7528\u4e8e\u6d88\u9664\u6309\u952e\u7b49\u5f85<\/p>\n

\n\t\/\/\u5b9a\u65f6\u5668\u4e2d\u65adT1\u7528\u4e8e\u8fdb\u5165AD\u8f6c\u6362\u51fd\u6570<\/p>\n

\n\t\/\/--------------------------------------------------------------------<\/p>\n

\n\t\/\/-------------------------\u5b9a\u65f6\u5668\u4e2d\u65ad\u670d\u52a1\u7a0b\u5e8f-------------------------<\/p>\n

\n\t\/\/--------------------------\u5b9a\u65f6\u56680\u5de5\u4f5c\u65b9\u5f0f1--------------------------<\/p>\n

\n\t\/\/\u4efb\u52a1\uff1a<\/p>\n

\n\t\/\/1\uff1a\u9650\u5b9a\u8fdb\u5165\u6309\u952e\u626b\u63cf\u7a0b\u5e8f\u7684\u65f6\u95f4\u95f4\u9694\uff0c\u907f\u514d\u5728\u77ed\u65f6\u95f4\u5185\u591a\u6b21\u8fdb\u5165\u952e\u76d8\u626b\u63cf\u800c\u9020\u6210\u8bef\u64cd\u4f5c<\/p>\n

\n\t\/\/--------------------------------------------------------------------<\/p>\n

\n\tvoidclear_key\uff08\uff09interrupt1using1<\/p>\n

\n\t{<\/p>\n

\n\ttimes=times+1;<\/p>\n

\n\tif\uff08times==7\uff09\/\/\u8fd9\u4e2a\u6570\u5b57\u51b3\u5b9a\u4e86\u6309\u952e\u4e0a\u9650\u901f\u5ea6\u3002<\/p>\n

\n\t{<\/p>\n

\n\ttimes=0;<\/p>\n

\n\tscan_grant=0;\/\/\u5141\u8bb8\u8f93\u5165<\/p>\n

\n\tEA=0;<\/p>\n

\n\t}<\/p>\n

\n\tTH0=0x3c;\/\/\u8ba1\u6570\u5668\u521d\u503c\u91cd\u8f7d<\/p>\n

\n\tTL0=0xb0;<\/p>\n

\n\t}<\/p>\n

\n\t\u7b2c\u4e8c\u5757\u5355\u7247\u673a\uff08\u63a50832\uff09<\/p>\n

\n\t#include<\/p>\n

\n\t#defineucharunsignedchar<\/p>\n

\n\tinti;<\/p>\n

\n\tsbitCS12=P3^0;\/\/\u63a7\u5236\u7ebf<\/p>\n

\n\tsbitWR12=P3^1;\/\/\u63a7\u5236\u7ebf<\/p>\n

\n\tsbitled=P2^2;\/\/\u63a7\u5236led\u4eae\u706d<\/p>\n

\n\tsbitControl_1=P2^1;\/\/\u53d8\u5316\u63a7\u5236\u7ebf1\uff3b1\u53d8\u5316\uff3d\uff3b0\u4e0d\u53d8\uff3d<\/p>\n

\n\tsbitControl_2=P2^0;\/\/\u52a0\u51cf\u63a7\u5236\u7ebf2\uff3b1\u589e\uff3d\uff3b0\u51cf\uff3d<\/p>\n

\n\tsbitControl_speed=P2^3;\/\/\u53d8\u5316\u901f\u5ea6\u63a7\u5236<\/p>\n

\n\tucharout=0;\/\/\u8f93\u51fa\u6570\u636e<\/p>\n

\n\tuchara=0;<\/p>\n

\n\tvoiddelay\uff08ints\uff09;<\/p>\n

\n\tvoidma<\/u>in\uff08\uff09<\/p>\n

\n\t{<\/p>\n

\n\tP1=0;<\/p>\n

\n\tWR12=0;<\/p>\n

\n\tCS12=0;<\/p>\n

\n\tControl_1=1;<\/p>\n

\n\tControl_2=1;<\/p>\n

\n\tControl_speed=1;<\/p>\n

\n\twhile\uff081\uff09<\/p>\n

\n\t{<\/p>\n

\n\tfor\uff08a=0;a\u300a=20;a++\uff09<\/p>\n

\n\t{<\/p>\n

\n\tdelay\uff081000\uff09;<\/p>\n

\n\t}<\/p>\n

\n\t\/\/\u6839\u636e\u63a7\u5236\u4fe1\u53f7\u7ebf\u51b3\u5b9a\u52a0\u51cf\u3002<\/p>\n

\n\tif\uff08Control_1==1\uff09<\/p>\n

\n\t{<\/p>\n

\n\tif\uff08led==0\uff09<\/p>\n

\n\t{led=1;}<\/p>\n

\n\telse<\/p>\n

\n\t{led=0;}<\/p>\n

\n\tif\uff08Control_2==1\uff09<\/p>\n

\n\t{<\/p>\n

\n\tif\uff08out\u300a=254\uff09<\/p>\n

\n\tif\uff08Control_speed==0\uff09<\/p>\n

\n\t{out++;}<\/p>\n

\n\tif\uff08Control_speed==1\uff09<\/p>\n

\n\t{out=out+10;}<\/p>\n

\n\t}<\/p>\n

\n\tif\uff08Control_2==0\uff09<\/p>\n

\n\t{<\/p>\n

\n\tif\uff08out\u300b=1\uff09<\/p>\n

\n\tif\uff08Control_speed==0\uff09<\/p>\n

\n\t{out--;}<\/p>\n

\n\tif\uff08Control_speed==1\uff09<\/p>\n

\n\t{out=out-10;}<\/p>\n

\n\t}<\/p>\n

\n\t\/\/\u5199\u64cd\u4f5c<\/p>\n

\n\tWR12=0;<\/p>\n

\n\tCS12=0;<\/p>\n

\n\tP1=out;<\/p>\n

\n\tdelay\uff08100\uff09;<\/p>\n

\n\tCS12=1;<\/p>\n

\n\tWR12=1;<\/p>\n

\n\t}<\/p>\n

\n\tif\uff08Control_1==0\uff09<\/p>\n

\n\t{<\/p>\n

\n\tled=1;<\/p>\n

\n\t}<\/p>\n

\n\t\/*if\uff08out\u300b=255\uff09<\/p>\n

\n\t{out=255;}<\/p>\n

\n\tif\uff08out\u300a=1\uff09<\/p>\n

\n\t{out=0;}*\/<\/p>\n

\n\t}<\/p>\n

\n\t}<\/p>\n

\n\tvoiddelay\uff08ints\uff09<\/p>\n

\n\t{<\/p>\n

\n\tfor\uff08i=0;i{}<\/p>\n

\n\t}<\/p>\n","protected":false},"excerpt":{"rendered":"

\u8fd9\u6b21\u505a\u7684\u6570\u63a7\u7535\u6e90\u8bbe\u8ba1\u601d\u60f3\u6ca1\u4ec0\u4e48\u65b0\u610f\uff0c\u5c31\u662f\u4e00\u4e2a\u6570\u6a21\u8f6c\u6362\uff08 ADC 0809\uff09\u548c\u4e00\u4e2a\u6a21\u6570\u8f6c\u6362\uff08 DAC 0832\uff09\uff0c\u518d\u52a0\u4e0a\u4e24\u4e2a \u5355\u7247\u673a \u5206\u522b\u63a7\u52360809\u548c0832\uff0c\u7ec4\u6210\u4e00\u4e2a\u53cd\u9988\u7f51\u7edc\uff0c\u6765\u5f97\u5230\u8f93\u5165\u7684\u6570\u5b57\u76f8\u5bf9\u5e94<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[],"_links":{"self":[{"href":"http:\/\/www.szryc.com\/index.php?rest_route=\/wp\/v2\/posts\/2304"}],"collection":[{"href":"http:\/\/www.szryc.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.szryc.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2304"}],"version-history":[{"count":0,"href":"http:\/\/www.szryc.com\/index.php?rest_route=\/wp\/v2\/posts\/2304\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2304"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2304"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2304"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}