{"id":2501,"date":"2019-05-27T08:44:26","date_gmt":"2019-05-27T08:44:26","guid":{"rendered":""},"modified":"2019-05-27T16:44:49","modified_gmt":"2019-05-27T08:44:49","slug":"at89c51%e5%8d%95%e7%89%87%e6%9c%ba%e5%bf%ab%e7%83%ad%e5%bc%8f%e7%83%ad%e6%b0%b4%e5%99%a8%e7%a8%8b%e5%ba%8f%e8%ae%be%e8%ae%a1","status":"publish","type":"post","link":"http:\/\/www.szryc.com\/?p=2501","title":{"rendered":"AT89C51\u5355\u7247\u673a\u5feb\u70ed\u5f0f\u70ed\u6c34\u5668\u7a0b\u5e8f\u8bbe\u8ba1"},"content":{"rendered":"

\n\t\u5feb\u70ed\u5f0f\u70ed\u6c34\u5668\u7a0b\u5e8fMCU<\/u> AT89C51 XAL 12MHz<\/p>\n

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

\n\t <\/div>\n

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

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

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

\n\tvoiddelay\uff08unsignedint\uff09;\/\/\u5ef6\u65f6\u51fd\u6570<\/p>\n

\n\tvoiddisplay\uff08void\uff09;\/\/\u663e\u793a\u51fd\u6570<\/p>\n

\n\tunsignedcharkeysCAN<\/u>\uff08void\uff09;\/\/\u6309\u952e\u626b\u63cf\u5904\u7406\u51fd\u6570<\/p>\n

\n\tvoidheatCTRl\uff08void\uff09;\/\/\u52a0\u70ed\u63a7\u5236\u51fd\u6570<\/p>\n

\n\tvoidt<\/u>empte<\/u>st\uff08void\uff09;\/\/\u6d4b\u6e29\u51fd\u6570<\/p>\n

\n\tsbitswkey=P1^0;\/\/\u5f00\u5173\u952e<\/p>\n

\n\tsbitupkey=P1^1;\/\/\u52a0\u70ed\u6863\u4f4d“+”\u952e<\/p>\n

\n\tsbitdownkey=P1^2;\/\/\u52a0\u70ed\u6863\u4f4d“-”\u952e<\/p>\n

\n\tsbitbuzz=P1^05;\/\/\u8702\u9e23\u5668\u8f93\u51fa\u7aef<\/p>\n

\n\tsbittriac=P1^6;\/\/\u53ef\u63a7\u7845<\/u>\u89e6\u53d1\u4fe1\u53f7\u8f93\u51fa\u7aef<\/p>\n

\n\tsbitrelay=P1^7;\/\/\u7ee7\u7535\u5668<\/u>\u63a7\u5236\u4fe1\u53f7\u8f93\u51fa\u7aef<\/p>\n

\n\tsbitLED1=P2^5;\/\/\u52a0\u70ed\u6863\u4f4d\u6307\u793a\u706f1<\/p>\n

\n\tsbitled2=P2^6;\/\/\u52a0\u70ed\u6863\u4f4d\u6307\u793a\u706f2<\/p>\n

\n\tsbitled3=P2^7;\/\/\u52a0\u70ed\u6863\u4f4d\u6307\u793a\u706f3<\/p>\n

\n\tsignedchardatactemp;\/\/\u5f53\u524d\u6d4b\u5f97\u6c34\u6e29\u5bc4\u5b58\u5668<\/u><\/p>\n

\n\tunsignedchardatadi<\/u>spram<\/u>\uff3b2\uff3d={0x10\uff0c0x10};\/\/\u663e\u793a\u533a\u7f13\u5b58<\/p>\n

\n\tunsignedchardataheatpower\uff0cpx0count;\/\/\u52a0\u70ed\u6863\u4f4d\u5bc4\u5b58\u5668\u3001\u5916\u4e2d\u65ad0\u8ba1\u6570\u5668<\/p>\n

\n\tbittempov\uff0ct0tst\uff0ctestok;\/\/\u8d85\u6e29\u6807\u5fd7\u3001\u6d4b\u6e29\u5f00\u59cb\u6807\u5fd7\u3001\u6d4b\u6e29\u5b8c\u6210\u6807\u5fd7<\/p>\n

\n\t\"AT89C51\u5355\u7247\u673a\u5feb\u70ed\u5f0f\u70ed\u6c34\u5668\u7a0b\u5e8f\u8bbe\u8ba1\"<\/p>\n

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

\n\t\u4e3b\u51fd\u6570voidmai<\/u>n\uff08void\uff09<\/p>\n

\n\t\u65e0\u53c2\u6570\uff0c\u65e0\u8fd4\u56de\u503c<\/p>\n

\n\t\u5faa\u73af\u8c03\u7528\u663e\u793a\u3001\u952e\u626b\u63cf\u3001\u6e29\u5ea6\u68c0\u6d4b\u3001\u52a0\u70ed\u63a7\u5236\u51fd\u6570<\/p>\n

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

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

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

\n\tunsignedchari\uff0cj;<\/p>\n

\n\tctemp=15;\/\/\u521d\u59cb\u5316\u6c34\u6e29\u5bc4\u5b58\u5668<\/p>\n

\n\theatpower=5;\/\/\u521d\u59cb\u5316\u52a0\u70ed\u6863\u4f4d\u4e3a5\u5f53<\/p>\n

\n\ttempov=0;\/\/\u6e05\u9664\u8d85\u6e29\u6807\u5fd7<\/p>\n

\n\tswkey=0;\/\/\u9ed8\u8ba4\u5f00\u5173\u952e\u88ab\u6309\u4e0b\uff0c\u8fdb\u5165\u5f85\u673a\u72b6\u6001<\/p>\n

\n\tTMOD=0x11;\/\/\u8bbe\u5b9aT0\u548cT1\u5de5\u4f5c\u65b9\u5f0f\u4e3a16\u4f4d\u5b9a\u65f6\u5668<\/u><\/p>\n

\n\tTCON=0x05;\/\/\u8bbe\u7f6e\u5916\u4e2d\u65ad0\u548c1\u4e3a\u4e0b\u964d\u6cbf\u89e6\u53d1<\/p>\n

\n\tIP=0x01;\/\/\u8bbe\u7f6e\u5916\u4e2d\u65ad0\u4f18\u5148<\/p>\n

\n\tIE=0x80;\/\/\u6253\u5f00\u603b\u4e2d\u65ad<\/p>\n

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

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

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

\n\tdo{<\/p>\n

\n\tfor\uff08j=0;j\u300a100;j++\uff09\/\/\u5faa\u73af100\u6b21\u7ea60.5s<\/p>\n

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

\n\tif\uff08keyscan\uff08\uff09\uff09i=6;\/\/\u5982\u679c\u6709\u952e\u6309\u4e0b\uff0c\u663e\u793a\u5f53\u524d\u6863\u4f4d3s<\/p>\n

\n\tdisplay\uff08\uff09;\/\/\u8c03\u7528\u663e\u793a\u51fd\u6570\u4e00\u6b21\u7ea64ms<\/p>\n

\n\theatctrl\uff08\uff09;\/\/\u8c03\u7528\u52a0\u70ed\u63a7\u5236\u51fd\u6570<\/p>\n

\n\t}\/\/endfor\uff08b=0;b\u300a100;b++\uff09<\/p>\n

\n\ttemptest\uff08\uff09;\/\/\u6bcf0.5s\u8fdb\u884c\u4e00\u6b21\u6d4b\u6e29<\/p>\n

\n\t}while\uff08--i\uff09;\/\/\u901a\u8fc7\u6539\u53d8\u5faa\u73af\u6b21\u6570i\u7684\u5927\u5c0f\u51b3\u5b9a\u662f\u5426\u5237\u65b0\u663e\u793a<\/p>\n

\n\tj=abs\uff08ctemp\uff09;\/\/\u53d6\u6e29\u5ea6\u7edd\u5bf9\u503c<\/p>\n

\n\tdispram\uff3b1\uff3d=j%10;\/\/\u53d6\u4e2a\u4f4d\u6570\u9001\u663e\u793a<\/p>\n

\n\tj\/=10;\/\/\u53d6\u5341\u4f4d\u6570<\/p>\n

\n\tdispram\uff3b0\uff3d=j\uff1fj:0x11;\/\/\u9001\u663e\u793a\uff08\u5e26\u706d\u96f6\uff09<\/p>\n

\n\t}\/\/endwhile\uff081\uff09<\/p>\n

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

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

