{"id":2806,"date":"2019-09-12T01:07:47","date_gmt":"2019-09-12T01:07:47","guid":{"rendered":""},"modified":"2019-09-12T09:08:18","modified_gmt":"2019-09-12T01:08:18","slug":"%e5%a6%82%e4%bd%95%e5%b0%86%e5%8d%95%e7%89%87%e6%9c%ba%e7%9a%84tmr%e7%94%a8%e4%bd%9c%e5%ae%9a%e6%97%b6%e5%99%a8%e5%92%8c%e8%ae%a1%e6%95%b0%e5%99%a8%e4%bd%bf%e7%94%a8","status":"publish","type":"post","link":"http:\/\/www.szryc.com\/?p=2806","title":{"rendered":"\u5982\u4f55\u5c06\u5355\u7247\u673a\u7684TMR\u7528\u4f5c\u5b9a\u65f6\u5668\u548c\u8ba1\u6570\u5668\u4f7f\u7528"},"content":{"rendered":"

\n\tTMR0\u4e3a8\u4f4d\u5bbd\uff0c\u6709\u4e00\u4e2a\u53ef\u9009\u7684\u9884\u5206\u9891\u5668\uff0c\u7528\u4e8e\u901a\u7528\u76ee\u7684\uff0c\u53ef\u7528\u4e8e\u5b9a\u65f6\u548c\u8ba1\u6570\u3002<\/p>\n

\n\tTMR1\u4e3a16\u4f4d\u5bbd\uff0c\u9644\u5e26\u4e00\u4e2a\u53ef\u7f16\u7a0b\u7684\u9884\u5206\u9891\u5668\u548c\u4e00\u4e2a\u53ef\u9009\u7684\u4f4e\u9891\u65f6\u57fa\u632f\u8361\u5668<\/u>\uff0c\u9002\u5408\u4e0eCPP\u6a21\u5757\u914d\u5408\u4f7f\u7528\u6765\u5b9e\u73b0\u8f93\u5165\u6355\u6263\u6216\u8f93\u51fa\u6bd4\u8f83\u529f\u80fd\uff0c\u4e5f\u53ef\u4e8e\u5b9a\u65f6\u548c\u8ba1\u6570\u3002<\/p>\n

\n\t <\/div>\n

\n\tTMR2\u4e3a8\u4f4d\u5bbd\uff0c\u9644\u5e26\u4e00\u4e2a\u914d\u5408\u4f7f\u7528\u6765\u5b9e\u73b0PWM\u8109\u51b2\u5bbd\u5ea6\u8c03\u5236\u4fe1\u53f7\u7684\u4ea7\u751f\uff0c\u53ea\u80fd\u7528\u4e8e\u5b9a\u65f6\u3002<\/p>\n

\n\tTMR0\u7528\u4f5c\u5b9a\u65f6\u5668<\/u>\u65f6\uff0c\u5b9a\u65f6\u5668\u65f6\u949f<\/u>\uff1d\u7cfb\u7edf\u65f6\u949f\/4\uff1b<\/p>\n

\n\t\"\u5982\u4f55\u5c06\u5355\u7247\u673a\u7684TMR\u7528\u4f5c\u5b9a\u65f6\u5668\u548c\u8ba1\u6570\u5668\u4f7f\u7528\"<\/p>\n

\n\t\u5199TMR0\u65f6\uff0c\u4f1a\u4ea7\u751f2\u4e2a\u5468\u671f\u7684\u7684\u5ef6\u65f6\uff0c\u5982\u679c\u4e0d\u4f7f\u7528\u524d\u7f6e\u5206\u9891\u5668\uff0c\u53ef\u901a\u8fc7\u8bbe\u7f6e<\/p>\n

\n\t\u521d\u503c\u8fdb\u884c\u8865\u507f\u3002<\/p>\n

\n\t\u4f8b\u5982 \u9700\u8981\u5b9a\u65f6200\u4e2a\u65f6\u949f\u5468\u671f\u65f6\uff0cTMR0 = 256 -200 + 2= 58<\/p>\n

\n\tOPTI<\/u>ON_REG\uff1a<\/p>\n

\n\tbit5 T0CS:TMR0 Clock Source Select bit<\/p>\n

\n\t1 = TransiTIon on T0CKI pi<\/u>n<\/p>\n

\n\t0 = Inte<\/u>rnal instrucTIon cycle clock\uff08CLKO\uff09<\/p>\n

\n\tbit 4 T0SE:TMR0 Source Edge Select bit<\/p>\n

\n\t1 = Increment on high-to-low transiTIon on T0CKI pin<\/p>\n

\n\t0 = Increment on low-to-high transiTIon on T0CKI pin<\/p>\n

\n\tbit 3 PSA:Prescaler Assignment bit<\/p>\n

\n\t1 = Prescaler is assigned to the WDT<\/p>\n

\n\t0 = Prescaler is assigned to the Timer0 module<\/p>\n

\n\tbit2-0 PS2:PS0:Prescaler Rate Select bits<\/p>\n

\n\t\u4efb\u4f55\u65f6\u5019\u5bf9TMR0\u5bc4\u5b58\u5668<\/u>\u8fdb\u884c\u4e00\u6b21\u5199\u64cd\u4f5c\u540e\uff0c\u5176\u8ba1\u6570\u529f\u80fd\u5c06\u88ab\u7981\u6b622\u4e2a\u6307\u4ee4\u5468\u671f\u3002<\/p>\n

\n\t\u7ed9\u5927\u5bb6\u4e00\u4e2a\u610f\u89c1\uff1a\u5982\u679c\u60f3\u7528TMR0\u5b9e\u73b0\u7cbe\u786e\u7684\u5b9a\u65f6\uff0c\u4e00\u65e6\u7528\u4e86\u9884\u5206\u9891\u5668\u540e\u5c31\u4e0d\u8981\u5bf9TMR0\u505a\u4efb\u4f55\u5199\u64cd\u4f5c\u3002<\/p>\n

\n\t\u6ce8\u610f\uff1a\u5728\u4e2d\u65ad\u670d\u52a1\u7a0b\u5e8f\u4e2d\u67e5\u8be2TMR0\u4e2d\u65ad\u65f6\uff0c\u65e2\u8981\u67e5\u8be2T0IE\u4f4d\uff0c\u8fd8\u8981\u67e5\u8be2T0IF<\/u>\u4f4d\u3002
\n\t\u6765\u6e90\uff1b21ic<\/p>\n","protected":false},"excerpt":{"rendered":"

TMR0\u4e3a8\u4f4d\u5bbd\uff0c\u6709\u4e00\u4e2a\u53ef\u9009\u7684\u9884\u5206\u9891\u5668\uff0c\u7528\u4e8e\u901a\u7528\u76ee\u7684\uff0c\u53ef\u7528\u4e8e\u5b9a\u65f6\u548c\u8ba1\u6570\u3002 TMR1\u4e3a16\u4f4d\u5bbd\uff0c\u9644\u5e26\u4e00\u4e2a\u53ef\u7f16\u7a0b\u7684\u9884\u5206\u9891\u5668\u548c\u4e00\u4e2a\u53ef\u9009\u7684\u4f4e\u9891\u65f6\u57fa \u632f\u8361\u5668 \uff0c\u9002\u5408\u4e0eCPP\u6a21\u5757\u914d\u5408\u4f7f\u7528\u6765\u5b9e\u73b0\u8f93\u5165<\/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\/2806"}],"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=2806"}],"version-history":[{"count":0,"href":"http:\/\/www.szryc.com\/index.php?rest_route=\/wp\/v2\/posts\/2806\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2806"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2806"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2806"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}