{"id":2446,"date":"2019-05-16T07:51:31","date_gmt":"2019-05-16T07:51:31","guid":{"rendered":""},"modified":"2019-05-16T15:51:50","modified_gmt":"2019-05-16T07:51:50","slug":"at89s51%e5%8d%95%e7%89%87%e6%9c%ba%e7%94%b5%e5%ad%90%e9%97%a8%e9%93%83%e7%9a%84%e8%ae%be%e8%ae%a1","status":"publish","type":"post","link":"http:\/\/www.szryc.com\/?p=2446","title":{"rendered":"AT89S51\u5355\u7247\u673a\u7535\u5b50\u95e8\u94c3\u7684\u8bbe\u8ba1"},"content":{"rendered":"

\n\t1\uff0e\u5b9e\u9a8c\u4efb\u52a1<\/p>\n

\n\t\u5f53\u6309\u4e0b\u5f00\u5173SP1\uff0cAT89S51\u5355\u7247\u673a<\/u>\u4ea7\u751f“\u53ee\u549a”\u58f0\u4eceP1.0\u7aef\u53e3\u8f93\u51fa\u5230LM386\uff0c\u7ecf\u8fc7\u653e\u5927\u4e4b\u540e\u9001\u5165\u5587\u53ed\u3002<\/p>\n

\n\t <\/div>\n

\n\t2\uff0e\u7535\u8def<\/u>\u539f\u7406\u56fe<\/p>\n

\n\t\"AT89S51\u5355\u7247\u673a\u7535\u5b50\u95e8\u94c3\u7684\u8bbe\u8ba1\"<\/p>\n

\n\t\u56fe4.19.1<\/p>\n

\n\t3\uff0e\u7cfb\u7edf\u677f\u4e0a\u786c\u4ef6\u8fde\u7ebf<\/p>\n

\n\t\uff081\uff09\uff0e\u628a“\u5355\u7247\u673a\u7cfb\u7edf”\u533a\u57df\u4e2d\u7684P1.0\u7aef\u53e3\u7528\u5bfc\u7ebf\u8fde\u63a5\u5230“\u97f3\u9891\u653e\u5927\u6a21\u5757”\u533a\u57df\u4e2d\u7684SPK IN\u7aef\u53e3\u4e0a\uff1b<\/p>\n

\n\t\uff082\uff09\uff0e\u5728“\u97f3\u9891\u653e\u5927\u6a21\u5757”\u533a\u57df\u4e2d\u7684SPK OUT\u7aef\u53e3\u4e0a\u63a5\u4e0a\u4e00\u4e2a8\u6b27\u6216\u8005\u662f16\u6b27\u7684\u5587\u53ed\uff1b<\/p>\n

\n\t\uff083\uff09\uff0e\u628a“\u5355\u7247\u673a\u7cfb\u7edf”\u533a\u57df\u4e2d\u7684P3.7\/RD\u7aef\u53e3\u7528\u5bfc\u7ebf\u8fde\u63a5\u5230“\u72ec\u7acb\u5f0f\u952e\u76d8”\u533a\u57df\u4e2d\u7684SP1\u7aef\u53e3\u4e0a\uff1b<\/p>\n

\n\t4\uff0e\u7a0b\u5e8f\u8bbe\u8ba1\u65b9\u6cd5<\/p>\n

\n\t\uff081\uff09\uff0e\u6211\u4eec\u7528\u5355\u7247\u673a\u5b9e\u5b9a\u65f6\/\u8ba1\u6570\u5668T0\u6765\u4ea7\u751f700Hz\u548c500HZ\u7684\u9891\u7387\uff0c\u6839\u636e\u5b9a\u65f6\/\u8ba1\u6570\u5668T0\uff0c\u6211\u4eec\u53d6\u5b9a\u65f6250us\uff0c\u56e0\u6b64\uff0c700HZ\u7684\u9891\u7387\u8981\u7ecf\u8fc73\u6b21250us\u7684\u5b9a\u65f6\uff0c\u800c500HZ\u7684\u9891\u7387\u8981\u7ecf\u8fc74\u6b21250us\u7684\u5b9a\u65f6\u3002<\/p>\n

\n\t\uff082\uff09\uff0e\u5728\u8bbe\u8ba1\u8fc7\u7a0b\uff0c\u53ea\u6709\u5f53\u6309\u4e0bSP1\u4e4b\u540e\uff0c\u624d\u542f\u52a8T0\u5f00\u59cb\u5de5\u4f5c\uff0c\u5f53T0\u5de5\u4f5c\u5b8c\u6bd5\uff0c\u56de\u5230\u6700\u521d\u72b6\u6001\u3002<\/p>\n

\n\t\uff083\uff09\uff0e“\u53ee”\u548c“\u549a”\u58f0\u97f3\u5404\u5360\u75280.5\u79d2\uff0c\u56e0\u6b64\u5b9a\u65f6\/\u8ba1\u6570\u5668T0\u8981\u5b8c\u62100.5\u79d2\u7684\u5b9a\u65f6\uff0c\u5bf9\u4e8e\u4ee5250us\u4e3a\u57fa\u51c6\u5b9a\u65f62000\u6b21\u624d\u53ef\u4ee5\u3002<\/p>\n

\n\t6\uff0e\u6c47\u7f16\u6e90\u7a0b\u5e8f<\/p>\n

\n\tT5HZ EQU 30H<\/p>\n

\n\tT7HZ EQU 31H<\/p>\n

\n\tT05SA EQU 32H<\/p>\n

\n\tT05SB EQU 33H<\/p>\n

\n\tFLAG BIT 00H<\/p>\n

\n\tSTOP BIT 01H<\/p>\n

\n\tSP1 BIT P3.7<\/p>\n

\n\tORG 00H<\/p>\n

\n\tLJMP START<\/p>\n

\n\tORG 0BH<\/p>\n

\n\tLJMP INT_T0<\/p>\n

\n\tSTART\uff1a MOV TMOD\uff0c#02H<\/p>\n

\n\tMOV TH0\uff0c#06H<\/p>\n

\n\tMOV TL0\uff0c#06H<\/p>\n

\n\tSETB ET0<\/p>\n

\n\tSETB EA<\/p>\n

\n\tNSP\uff1a JB SP1\uff0cNSP<\/p>\n

\n\tLCALL DELY10MS<\/p>\n

\n\tJB SP1\uff0cNSP<\/p>\n

\n\tSETB TR0<\/p>\n

\n\tMOV T5HZ\uff0c#00H<\/p>\n

\n\tMOV T7HZ\uff0c#00H<\/p>\n

\n\tMOV T05SA\uff0c#00H<\/p>\n

\n\tMOV T05SB\uff0c#00H<\/p>\n

\n\tCLR FLAG<\/p>\n

\n\tCLR STOP<\/p>\n

\n\tJNB STOP\uff0c$<\/p>\n

\n\tLJMP NSP<\/p>\n

\n\tDELY10MS\uff1a MOV R6\uff0c#20<\/p>\n

\n\tD1\uff1a MOV R7\uff0c#248<\/p>\n

\n\tDJNZ R7\uff0c$<\/p>\n

\n\tDJNZ R6\uff0cD1<\/p>\n

\n\tRET<\/p>\n

\n\tINT_T0\uff1a INC T05SA<\/p>\n

\n\tMOV A\uff0cT05SA<\/p>\n

\n\tCJNE A\uff0c#100\uff0cNEXT<\/p>\n

\n\tMOV T05SA\uff0c#00H<\/p>\n

\n\tINC T05SB<\/p>\n

\n\tMOV A\uff0cT05SB<\/p>\n

\n\tCJNE A\uff0c#20\uff0cNEXT<\/p>\n

\n\tMOV T05SB\uff0c#00H<\/p>\n

\n\tJB FLAG\uff0cSTP<\/p>\n

\n\tCPL FLAG<\/p>\n

\n\tLJMP NEXT<\/p>\n

\n\tSTP\uff1a SETB STOP<\/p>\n

\n\tCLR TR0<\/p>\n

\n\tLJMP DONE<\/p>\n

\n\tNEXT\uff1a JB FLAG\uff0cS5HZ<\/p>\n

\n\tINC T7HZ<\/p>\n

\n\tMOV A\uff0cT7HZ<\/p>\n

\n\tCJNE A\uff0c#03H\uff0cDONE<\/p>\n

\n\tMOV T7HZ\uff0c#00H<\/p>\n

\n\tCPL P1.0<\/p>\n

\n\tLJMP DONE<\/p>\n

\n\tS5HZ\uff1a INC T5HZ<\/p>\n

\n\tMOV A\uff0cT5HZ<\/p>\n

\n\tCJNE A\uff0c#04H\uff0cDONE<\/p>\n

\n\tMOV T5HZ\uff0c#00H<\/p>\n

\n\tCPL P1.0<\/p>\n

\n\tLJMP DONE<\/p>\n

\n\tDONE\uff1a RETI<\/u><\/p>\n

\n\tEND<\/p>\n

\n\t7\uff0eC\u8bed\u8a00\u6e90\u7a0b\u5e8f<\/p>\n

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

\n\tunsigned char t5hz;<\/p>\n

\n\tunsigned char t7hz;<\/p>\n

\n\tunsigned int tcnt;<\/p>\n

\n\tbit stop;<\/p>\n

\n\tbit flag;<\/p>\n

\n\tvoid mai<\/u>n\uff08void\uff09<\/p>\n

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

\n\tunsigned char i\uff0cj;<\/p>\n

\n\tTMOD=0x02;<\/p>\n

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

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

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

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

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

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

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

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

\n\tfor\uff08i=10;i\u300b0;i--\uff09<\/p>\n

\n\tfor\uff08j=248;j\u300b0;j--\uff09;<\/p>\n

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

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

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

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

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

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

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

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

\n\twhile\uff08stop==0\uff09;<\/p>\n

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

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

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

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

\n\tvoid t0\uff08void\uff09 inte<\/u>rrupt 1 using 0<\/p>\n

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

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

\n\tif\uff08tcnt==2000\uff09<\/p>\n

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

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

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

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

\n\tflag=~flag;<\/p>\n

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

\n\telse<\/p>\n

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

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

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

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

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

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

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

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

\n\tif\uff08t7hz==3\uff09<\/p>\n

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

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

\n\tP1_0=~P1_0;<\/p>\n

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

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

\n\telse<\/p>\n

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

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

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

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

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

\n\tP1_0=~P1_0;<\/p>\n

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

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

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

1\uff0e\u5b9e\u9a8c\u4efb\u52a1 \u5f53\u6309\u4e0b\u5f00\u5173SP1\uff0cAT89S51 \u5355\u7247\u673a \u4ea7\u751f\u53ee\u549a\u58f0\u4eceP1.0\u7aef\u53e3\u8f93\u51fa\u5230LM386\uff0c\u7ecf\u8fc7\u653e\u5927\u4e4b\u540e\u9001\u5165\u5587\u53ed\u3002 2\uff0e \u7535\u8def \u539f\u7406\u56fe \u56fe4.19.1 3\uff0e\u7cfb\u7edf\u677f\u4e0a\u786c\u4ef6\u8fde\u7ebf \uff081\uff09\uff0e\u628a\u5355\u7247\u673a\u7cfb\u7edf\u533a\u57df\u4e2d\u7684P1.0\u7aef<\/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\/2446"}],"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=2446"}],"version-history":[{"count":0,"href":"http:\/\/www.szryc.com\/index.php?rest_route=\/wp\/v2\/posts\/2446\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2446"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2446"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2446"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}