\n\t\u5ef6\u65f6\u51fd\u6570voiddelay\uff08unsignedintdt\uff09<\/p>\n

\n\t\u53c2\u6570\uff1adt\uff0c\u65e0\u8fd4\u56de\u503c<\/p>\n

\n\t\u5ef6\u65f6\u65f6\u95f4=dt*500\u673a\u5668\u5468\u671f<\/p>\n

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

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

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

\n\tregisterunsignedcharbt;\/\/\u5b9a\u4e49\u5bc4\u5b58\u5668\u53d8\u91cf<\/p>\n

\n\tfor\uff08;dt;dt--\uff09<\/p>\n

\n\tfor\uff08bt=250;--bt;\uff09;\/\/\u6b64\u53e5\u7f16\u8bd1\u65f6\u4ee5“DJNZ”\u5b9e\u73b0\uff0c250*2=500\u673a\u5668\u5468\u671f<\/p>\n

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

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

\n\t\u663e\u793a\u51fd\u6570voiddisplay\uff08void\uff09<\/p>\n

\n\t\u65e0\u53c2\u6570\uff0c\u65e0\u8fd4\u56de\u503c<\/p>\n

\n\t\u4e24\u4f4d\u5171\u9633\u6570\u7801\u7ba1\u626b\u63cf\u663e\u793a<\/p>\n

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

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

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

