{"id":2808,"date":"2019-09-16T00:28:51","date_gmt":"2019-09-16T00:28:51","guid":{"rendered":""},"modified":"2019-09-16T08:29:06","modified_gmt":"2019-09-16T00:29:06","slug":"avr%e5%8d%95%e7%89%87%e6%9c%ba%e6%8e%a7%e5%88%b6%e7%bb%a7%e7%94%b5%e5%99%a8%e5%90%b8%e5%90%88%e4%b8%8e%e6%96%ad%e5%bc%80%e7%9a%84%e4%bb%bf%e7%9c%9f%e8%ae%be%e8%ae%a1","status":"publish","type":"post","link":"http:\/\/www.szryc.com\/?p=2808","title":{"rendered":"AVR\u5355\u7247\u673a\u63a7\u5236\u7ee7\u7535\u5668\u5438\u5408\u4e0e\u65ad\u5f00\u7684\u4eff\u771f\u8bbe\u8ba1"},"content":{"rendered":"

\n\t\u7ee7\u7535\u5668<\/u>\uff08Relay\uff09\uff0c\u4f5c\u7528\u662f\u7528\u5f31\u7535\u63a7\u5236\u5f3a\u7535\u3002\u6bd4\u5982\uff0c\u6211\u4eec\u7528avr<\/u>\u5355\u7247\u63a7\u5236\u4e00\u4e2a220V\u7535\u538b\u7684\u706f\u6ce1\uff0c\u8fd9\u5c31\u5fc5\u987b\u7528\u5230\u7ee7\u7535\u5668\u3002<\/p>\n

\n\t\u672c\u8bfe\u7528avr\u5355\u7247\u673a<\/u>\u6765\u63a7\u5236\u7ee7\u7535\u5668\u7684\u5438\u5408\u4e0e\u65ad\u5f00\u3002<\/p>\n

\n\t <\/div>\n

\n\tProte<\/u>us\u4eff\u771f\u5b9e\u9a8c\u5668\u4ef6\uff1a<\/p>\n

\n\t1 atmega128\u4e00\u5757<\/p>\n

\n\t2 button\uff0c\u6309\u952e\u4e00\u4e2a<\/p>\n

\n\t3 relay\uff0c\u901a\u7528\u7ee7\u7535\u5668\u4e00\u4e2a\uff0c\u5e76\u628a\u7ee7\u7535\u5668\u7684Component Value\u8bbe\u7f6e\u4e3a5V<\/p>\n

\n\t4 pnp\u4e09\u6781\u7ba1<\/u>\u4e00\u4e2a<\/p>\n

\n\t5 LAMP\uff0c\u706f\u6ce1\u4e00\u4e2a\u6539\u4e3a220V<\/p>\n

\n\t6 resistor 1k<\/p>\n

\n\t7 DIODE<\/u> \u4e8c\u6781\u7ba1<\/u>\u4e00\u4e2a<\/p>\n

\n\t\u8fd9\u4e2a\u7a0b\u5e8f\u5b9e\u9645\u4e0a\u5f88\u7b80\u5355\uff0c\u4e3b\u8981\u8981\u5b66\u4e60\u7ee7\u7535\u5668\u7684\u7528\u6cd5\uff0c\u6ce8\u610f\u7684\u662f\uff0c\u7ee7\u7535\u5668\u5fc5\u987b\u63a5\u4e00\u4e2a\u4e8c\u6781\u7ba1\u3002<\/p>\n

\n\t\"AVR\u5355\u7247\u673a\u63a7\u5236\u7ee7\u7535\u5668\u5438\u5408\u4e0e\u65ad\u5f00\u7684\u4eff\u771f\u8bbe\u8ba1\"<\/p>\n

\n\t\u4eff\u771f\u7a0b\u5e8f\u5982\u4e0b\uff1a<\/p>\n

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

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

\n\t#define int8u unsigned char<\/p>\n

\n\t#define int16u unsigned int<\/p>\n

\n\t#define k1_down\uff08\uff09 \uff08PI<\/u>NB & _BV\uff08PB7\uff09\uff09<\/p>\n

\n\t#define relay_switch\uff08\uff09 PORTD^=_BV\uff08PD4\uff09<\/p>\n

\n\tint mai<\/u>n\uff08\uff09<\/p>\n

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

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

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

\n\tDDRB=0x00;<\/p>\n

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

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

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

\n\tif<\/u>\uff08k1_down\uff08\uff09 \uff09<\/p>\n

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

\n\twhile\uff08k1_down\uff08\uff09 \uff09;<\/p>\n

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

\n\t_delay_ms\uff0820\uff09;<\/p>\n

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

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

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

\u7ee7\u7535\u5668 \uff08Relay\uff09\uff0c\u4f5c\u7528\u662f\u7528\u5f31\u7535\u63a7\u5236\u5f3a\u7535\u3002\u6bd4\u5982\uff0c\u6211\u4eec\u7528a vr \u5355\u7247\u63a7\u5236\u4e00\u4e2a220V\u7535\u538b\u7684\u706f\u6ce1\uff0c\u8fd9\u5c31\u5fc5\u987b\u7528\u5230\u7ee7\u7535\u5668\u3002 \u672c\u8bfe\u7528avr \u5355\u7247\u673a \u6765\u63a7\u5236\u7ee7\u7535\u5668\u7684\u5438\u5408\u4e0e\u65ad\u5f00\u3002 Pro te us\u4eff\u771f\u5b9e\u9a8c\u5668\u4ef6\uff1a<\/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\/2808"}],"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=2808"}],"version-history":[{"count":0,"href":"http:\/\/www.szryc.com\/index.php?rest_route=\/wp\/v2\/posts\/2808\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2808"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2808"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2808"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}