{"id":2731,"date":"2019-07-11T09:10:07","date_gmt":"2019-07-11T09:10:07","guid":{"rendered":""},"modified":"2019-07-11T17:10:31","modified_gmt":"2019-07-11T09:10:31","slug":"51%e5%8d%95%e7%89%87%e6%9c%ba%e5%af%b9%e7%9f%a9%e9%98%b5%e9%94%ae%e7%9b%98%e5%ae%9e%e7%8e%b016%e4%b8%aa%e6%8c%89%e9%94%ae%e6%93%8d%e4%bd%9c%e7%9a%84%e7%94%b5%e8%b7%af%e8%ae%be%e8%ae%a1","status":"publish","type":"post","link":"http:\/\/www.szryc.com\/?p=2731","title":{"rendered":"51\u5355\u7247\u673a\u5bf9\u77e9\u9635\u952e\u76d8\u5b9e\u73b016\u4e2a\u6309\u952e\u64cd\u4f5c\u7684\u7535\u8def\u8bbe\u8ba1"},"content":{"rendered":"

\n\t\u77e9\u9635\u952e\u76d8\u662f\u5355\u7247\u673a<\/u>\u5916\u90e8\u8bbe\u5907\u4e2d\u6240\u4f7f\u7528\u7684\u6392\u5e03\u7c7b\u4f3c\u4e8e\u77e9\u9635\u7684\u952e\u76d8\u7ec4\u3002\u77e9\u9635\u5f0f\u7ed3\u6784\u7684\u952e\u76d8\u663e\u7136\u6bd4\u76f4\u63a5\u6cd5\u8981\u590d\u6742\u4e00\u4e9b\uff0c\u8bc6\u522b\u4e5f\u8981\u590d\u6742\u4e00\u4e9b\uff0c\u5217\u7ebf\u901a\u8fc7\u7535\u963b<\/u>\u63a5\u6b63\u7535\u6e90\uff0c\u5e76\u5c06\u884c\u7ebf\u6240\u63a5\u7684\u5355\u7247\u673a\u7684I\/O<\/u>\u53e3\u4f5c\u4e3a\u8f93\u51fa\u7aef\uff0c\u800c\u5217\u7ebf\u6240\u63a5\u7684I\/O\u53e3\u5219\u4f5c\u4e3a\u8f93\u5165\u3002\u77e9\u9635\u952e\u76d8\u7684\u4f18\u70b9\u662f\u8282\u7ea6\u5355\u7247\u673aIO\u53e3\uff0c\u4f8b\u5982\u666e\u901a\u952e\u76d88\u4e2aIO\u53e3\u53ea\u80fd\u7528\u4f5c8\u4e2a\u6309\u952e\uff0c\u800c\u77e9\u9635\u952e\u76d8\u80fd\u4f5c16\u4e2a\u6309\u952e\u3002<\/p>\n

\n\t\u672c\u6587\u4ee551\u5355\u7247\u673a\u4e3a\u8f7d\u4f53\u4ecb\u7ecd\u4e00\u79cd4*4\u77e9\u9635\u952e\u76d8\u5b9e\u73b016\u4e2a\u6309\u952e\u64cd\u4f5c\u7684\u539f\u7406\u3001\u7535\u8def<\/u>\u548c\u8f6f\u4ef6\u8bbe\u8ba1\u8981\u70b9\u3002<\/p>\n

\n\t <\/div>\n

\n\t1\u3001 \u77e9\u9635\u952e\u76d8\u7684\u4e00\u822c\u7535\u8def<\/p>\n

\n\t\"51\u5355\u7247\u673a\u5bf9\u77e9\u9635\u952e\u76d8\u5b9e\u73b016\u4e2a\u6309\u952e\u64cd\u4f5c\u7684\u7535\u8def\u8bbe\u8ba1\"<\/p>\n

\n\t\u56fe 1 \u77e9\u9635\u952e\u76d8\u7535\u8def<\/p>\n

\n\t\u5982\u56fe 1<\/p>\n

\n\t\u77e9\u9635\u952e\u76d8\u7535\u8def\u6240\u793a\uff0c4*4\u77e9\u9635\u952e\u76d8\u67094\u884c4\u5217\u6309\u952e\uff0c\u5355\u7247\u673a4\u4e2aI\/O\u53e3\u63a5\u77e9\u9635\u952e\u76d8\u7684\u884c\u7ebf\uff0c\u53e6\u59164\u4e2aI\/O\u53e3\u63a5\u77e9\u9635\u952e\u76d8\u7684\u5217\u7ebf\uff0c\u901a\u8fc7\u5bf9\u884c\u7ebf\u5217\u7ebf\u7684\u64cd\u4f5c\u5b8c\u6210\u6309\u952e\u7684\u8bc6\u522b\u548c\u64cd\u4f5c\u3002<\/p>\n

\n\t2\u3001 \u77e9\u9635\u952e\u76d8\u7684\u539f\u7406<\/p>\n

\n\t\u77e9\u9635\u952e\u76d8\u6309\u952e\u8bc6\u522b\u7684\u6d41\u7a0b\u4e00\u822c\u662f\u8fd9\u6837\u7684\uff1a<\/p>\n

\n\t\uff081\uff09\u7f6e\u7b2c1\u884c\u4e3a\u4f4e\u7535\u5e73\uff080\uff09\uff0c\u5176\u4f59\u884c\u4e3a\u9ad8\u7535\u5e73\uff0c\u8bfb\u53d6\u5217\u7ebf\u6570\u636e\uff0c\u5217\u7ebf\u6709\u4f4e\u7535\u5e73\u8868\u793a\u6b64\u884c\u6709\u6309\u952e\u6309\u4e0b\u3002<\/p>\n

\n\t\uff082\uff09\u7f6e\u7b2c2\u884c\u4e3a\u4f4e\u7535\u5e73\uff080\uff09\uff0c\u5176\u4f59\u884c\u4e3a\u9ad8\u7535\u5e73\uff0c\u8bfb\u53d6\u5217\u7ebf\u6570\u636e\uff0c\u5217\u7ebf\u6709\u4f4e\u7535\u5e73\u8868\u793a\u6b64\u884c\u6709\u6309\u952e\u6309\u4e0b\u3002<\/p>\n

\n\t\uff08N-1\uff09\u6839\u636e\u884c\u7ebf\u5217\u7ebf\u7684\u7535\u5e73\u4e0d\u540c\u53ef\u4ee5\u8bc6\u522b\u662f\u5426\u6709\u6309\u952e\u6309\u4e0b\uff0c\u54ea\u4e00\u4e2a\u6309\u952e\u6309\u4e0b\uff0c\u83b7\u53d6\u6309\u952e\u53f7\u3002<\/p>\n

\n\t\uff08N\uff09 \u6839\u636e\u6309\u952e\u53f7\u8df3\u8f6c\u81f3\u5bf9\u5e94\u7684\u6309\u952e\u5904\u7406\u7a0b\u5e8f\u3002<\/p>\n

\n\t3\u3001 \u4e00\u4e2a\u77e9\u9635\u952e\u76d8\u7a0b\u5e8f\u7684\u4f8b\u5b50<\/p>\n

\n\t\"51\u5355\u7247\u673a\u5bf9\u77e9\u9635\u952e\u76d8\u5b9e\u73b016\u4e2a\u6309\u952e\u64cd\u4f5c\u7684\u7535\u8def\u8bbe\u8ba1\"<\/p>\n

\n\t\u56fe<\/p>\n

\n\t2\u4e3a\u6309\u952e\u5904\u7406\u7684\u4e3b\u6d41\u7a0b\uff0c\u601d\u8def\u662f\u4f9d\u6b21\u62c9\u4f4e\u6309\u952e\u7684\u5404\u4e2a\u884c\uff0c\u518d\u8bfb\u53d6\u5217\u7ebf\u7684\u6570\u636e\uff0c\u5047\u5982\u5217\u7ebf\u6709\u4f4e\u7535\u5e73\uff0c\u5219\u8ba4\u4e3a\u6b64\u884c\u6709\u6309\u952e\u6309\u4e0b\uff0c\u6807\u8bb0<\/u>\u6b64\u884c\u6709\u6309\u952e\u6309\u4e0b\u5e76\u5b58\u5165\u884c\u503c\u3002<\/p>\n

\n\t\u8bfb\u53d6\u5217\u7ebf\u6570\u636e\u7684\u601d\u8def\u5219\u662f\u8fd9\u6837\uff0c\u4f9d\u6b21\u8bfb\u53d6\u7b2c1-4\u5217\uff0c\u5047\u5982\u8bfb\u53d6\u6b64\u5217\u65f6\u4e3a\u4f4e\u7535\u5e73\uff0c\u5219\u6807\u8bb0\u5e76\u5b58\u5165\u5217\u503c\u3002<\/p>\n

\n\t\u4e0b\u9762\u662f\u90e8\u5206\u4ee3\u7801\uff1a<\/p>\n

\n\t\/\/\uff081\uff09\u6309\u952e\u8bc6\u522b\u7a0b\u5e8f<\/p>\n

\n\tvoid key\uff08\uff09 \/\/\u6309\u952e\u626b\u63cf<\/p>\n

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

\n\tunsigned char key_value_te<\/u>mp; \/\/\u4e34\u65f6\u6309\u952e\u503c\uff0c\u9ed8\u8ba41111 1111\uff08\u4e8c\u8fdb\u5236\uff09<\/p>\n

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

\n\t\/\/\u952e\u503c<\/p>\n

\n\tkey_value_temp=0xff; \/\/\u952e\u503c\u4e34\u65f6\u53d8\u91cf<\/p>\n

\n\t\/\/\u77e9\u9635\u952e\u76d8\u7a0b\u5e8f\u6d41\u7a0b<\/p>\n

\n\t\/\/\u4f9d\u6b21\u62c9\u4f4e\u7b2c1234\u884c\uff0c\u8bfb\u5165\u5217\u7ebf\u6570\u636e<\/p>\n

\n\tPi<\/u>n_r_1=0; Pin_r_2=1;Pin_r_3=1;Pin_r_4=1; \/\/\u62c9\u4f4e\u7b2c1\u884c\u3002<\/p>\n

\n\t\/\/Pin_r_1\u7b2c1\u884c\u884c\u7ebf\uff0cPin_r_2\u7b2c2\u884c\u884c\u7ebf\uff0c\u5176\u4f59\u7c7b\u4f3c<\/p>\n

\n\tkey_value_temp=read_column\uff08\uff09;\/\/\u8bfb\u5217\u6570\u636e<\/p>\n

\n\tif<\/u> \uff08key_value_temp \uff01= 0xff\uff09<\/p>\n

\n\t\/\/\u8868\u793a\u7b2c\u4e00\u884c\u6709\u6309\u952e\u6309\u4e0b<\/p>\n

\n\t{key_value=key_value_temp & 0x1f;<\/p>\n

\n\t\/\/\u83b7\u53d6\u6309\u952e\u53f7\uff0c\u4f8b\u59820001<\/p>\n

\n\t1101\u8868\u793a\u7b2c1\u884c\u7b2c2\u5217\u7684\u6309\u952e\u6309\u4e0b<\/p>\n

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

\n\tPin_r_1=1; Pin_r_2=0;Pin_r_3=1;Pin_r_4=1; \/\/\u62c9\u4f4e\u7b2c2\u884c<\/p>\n

\n\tkey_value_temp=read_column\uff08\uff09;\/\/\u8bfb\u5217\u6570\u636e<\/p>\n

\n\tif \uff08key_value_temp \uff01= 0xff\uff09<\/p>\n

\n\t\/\/\u8868\u793a\u7b2c2\u884c\u6709\u6309\u952e\u6309\u4e0b<\/p>\n

\n\t{key_value=key_value_temp &<\/p>\n

\n\t0x2f;<\/p>\n

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

\n\tPin_r_1=1; Pin_r_2=1;Pin_r_3=0;Pin_r_4=1; \/\/\u62c9\u4f4e\u7b2c3\u884c<\/p>\n

\n\tkey_value_temp=read_column\uff08\uff09;\/\/\u8bfb\u5217\u6570\u636e<\/p>\n

\n\tif \uff08key_value_temp \uff01= 0xff\uff09<\/p>\n

\n\t\/\/\u8868\u793a\u7b2c3\u884c\u6709\u6309\u952e\u6309\u4e0b<\/p>\n

\n\t{key_value=key_value_temp &<\/p>\n

\n\t0x3f;<\/p>\n

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

\n\tPin_r_1=1; Pin_r_2=1;Pin_r_3=1;Pin_r_4=0; \/\/\u62c9\u4f4e\u7b2c4\u884c<\/p>\n

\n\tkey_value_temp=read_column\uff08\uff09;\/\/\u8bfb\u5217\u6570\u636e<\/p>\n

\n\tif \uff08key_value_temp \uff01= 0xff\uff09<\/p>\n

\n\t\/\/\u8868\u793a\u7b2c4\u884c\u6709\u6309\u952e\u6309\u4e0b<\/p>\n

\n\t{key_value=key_value_temp &<\/p>\n

\n\t0x4f;<\/p>\n

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

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

\n\t\/\/\uff082\uff09\u8bfb\u53d6\u5217\u7ebf\u6570\u636e<\/p>\n

\n\tunsigned char read_column\uff08\uff09 \/\/\u8bfb\u77e9\u9635\u952e\u76d8\u7684\u5217<\/p>\n

\n\t{unsigned char key_column;<\/p>\n

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

\n\tif\uff08Pin_c_1==0 \uff09 key_column=key_column & 0xfe;<\/p>\n

\n\t\/\/1110<\/p>\n

\n\t\u8868\u793a\u7b2c1\u5217\u6309\u952e\u6309\u4e0b\u3002 key_column\u7684\u4f4e4\u4f4d\u8868\u793a\u6309\u952e\u53f7\uff0c\u9ad84\u4f4d\u5e38\u4e3a1111<\/p>\n

\n\tif\uff08Pin_c_2==0 \uff09 key_column=key_column & 0xfd;<\/p>\n

\n\t\/\/1101<\/p>\n

\n\t\u8868\u793a\u7b2c2\u5217\u6309\u952e\u6309\u4e0b\u3002<\/p>\n

\n\tif\uff08Pin_c_3==0 \uff09 key_column=key_column & 0xfb;<\/p>\n

\n\t\/\/1011<\/p>\n

\n\t\u8868\u793a\u7b2c3\u5217\u6309\u952e\u6309\u4e0b\u3002<\/p>\n

\n\tif\uff08Pin_c_4==0 \uff09 key_column=key_column & 0xf7;<\/p>\n

\n\t\/\/0111<\/p>\n

\n\t\u8868\u793a\u7b2c4\u5217\u6309\u952e\u6309\u4e0b\u3002<\/p>\n

\n\treturn key_column;<\/p>\n

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

\n\t\u4ee5\u4e0a\u7a0b\u5e8f\u5bf9\u5e94\u7684\u952e\u503c\u8868\u5982\u4e0b\uff1a<\/p>\n

\n\t\"51\u5355\u7247\u673a\u5bf9\u77e9\u9635\u952e\u76d8\u5b9e\u73b016\u4e2a\u6309\u952e\u64cd\u4f5c\u7684\u7535\u8def\u8bbe\u8ba1\"<\/p>\n

\n\t\u6700\u540e\u5728\u7a0b\u5e8f\u4e2d\u5904\u7406\u952e\u503c\u8df3\u8f6c\u81f3\u76f8\u5e94\u7684\u64cd\u4f5c\u5373\u53ef\u3002<\/p>\n

\n\t\u6709\u4e00\u4e2a4*4\u77e9\u9635\u952e\u76d8\u7684proteus\u4eff\u771f\u4f8b\u5b50\u5b9e\u73b0\u4e86\u5982\u4e0b\u529f\u80fd\uff1a<\/p>\n

\n\t1\u3001\u5229\u7528\u884c\u626b\u63cf\u6cd5\u8bfb\u53d64x4\u77e9\u9635\u952e\u76d8\u952e\u503c\uff1b<\/p>\n

\n\t2\u3001LCD1602\u4e0a\u663e\u793a\u6309\u4e0b\u7684\u6309\u952e\u503c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u77e9\u9635\u952e\u76d8\u662f \u5355\u7247\u673a \u5916\u90e8\u8bbe\u5907\u4e2d\u6240\u4f7f\u7528\u7684\u6392\u5e03\u7c7b\u4f3c\u4e8e\u77e9\u9635\u7684\u952e\u76d8\u7ec4\u3002\u77e9\u9635\u5f0f\u7ed3\u6784\u7684\u952e\u76d8\u663e\u7136\u6bd4\u76f4\u63a5\u6cd5\u8981\u590d\u6742\u4e00\u4e9b\uff0c\u8bc6\u522b\u4e5f\u8981\u590d\u6742\u4e00\u4e9b\uff0c\u5217\u7ebf\u901a\u8fc7 \u7535\u963b \u63a5\u6b63\u7535\u6e90\uff0c\u5e76\u5c06\u884c\u7ebf\u6240\u63a5\u7684\u5355\u7247\u673a\u7684<\/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\/2731"}],"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=2731"}],"version-history":[{"count":0,"href":"http:\/\/www.szryc.com\/index.php?rest_route=\/wp\/v2\/posts\/2731\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2731"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2731"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}