\n\tunsignedcharcodetable\uff3b\uff3d={0xc0\uff0c0xf9\uff0c0xa4\uff0c0xb0\uff0c0x99\uff0c0x92\uff0c0x82\uff0c0xf8\uff0c0x80\uff0c0x90\uff0c<\/p>\n

\n\t0x88\uff0c0x83\uff0c0xc6\uff0c0xa1\uff0c0x86\uff0c0x8e\uff0c0xbf\uff0c0xff};<\/p>\n

\n\tunsignedchari\uff0ca;<\/p>\n

\n\ta=0xfe;\/\/\u4f4d\u9009\u8d4b\u521d\u503c<\/p>\n

\n\tfor\uff08i=0;i\u300a2;i++\uff09\/\/\u5faa\u73af\u626b\u63cf\u4e24\u4f4d\u6570\u7801\u7ba1<\/p>\n

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

\n\tP2|=0x1f;\/\/\u6e05\u9664\u4f4d\u9009<\/p>\n

\n\tP0=table\uff3bdispram\uff3bi\uff3d\uff3d;\/\/\u9001\u663e\u793a\u6bb5\u7801<\/p>\n

\n\tP2&=a;\/\/\u9009\u901a\u4e00\u4f4d<\/p>\n

\n\tdelay\uff084\uff09;\/\/\u5ef6\u65f62ms<\/p>\n

\n\ta=_crol_\uff08a\uff0c1\uff09;\/\/\u6539\u53d8\u4f4d\u9009\u5b57<\/p>\n

\n\tP0=0xff;\/\/\u6d88\u5f71<\/p>\n

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

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

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

\n\t\u6309\u952e\u626b\u63cf\u5904\u7406\u51fd\u6570unsignedcharkeyscan\uff08void\uff09<\/p>\n

\n\t\u65e0\u53c2\u6570\uff0c\u8fd4\u56de\u503c\uff1a\u65e0\u7b26\u53f7\u5b57\u7b26<\/u>\u578b\uff0c\u65e0\u952e\u6309\u4e0b\u4e3a0\uff0c\u6709\u952e\u6309\u4e0b\u4e3a\u5176\u5b83<\/p>\n

\n\t\u5f71\u54cd\u5168\u5c40\u53d8\u91cf\uff1aheatpower<\/p>\n

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

\n\tunsignedcharkeyscan\uff08void\uff09<\/p>\n

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

\n\tunsignedchari\uff0cch;<\/p>\n

\n\tif\uff08upkey==0\uff09\/\/“+”\u952e<\/p>\n

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

\n\tbuzz=0;\/\/\u6253\u5f00\u8702\u9e23\u5668\uff08\u53d1\u51fa\u6309\u952e\u97f3\uff09<\/p>\n

\n\tfor\uff08i=0;i\u300a5;i++\uff09display\uff08\uff09;\/\/\u5ef6\u65f6\u6d88\u6296<\/p>\n

\n\tbuzz=1;\/\/\u5173\u95ed\u8702\u9e23\u5668<\/p>\n

\n\tif\uff08heatpower\u300a9\uff09heatpower++;\/\/\u6863\u4f4d\u52a0\u4e00<\/p>\n

\n\tdispram\uff3b0\uff3d=0;<\/p>\n

\n\tdispram\uff3b1\uff3d=heatpower;\/\/\u663e\u793a\u5f53\u524d\u6863\u4f4d<\/p>\n

