{"id":49,"date":"2025-07-17T01:02:57","date_gmt":"2025-07-16T17:02:57","guid":{"rendered":"https:\/\/newknow.top\/?p=49"},"modified":"2025-07-20T07:54:40","modified_gmt":"2025-07-19T23:54:40","slug":"%e7%8b%ac%e7%ab%8b%e6%8c%89%e9%94%ae%e6%8e%a7%e5%88%b6led%e7%a7%bb%e4%bd%8d","status":"publish","type":"post","link":"https:\/\/newknow.top\/index.php\/2025\/07\/17\/%e7%8b%ac%e7%ab%8b%e6%8c%89%e9%94%ae%e6%8e%a7%e5%88%b6led%e7%a7%bb%e4%bd%8d\/","title":{"rendered":"51\u5355\u7247\u673a\u2014\u2014\u72ec\u7acb\u6309\u952e\u63a7\u5236LED\u79fb\u4f4d"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>#include &lt;REGX52.H>\nvoid Delay(unsigned int xms)\n{\n\tunsigned char i, j;\n\twhile(xms)\n\t{\n \n\t\ti = 2;\n\t\tj = 239;\n\t\tdo\n  \t\t{\n\t\t\twhile (--j);\n\t\t} while (--i);\n\t\txms--;\n\t}\n}\nvoid main()\n{\n\tunsigned char lednum;\n\tP2_0=0;\n\twhile(1)\n\t{\n\t\tif(P3_1==0)\n\t\t{\n\t\t\tDelay(20);\n\t\t\twhile(P3_1==0);\n\t\t\tDelay(20);\n\t\t\tlednum++;\n\t\t\tif(lednum>=8)\n\t\t\t{\n\t\t\t\tlednum=0;\n\t\t\t}\n\t\t\tP2=~(0x01&lt;&lt;lednum);\n\t\t}\n\t\tif(P3_0==0)\n\t\t{\n\t\t\tDelay(20);\n\t\t\twhile(P3_0==0);\n\t\t\tDelay(20);\n\t\t\tif(lednum==0)\n\t\t\t{\n\t\t\t\tlednum=7;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tlednum--;\n\t\t\t}\n\t\t\tP2=~(0x01&lt;&lt;lednum);\n\t}\n}\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u5de6\u79fb<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">0000 0001<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">0000 0010<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u53f3\u79fb<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">1000 0000<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">0100 0000<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e3a\u4ec0\u4e48\u5f53lednum==0\u65f6\uff0c\u8981\u4ee4\u5176\u7b49\u4e8e7<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">unsigned char lednum\u7684\u8303\u56f40\u5230255,0\u518d\u51cf\u4e001\u5c31\u4f1a\u6ea2\u51fa\u5230255.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5de6\u79fb 0000 0001 0000 0010 \u53f3\u79fb 1000 0000 0100 0000 \u4e3a\u4ec0\u4e48\u5f53lednu [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kadence_starter_templates_imported_post":false,"footnotes":""},"categories":[5,4],"tags":[],"class_list":["post-49","post","type-post","status-publish","format-standard","hentry","category-5","category-4"],"_links":{"self":[{"href":"https:\/\/newknow.top\/index.php\/wp-json\/wp\/v2\/posts\/49","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/newknow.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/newknow.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/newknow.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/newknow.top\/index.php\/wp-json\/wp\/v2\/comments?post=49"}],"version-history":[{"count":2,"href":"https:\/\/newknow.top\/index.php\/wp-json\/wp\/v2\/posts\/49\/revisions"}],"predecessor-version":[{"id":63,"href":"https:\/\/newknow.top\/index.php\/wp-json\/wp\/v2\/posts\/49\/revisions\/63"}],"wp:attachment":[{"href":"https:\/\/newknow.top\/index.php\/wp-json\/wp\/v2\/media?parent=49"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/newknow.top\/index.php\/wp-json\/wp\/v2\/categories?post=49"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/newknow.top\/index.php\/wp-json\/wp\/v2\/tags?post=49"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}