\n\twhile\uff08upkey==0\uff09display\uff08\uff09;\/\/\u7b49\u5f85\u952e\u91ca\u653e<\/p>\n

\n\treturn\uff081\uff09;\/\/\u8fd4\u56de\u6709\u952e\u6309\u4e0b<\/p>\n

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

\n\telseif\uff08downkey==0\uff09\/\/“-”\u952e<\/p>\n

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

\n\tbuzz=0;\/\/\u6253\u5f00\u8702\u9e23\u5668\uff08\u53d1\u51fa\u6309\u952e\u97f3\uff09<\/p>\n

\n\tfor\uff08i=0;i\u300a5;i++\uff09display\uff08\uff09;\/\/\u5ef6\u65f6\u6d88\u6296<\/p>\n

\n\tbuzz=1;\/\/\u5173\u95ed\u8702\u9e23\u5668<\/p>\n

\n\tif\uff08heatpower\u300b0\uff09heatpower--;\/\/\u6863\u4f4d\u51cf\u4e00<\/p>\n

\n\tdispram\uff3b0\uff3d=0;<\/p>\n

\n\tdispram\uff3b1\uff3d=heatpower;\/\/\u663e\u793a\u5f53\u524d\u6863\u4f4d<\/p>\n

\n\twhile\uff08downkey==0\uff09display\uff08\uff09;\/\/\u7b49\u5f85\u952e\u91ca\u653e<\/p>\n

\n\treturn\uff082\uff09;\/\/\u8fd4\u56de\u6709\u952e\u6309\u4e0b<\/p>\n

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

\n\telseif\uff08swkey==0\uff09\/\/\u5f00\u5173\u952e<\/p>\n

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

\n\tbuzz=0;\/\/\u6253\u5f00\u8702\u9e23\u5668\uff08\u53d1\u51fa\u6309\u952e\u97f3\uff09<\/p>\n

\n\tfor\uff08i=0;i\u300a30;i++\uff09display\uff08\uff09;\/\/\u5ef6\u65f6\u6d88\u6296<\/p>\n

\n\tbuzz=1;\/\/\u5173\u95ed\u8702\u9e23\u5668<\/p>\n

\n\tswkey=1;\/\/\u7f6e\u4f4d\u5f00\u5173\u952e<\/p>\n

\n\twhile\uff08swkey==0\uff09display\uff08\uff09;\/\/\u7b49\u5f85\u952e\u91ca\u653e<\/p>\n

\n\tch=IE;\/\/\u6682\u5b58\u4e2d\u65ad\u63a7\u5236\u5b57IE<\/p>\n

\n\tIE=0x00;\/\/\u7981\u6b62\u4e2d\u65ad<\/p>\n

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

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

\n\tP2=0xff;\/\/\u6e05\u9664\u7aef\u53e3\u8f93\u51fa<\/p>\n

\n\tdispram\uff3b0\uff3d=0x10;<\/p>\n

\n\tdispram\uff3b1\uff3d=0x10;\/\/\u663e\u793a“--”<\/p>\n

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

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

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

\n\twhile\uff08swkey\uff09display\uff08\uff09;\/\/\u7b49\u5f85\u5f00\u5173\u952e\u6309\u4e0b<\/p>\n

\n\tbuzz=0;\/\/\u6253\u5f00\u8702\u9e23\u5668\uff08\u53d1\u51fa\u6309\u952e\u97f3\uff09<\/p>\n

\n\tfor\uff08i=0;i\u300a10;i++\uff09display\uff08\uff09;\/\/\u5ef6\u65f6\u6d88\u6296<\/p>\n

\n\tbuzz=1;\/\/\u5173\u95ed\u8702\u9e23\u5668<\/p>\n

\n\tif\uff08swkey==0\uff09break;\/\/\u786e\u8ba4\u5f00\u5173\u952e\u88ab\u6309\u4e0b<\/p>\n

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

\n\twhile\uff08swkey==0\uff09display\uff08\uff09;\/\/\u7b49\u5f85\u952e\u91ca\u653e<\/p>\n

\n\tIE=ch;\/\/\u8fd8\u539f\u4e2d\u65ad\u63a7\u5236\u5b57IE<\/p>\n

\n\treturn\uff080\uff09;\/\/\u8fd4\u56de\u65e0\u952e\u6309\u4e0b<\/p>\n

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

\n\telsereturn\uff080\uff09;\/\/\u65e0\u4efb\u4f55\u952e\u6309\u4e0b\u65f6\u7531\u6b64\u8fd4\u56de<\/p>\n

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

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

\n\t\u52a0\u70ed\u63a7\u5236\u51fd\u6570voidheatctrl\uff08void\uff09<\/p>\n

\n\t\u65e0\u53c2\u6570\uff0c\u65e0\u8fd4\u56de\u503c<\/p>\n

\n\t\u5224\u65ad\u662f\u5426\u52a0\u70ed\u3001\u52a0\u70ed\u529f\u7387\u53ca\u6863\u4f4d\u6307\u793a\u706f\u5904\u7406<\/p>\n

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

\n\tvoidheatctrl\uff08void\uff09<\/p>\n

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

\n\tif\uff08\uff01tempov\uff09\/\/\u5f53\u6ca1\u6709\u8d85\u6e29\u6807\u5fd7\u65f6<\/p>\n

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

\n\trelay=0;\/\/\u63a5\u901a\u7ee7\u7535\u5668<\/p>\n

\n\tbuzz=1;\/\/\u5173\u95ed\u8702\u9e23\u5668<\/p>\n

\n\tswitch\uff08heatpower\uff09\/\/\u5224\u65ad\u52a0\u70ed\u6863\u4f4d<\/p>\n

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

\n\tcase0\uff1a{EX1=0;ET1=0;triac=1;led1=1;led2=1;led3=1;break;}\/\/0\u6863\u4e0d\u52a0\u70ed\uff0c\u6307\u793a\u706f\u4e0d\u4eae<\/p>\n

\n\tcase1\uff1a<\/p>\n

\n\tcase2\uff1a<\/p>\n

\n\tcase3\uff1a<\/p>\n

\n\tcase4\uff1a{led1=0;led2=1;led3=1;EX1=1;break;}\/\/1~4\u68631\u53f7\u6307\u793a\u7b49\u4eae<\/p>\n

\n\tcase5\uff1a<\/p>\n

\n\tcase6\uff1a<\/p>\n

\n\tcase7\uff1a<\/p>\n

\n\tcase8\uff1a{led1=0;led2=0;led3=1;EX1=1;break;}\/\/5~8\u68631\u53f7\u30012\u53f7\u6307\u793a\u706f\u4eae<\/p>\n

\n\tcase9\uff1a{EX1=0;ET1=0;led1=0;led2=0;led3=0;triac=0;break;}\/\/9\u6863\u5168\u529f\u7387\uff0c\u6307\u793a\u706f\u5168\u4eae<\/p>\n

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

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

\n\telse\/\/\u5f53\u6709\u8d85\u6e29\u6807\u5fd7\u65f6<\/p>\n

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

\n\trelay=1;\/\/\u65ad\u5f00\u7ee7\u7535\u5668<\/p>\n

\n\tEX1=0;ET1=0;triac=1;\/\/\u5173\u95ed\u53ef\u63a7\u7845<\/p>\n

\n\tbuzz=0;\/\/\u8702\u9e23\u62a5\u8b66<\/p>\n

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

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

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

\n\t\u6d4b\u6e29\u51fd\u6570voidtemptest\uff08void\uff09<\/p>\n

\n\t\u65e0\u53c2\u6570\uff0c\u65e0\u8fd4\u56de\u503c\uff0c<\/p>\n

\n\t\u5f71\u54cd\u5168\u5c40\u53d8\u91cf\uff1actemp\uff0ctempov<\/p>\n

\n\t\u6d4b\u91cf\u5e76\u67e5\u8868\u8ba1\u7b97\u6e29\u5ea6\uff0c\u5224\u65ad\u662f\u5426\u8d85\u6e29<\/p>\n

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

\n\tvoidtemptest\uff08void\uff09<\/p>\n

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

\n\tsignedchartemp\uff0ctempmi<\/u>n\uff0ctempmax;<\/p>\n

\n\tunsignedintt0rig;<\/p>\n

\n\tunsignedintcodetemptab\uff3b\uff3d={0x6262\uff0c0x61eb\uff0c0x6171\uff0c0x60f7\uff0c0x6047\uff0c0x5ff7\uff0c0x5f6e\uff0c0x5eef\uff0c0x5e53\uff0c0x5dbe\uff0c0x5d4b\uff0c0x5ca5\uff0c0x5c17\uff0c<\/p>\n

\n\t0x5b6b\uff0c0x5ada\uff0c0x5a5c\uff0c0x599b\uff0c0x58ff\uff0c0x5869\uff0c0x57b0\uff0c0x570d\uff0c0x5663\uff0c0x55c6\uff0c0x550e\uff0c0x5444\uff0c0x5396\uff0c<\/p>\n

\n\t0x52dd\uff0c0x5240\uff0c0x5189\uff0c0x50b0\uff0c0x5005\uff0c0x4f20\uff0c0x4e69\uff0c0x4db1\uff0c0x4cef\uff0c0x4c42\uff0c0x4b64\uff0c0x4aaa\uff0c0x49e1\uff0c<\/p>\n

\n\t0x48fc\uff0c0x4847\uff0c0x476c\uff0c0x46b1\uff0c0x4604\uff0c0x4503\uff0c0x4449\uff0c0x4356\uff0c0x4299\uff0c0x41c0\uff0c0x40ce\uff0c0x3ff0\uff0c0x3f2b\uff0c<\/p>\n

\n\t0x3e33\uff0c0x3d86\uff0c0x3ca6\uff0c0x3bd2\uff0c0x3b26\uff0c0x3a39\uff0c0x3973\uff0c0x38a6\uff0c0x37ef\uff0c0x373f\uff0c0x3687\uff0c0x35c3\uff0c0x3507\uff0c<\/p>\n

\n\t0x3487\uff0c0x33bc\uff0c0x32ed\uff0c0x324f\uff0c0x319e\uff0c0x3106\uff0c0x3053\uff0c0x2fa6\uff0c0x2f2a\uff0c0x2e88\uff0c0x2e00\uff0c0x2d63\uff0c0x2cd6\uff0c<\/p>\n

\n\t0x2c65\uff0c0x2bae\uff0c0x2b28\uff0c0x2a97\uff0c0x2a07\uff0c0x298e\uff0c0x2914\uff0c0x287a\uff0c0x280d\uff0c0x278a\uff0c0x2703\uff0c0x2687\uff0c0x2626\uff0c<\/p>\n

\n\t0x25e5\uff0c0x256d\uff0c0x24ee\uff0c0x2489\uff0c0x2414\uff0c0x23bc\uff0c0x2356\uff0c0x22d9\uff0c0x2278\uff0c0x2203};\/\/\u6e29\u5ea6\u9891\u7387\u8868<\/p>\n

\n\tpx0count=2;\/\/\u6d4b\u9891\u4e2d\u65ad\u51fd\u6570\u53c2\u6570<\/p>\n

\n\tt0tst=1;\/\/\u7f6e\u6d4b\u9891\u7a0b\u5e8f\u5f00\u59cb\u6807\u5fd7<\/p>\n

\n\tEX0=1;\/\/\u6253\u5f00\u6d4b\u9891\u5916\u4e2d\u65ad<\/p>\n

\n\ttestok=0;\/\/\u6e05\u9664\u6d4b\u9891\u7a0b\u5e8f\u5b8c\u6210\u6807\u5fd7<\/p>\n

\n\twhile\uff08\uff01testok\uff09display\uff08\uff09;\/\/\u7b49\u5f85\u6d4b\u8bd5<\/u>\u5b8c\u6210<\/p>\n

\n\tt0rig=\uff08unsignedint\uff09TH0\u300a\u300a8|TL0;\/\/\u5b57\u8282\u5408\u6210\u5b57<\/p>\n

\n\ttempmin=0;\/\/\u4ee5\u4e0b\u662f\u4e8c\u5206\u67e5\u8868\u6cd5\u8ba1\u7b97\u6e29\u5ea6\u503c<\/p>\n

\n\ttempmax=100;\/\/tempmin\u548ctempmax\u4e3a\u6e29\u5ea6\u8868\u7684\u8303\u56f4<\/p>\n

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

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

\n\ttemp=\uff08tempmax+tempmin\uff09\/2;\/\/\u5047\u5b9a\u5f53\u524d\u6e29\u5ea6\u4e3a\u6700\u5927\u503c\u4e0e\u6700\u5c0f\u503c\u4e4b\u4e2d\u70b9\u503c<\/p>\n

\n\tif\uff08t0rig==temptab\uff3btemp\uff3d\uff09break;\/\/\u82e5\u5b9e\u9645\u503c\u7b49\u4e8e\u5047\u5b9a\u503c\u7ed3\u675f\u67e5\u627e<\/p>\n

\n\telseif\uff08t0rig\u300btemptab\uff3btemp\uff3d\uff09tempmax=temp;\/\/\u82e5\u5b9e\u9645\u503c\u5927\u4e8e\u5047\u5b9a\u503c\uff0c\u51cf\u5c0f\u67e5\u627e\u8303\u56f4\u7684\u6700\u5927\u503c<\/p>\n

\n\telsetempmin=temp;\/\/\u82e5\u5b9e\u9645\u503c\u5c0f\u4e8e\u5047\u5b9a\u503c\uff0c\u589e\u5927\u67e5\u627e\u8303\u56f4\u7684\u6700\u5c0f\u503c<\/p>\n

\n\tif\uff08tempmax-tempmin\u300a=1\uff09\/\/\u82e5\u67e5\u627e\u8303\u56f4\u5df2\u7f29\u5c0f\u52301\u5ea6\u4e4b\u95f4\uff0c<\/p>\n

\n\t{\/\/\u5224\u65ad\u5b9e\u9645\u503c\u66f4\u63a5\u8fd1\u54ea\u4e2a\u7aef\u70b9<\/p>\n

\n\tif\uff08temptab\uff3btempmax\uff3d+temptab\uff3btempmin\uff3d\u300b2*t0rig\uff09temp=tempmax;\/\/\u63a5\u8fd1\u6700\u5927\u503c\u53d6\u6700\u5927\u503c<\/p>\n

\n\telsetemp=tempmin;\/\/\u63a5\u8fd1\u6700\u5c0f\u503c\u53d6\u6700\u5c0f\u503c<\/p>\n

\n\tbreak;\/\/\u7ed3\u675f\u67e5\u627e<\/p>\n

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

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

\n\tctemp=temp;\/\/\u5237\u65b0\u5f53\u524d\u6e29\u5ea6\u5bc4\u5b58\u5668<\/p>\n

\n\tif\uff08temp\u300b65\uff09tempov=1;\/\/\u5982\u679c\u6e29\u5ea6\u8d85\u8fc765\u5ea6\u7f6e\u4f4d\u8d85\u6e29\u6807\u5fd7<\/p>\n

\n\telseif\uff08temp\u300a45\uff09tempov=0;\/\/\u5f53\u6e29\u5ea6\u56de\u843d\u523045\u5ea6\u4ee5\u4e0b\u65f6\u6e05\u9664\u8d85\u6e29\u6807\u5fd7<\/p>\n

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

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

\n\t\u6d4b\u6e29\u9891\u7387\u6d4b\u8bd5\u51fd\u6570voidtempFrequency\uff08void\uff09<\/p>\n

\n\t\u4f7f\u7528\u5916\u90e8X0\u4e2d\u65ad\uff0c\u5bc4\u5b58\u5668\u7ec41<\/p>\n

\n\t\u6d4b\u51fa\u6e29\u5ea6——\u9891\u7387\u8f6c\u6362\u7535\u8def<\/u>\u7684\u9891\u7387<\/p>\n

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

\n\tvoidtempfrequency\uff08void\uff09interrupt0using1<\/p>\n

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

\n\tif\uff08--px0count\uff09return;\/\/\u627e\u9f50\u8d77\u70b9\u6216\u8ba1\u6570<\/p>\n

\n\tif\uff08t0tst\uff09\/\/\u5982\u679c\u662f\u8d77\u70b9<\/p>\n

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

\n\tt0tst=0;\/\/\u6e05\u9664\u6d4b\u9891\u5f00\u59cb\u6807\u5fd7<\/p>\n

\n\tpx0count=100;\/\/\u53d6100\u4e2a\u65b9\u6ce2\u4e3a\u4e00\u6b21\u6d4b\u9891<\/p>\n

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

\n\tTL0=0;\/\/\u6e05\u9664\u8ba1\u65f6\u5668T0<\/p>\n

\n\tTR0=1;\/\/\u5f00\u59cb\u8ba1\u65f6<\/p>\n

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

\n\telse\/\/\u5982\u679c\u662f\u7ec8\u70b9<\/p>\n

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

\n\tTR0=0;\/\/\u505c\u6b62\u8ba1\u65f6<\/p>\n

\n\tEX0=0;\/\/\u505c\u6b62\u6d4b\u9891\u5916\u4e2d\u65ad<\/p>\n

\n\ttestok=1;\/\/\u7f6e\u4f4d\u6d4b\u9891\u5b8c\u6210\u6807\u5fd7<\/p>\n

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

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

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

\n\t\u52a0\u70ed\u63a7\u5236\u8fc7\u3007\u68c0\u6d4b\u51fd\u6570voidpass0\uff08void\uff09<\/p>\n

\n\t\u4f7f\u7528\u5916\u90e8X1\u4e2d\u65ad\uff0c\u5bc4\u5b58\u5668\u7ec42<\/p>\n

\n\t\u68c0\u6d4b\u8fc7\u3007\u70b9\uff0c\u7ed9\u5b9a\u65f6\u5668T1\u8d4b\u521d\u503c<\/p>\n

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

\n\tvoidpass0\uff08void\uff09interrupt2using2<\/p>\n

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

\n\tunsignedcharcodepowertab\uff3b\uff3d={0xd8\uff0c0xf0\uff0c0xe2\uff0c0x63\uff0c0xe5\uff0c0x25\uff0c0xe8\uff0c0x3e\uff0c0xeb\uff0c0x16\uff0c0xed\uff0c0xda\uff0c0xf0\uff0c0xb2\uff0c0xf3\uff0c0xcb\uff0c0xf7\uff0c0x8d\uff0c0xf7\uff0c0x8d};\/\/10\u4e2a\u529f\u7387\u6863\u4f4d\u7684\u53ef\u63a7\u7845\u5bfc\u901a\u89d2\u5ef6\u65f6\u53c2\u6570\u8868<\/p>\n

\n\tTH1=powertab\uff3b2*heatpower\uff3d-1;<\/p>\n

\n\tTL1=powertab\uff3b2*heatpower+1\uff3d;\/\/\u5e02\u7535\u8fc7\u96f6\u540e\uff0c\u6839\u636e\u5f53\u524d\u8bbe\u7f6e\u7684\u6863\u4f4d\u7ed9\u5b9a\u65f6\u5668T1\u8d4b\u5ef6\u65f6\u53c2\u6570<\/p>\n

\n\tET1=1;\/\/\u5141\u8bb8\u5b9a\u65f6\u5668T1\u4e2d\u65ad<\/p>\n

\n\tTR1=1;\/\/\u6253\u5f00\u5b9a\u65f6\u5668T1<\/p>\n

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

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

\n\t\u53ef\u63a7\u7845\u89e6\u53d1\u4fe1\u53f7\u63a7\u5236\u51fd\u6570voidtriaCCtrl\uff08void\uff09<\/p>\n

\n\t\u4f7f\u7528\u5b9a\u65f6\u5668T1\u4e2d\u65ad\uff0c\u5bc4\u5b58\u5668\u7ec43<\/p>\n

\n\t\u5411\u53ef\u63a7\u7845\u9001\u51fa\u89e6\u53d1\u4fe1\u53f7<\/p>\n

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

\n\tvoidtriacctrl\uff08void\uff09interrupt3using3<\/p>\n

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

\n\tregisterunsignedchari;<\/p>\n

\n\ttriac=0;\/\/\u8f93\u51fa\u53ef\u63a7\u7845\u5bfc\u901a\u4fe1\u53f7<\/p>\n

\n\tET1=0;\/\/\u5173\u95ed\u5b9a\u65f6\u5668T1\u4e2d\u65ad<\/p>\n

\n\tTR1=0;\/\/\u7ec8\u6b62\u5b9a\u65f6\u5668\u8fd0\u884c<\/p>\n

\n\tfor\uff08i=0;i\u300a2;i++\uff09;\/\/\u5ef6\u65f6\uff0c\u4fdd\u8bc1\u5bfc\u901a\u4fe1\u53f7\u6709\u8db3\u591f\u7684\u5bbd\u5ea6<\/p>\n

\n\ttriac=1;\/\/\u5b8c\u6210\u53ef\u63a7\u7845\u5bfc\u901a\u4fe1\u53f7<\/p>\n

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

\u5feb\u70ed\u5f0f\u70ed\u6c34\u5668\u7a0b\u5e8f MCU AT89C51 XAL 12MHz \/\/#pragmaSRC #include #include #include voiddelay\uff08unsignedint\uff09;\/\/\u5ef6\u65f6\u51fd\u6570 voiddisplay\uff08void\uff09;\/\/\u663e\u793a\u51fd\u6570 unsignedcharkeys CAN \uff08void\uff09;\/\/\u6309\u952e\u626b\u63cf\u5904\u7406\u51fd\u6570 voidheatCTRl\uff08<\/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\/2501"}],"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=2501"}],"version-history":[{"count":0,"href":"http:\/\/www.szryc.com\/index.php?rest_route=\/wp\/v2\/posts\/2501\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2501"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}