{"id":1723,"date":"2018-12-12T01:22:23","date_gmt":"2018-12-12T01:22:23","guid":{"rendered":""},"modified":"2018-12-12T09:22:41","modified_gmt":"2018-12-12T01:22:41","slug":"%e4%b8%b2%e8%a1%8cled%e6%98%be%e7%a4%ba%e7%94%b5%e8%b7%af%e8%ae%be%e8%ae%a1","status":"publish","type":"post","link":"http:\/\/www.szryc.com\/?p=1723","title":{"rendered":"\u4e32\u884cLED\u663e\u793a\u7535\u8def\u8bbe\u8ba1"},"content":{"rendered":"
\n\t\u5728\u5355\u7247\u673a\u7cfb\u7edf\u8bbe\u8ba1\u4e2d\uff0cLED\u663e\u793a\u65b9\u5f0f\u7531\u4e8e\u5177\u6709\u4f7f\u7528\u65b9\u4fbf\u3001\u4ef7\u683c\u4f4e\u5ec9\u7b49\u4f18\u70b9\u800c\u5f97\u5230\u5e7f\u6cdb\u5e94\u7528\u3002\u5728\u91c7\u7528\u5e76\u884c\u663e\u793a\u65b9\u5f0f\u65f6\uff0c\u663e\u793a\u7535\u8def\u7684\u6bb5\u7801\u4e0e\u4f4d\u63a7\u7801\u8981\u5360\u7528\u5355\u7247\u673a\u7684\u8f83\u591a\u53e3\u7ebf\uff0c\u5c3d\u7ba1\u53ef\u91c7\u75288155\u7b49\u63a5\u53e3\u82af\u7247\u8fdb\u884c\u6269\u5c55\uff0c\u4f46\u53e3\u7ebf\u5229\u7528\u7387\u4ecd\u8f83\u4f4e\uff0c\u4e0d\u80fd\u6ee1\u8db3\u5927\u578b\u63a7\u5236\u7cfb\u7edf\u7684\u8981\u6c42\u3002\u91c7\u7528\u4e32\u884c\u663e\u793a\u65b9\u5f0f\u5219\u53ea\u9700\u5360\u75282\u81f33\u6839\u53e3\u7ebf\uff0c\u8282\u7ea6\u5355\u7247\u673a\u5927\u91cf\u7684I\/O\u7ebf\uff0c\u4e14\u4f7f\u7528\u6548\u679c\u5f88\u597d\u3002\u672c\u4efb\u52a1\u5229\u752874HC595A\u5b9e\u73b0\u591a\u4f4dLED\u4e32\u884c\u663e\u793a\u3002<\/p>\n
\n\t <\/p>\n
\n\t74HC595\u82af\u7247<\/p>\n
\n\t1.74HC595A\u5de5\u4f5c\u539f\u7406<\/p>\n
\n\t74HC595A\u5185\u90e8\u542b\u67098\u4f4d\u79fb\u4f4d\u5bc4\u5b58\u5668\u548c8\u4f4dD\u9501\u5b58\u5668\uff0c\u5185\u90e8\u7ed3\u6784\u89c1\u56fe\u6240\u793a\u3002<\/p>\n
\n\t <\/p>\n
\n\t74HC595A\u5185\u90e8\u903b\u8f91\u7ed3\u6784<\/p>\n
\n\t <\/p>\n
\n\t74HC595\u4e0e\u6570\u7801\u7ba1\u8fde\u63a5<\/p>\n
\n\t\u4e32\u884c\u79fb\u4f4d\u5bc4\u5b58\u5668\u63a5\u6536\u5916\u90e8\u8f93\u5165\u4e32\u884c\u6570\u636e\uff0c\u4e00\u65b9\u9762\u53ef\u8fdb\u884c\u4e32\u884c\u6570\u636e\u8f93\u51fa\uff0c\u540c\u65f6\u5411\u9501\u5b58\u5668\u63d0\u4f9b8\u4f4d\u5e76\u884c\u8f93\u5165\u6570\u636e\uff0c\u5e76\u5177\u6709\u5f02\u6b65\u590d\u4f4d\u529f\u80fd;8\u4f4d\u9501\u5b58\u5668\u53ef\u4e09\u6001\u8f93\u51fa\u5e76\u884c\u6570\u636e\u3002\u8be5\u82af\u7247\u5177\u6709\u4e32\u884c\u8f93\u5165\u3001\u5e76\u884c\u8f93\u51fa\u4e24\u4e2a\u72ec\u7acb\u7684\u65f6\u949f\u4fe1\u53f7\u3002<\/p>\n
\n\t <\/p>\n
\n\t74HC595A\u903b\u8f91\u529f\u80fd\u8868<\/p>\n
\n\t\u6ce8\uff1aU\uff1a\u4e0d\u53d8;N\uff1a\u6570\u636e\u5237\u65b0;Z\uff1a\u9ad8\u963b\u3002<\/p>\n
\n\t2.\u5e94\u7528\u7535\u8def\u8bbe\u8ba1<\/p>\n
\n\t\u4e0b\u56fe\u4e3a12\u4f4dLED\u663e\u793a\u5668\u5e94\u7528\u7535\u8def\u3002\u82e5\u91c7\u7528\u666e\u901a\u7684LED\u5e76\u884c\u663e\u793a\u65b9\u5f0f\u9700\u6269\u5c55\u5355\u7247\u673a\u63a5\u53e3\uff0c\u7535\u8def\u590d\u6742\u3001\u6210\u672c\u9ad8\u3002\u672c\u7cfb\u7edf\u5229\u7528\u4e09\u724774HC595A\u82af\u7247\u5b9e\u73b012\u4f4d\u4e32\u884cLED\u663e\u793a\u63a7\u5236\u3002\u4f7f\u7528\u65f6\uff0c\u5728\u4e32\u884c\u65f6\u949f\u7684\u63a7\u5236\u4e0b\uff0c\u53ef\u5c06\u663e\u793a\u5668\u4f4d\u63a7\u7801\u4e0e\u6bb5\u63a7\u7801\u9010\u4f4d\u4e32\u884c\u8f93\u5165\u81f3\u4e09\u4e2a\u82af\u7247\u4e2d\uff0c\u7136\u540e\u5229\u7528\u9501\u5b58\u4fe1\u53f7\u5b9e\u73b0\u5e76\u884c\u8f93\u51fa\uff0c\u5b8c\u621012\u6570\u6570\u7801\u663e\u793a\u66f4\u65b0\u3002\u5229\u7528\u6b64\u663e\u793a\u65b9\u5f0f\u4ec5\u5360\u7528\u5355\u7247\u673a\u4e09\u6839\u53e3\u7ebf\uff0c\u6781\u5927\u8282\u7ea6\u5355\u7247\u673a\u53e3\u7ebf\u8d44\u6e90\u3002\u91c7\u7528\u4e32\u884c\u6570\u636e\u8f93\u5165\uff0c\u663e\u793a\u901f\u5ea6\u76f8\u5bf9\u8f83\u6162\uff0c\u5b9e\u9645\u4f7f\u7528\u65f6\u663e\u793a\u6548\u679c\u7a33\u5b9a\u3001\u53ef\u9760\uff0c\u5b8c\u5168\u6ee1\u8db3\u8bbe\u8ba1\u8981\u6c42\u3002<\/p>\n
\n\t <\/p>\n
\n\t12\u4f4dLED\u4e32\u884c\u663e\u793a\u5e94\u7528\u7535\u8def<\/p>\n
\n\t\u521d\u59cb\u4f4d\u63a7\u7801\u8bbe\u5b9a\u4e3a\u663e\u793a\u7b2c\u4e00\u4f4d\u6570\u7801\u7ba1(\u5171\u9634\u6781)\uff0c\u89c1\u4e0b\u8868\u7b2c\u4e00\u884c\u4f4d\u63a7\u7801\u3002\u6bcf\u663e\u793a\u5b8c\u4e00\u4f4d\uff0c\u9700\u8981\u6539\u53d8\u4f4d\u63a7\u7801\u4ee5\u663e\u793a\u4e0b\u4e00\u4f4d\uff0c\u4e0b\u8868\u53cd\u6620\u4e86\u4f4d\u63a7\u7801\u7684\u53d8\u5316\u60c5\u51b5\u30021\u533a\u5bc4\u5b58\u5668R6\u3001R7\u7528\u4e8e\u5b58\u653e\u5904\u7406\u4f4d\u63a7\u7801\u3002<\/p>\n
\n\t <\/p>\n
\n\t12\u4f4dLED\u663e\u793a\u5668\u4f4d\u63a7\u7801\u5f62\u6210\u793a\u610f\u56fe<\/p>\n
\n\t3. \u663e\u793a\u7a0b\u5e8f\u5de5\u4f5c\u65b9\u5f0f<\/p>\n
\n\t\u672c\u7a0b\u5e8f\u91c7\u7528\u5b9a\u65f6\u65b9\u5f0f\u63a7\u5236\u663e\u793a\u5668\u5de5\u4f5c\u300212\u4f4d\u663e\u793a\u5668\u91c7\u7528\u52a8\u6001\u626b\u63cf\u663e\u793a\uff0c\u6bcf\u4f4d\u663e\u793a\u5668\u663e\u793a\u65f6\u95f4\u5927\u7ea6\u4e3a1.67ms\uff0c\u7531\u5b9a\u65f6\u5668T0\u63a7\u5236\u3002T0\u5b9a\u65f6\u65f6\u95f4\u5230\u4ea7\u751f\u663e\u793a\u4e2d\u65ad\uff0c\u8fdb\u5165\u663e\u793a\u4e2d\u65ad\u7a0b\u5e8f\u663e\u793a\u4e0b\u4e00\u4f4d\u6570\u636e\u3002\u8fd9\u79cd\u663e\u793a\u65b9\u5f0f\u53ef\u63d0\u9ad8CPU\u7684\u5de5\u4f5c\u6548\u7387\uff0c\u53ef\u51c6\u786e\u63a7\u5236\u663e\u793a\u5668\u7684\u5237\u65b0\u901f\u5ea6\u3002<\/p>\n
\n\t4.\u4e2d\u65ad\u663e\u793a\u5b50\u7a0b\u5e8f\u5e94\u7528<\/p>\n
\n\t\u7f16\u5236\u4e00\u7a0b\u5e8f\uff0c\u572812\u4f4d\u6570\u7801\u7ba1\u4e0a\u4f9d\u6b21\u663e\u793a0\u30011\u30012\u30013\u30014\u30015\u30016\u30017\u30018\u30019\u30010\u30011<\/p>\n
\n\tORG 0000H<\/p>\n
\n\tDSDATE BIT P1.0 ;\u4e32\u884c\u6570\u636e\u8f93\u5165<\/p>\n
\n\tDSCLK BIT P1.1 ;\u4e32\u884c\u79fb\u4f4d\u65f6\u949f<\/p>\n
\n\tDSLUCK BIT P1.2 ;\u5e76\u884c\u9501\u5b58\u65f6\u949f<\/p>\n
\n\tDISBUF EQU 51H ;\u663e\u793a\u7f13\u51b2\u533a\u9996\u5740<\/p>\n
\n\tDS20 EQU 34H ;20ms\u5b9a\u65f6\u5bc4\u5b58\u5668(12\u4f4d\u663e\u793a\u8ba1\u6570\u5668)<\/p>\n
\n\tLJMP MAIN ;\u8f6c\u4e3b\u7a0b\u5e8f<\/p>\n
\n\tORG 000BH<\/p>\n
\n\tLJMP TIMINT ;\u8f6c\u5b9a\u65f6\u663e\u793a\u4e2d\u65ad\u5b50\u7a0b\u5e8f<\/p>\n
\n\tMAIN: MOV SP,#70H ;\u7f6e\u690e\u6808\u6307\u9488<\/p>\n
\n\tMOV 51H,#00H ;\u9884\u7f6e\u663e\u793a\u7f13\u51b2\u533a<\/p>\n
\n\tMOV 52H,#01H<\/p>\n
\n\tMOV 53H,#02H<\/p>\n
\n\tMOV 54H,#03H<\/p>\n
\n\tMOV 55H,#04H<\/p>\n
\n\tMOV 56H,#05H<\/p>\n
\n\tMOV 57H,#06H<\/p>\n
\n\tMOV 58H,#07H<\/p>\n
\n\tMOV 59H,#08H<\/p>\n
\n\tMOV 5AH,#09H<\/p>\n
\n\tMOV 5BH,#00H<\/p>\n
\n\tMOV 5CH,#01H<\/p>\n
\n\tMOV 08H,#DISBUF ;1\u533aR0\u6307\u5411\u663e\u793a\u7f13\u51b2\u533a\u9996\u5740<\/p>\n
\n\tMOV 0EH,#07H ;\u7f6e\u521d\u59cb\u4f4d\u63a7\u7801(1\u533aR6)<\/p>\n
\n\tMOV 0FH,#0FFH ;\u7f6e\u521d\u59cb\u4f4d\u63a7\u7801(1\u533aR7)<\/p>\n
\n\tMOV TMOD,#01H ;\u7f6eT0\u4e3a1.67ms\u5b9a\u65f6\u5668<\/p>\n
\n\tMOV TL0,#00H<\/p>\n
\n\tMOV TH0,#0FAH<\/p>\n
\n\tMOV DS20,#12 ;\u7f6e\u663e\u793a\u4f4d\u6570\u8ba1\u6570\u5668<\/p>\n
\n\tSETB TR0 ;\u542f\u52a8T0<\/p>\n
\n\tSETB EA ;\u5f00\u4e2d\u65ad<\/p>\n
\n\tSETB ET0 ;\u5f00T0\u4e2d\u65ad<\/p>\n
\n\tHERE: SJMP HERE<\/p>\n
\n\tTIMINT: PUSH PSW ;\u5b9a\u65f6\u663e\u793a\u4e2d\u65ad\u5b50\u7a0b\u5e8f\uff0c\u72b6\u6001\u5b57\u8fdb\u6808<\/p>\n
\n\tMOV PSW,#08H ;\u91cd\u7f6e\u72b6\u6001\u5b57\uff0c\u9009\u62e91\u533a\u5de5\u4f5c\u5bc4\u5b58\u5668<\/p>\n
\n\tPUSH ACC ;\u7d2f\u52a0\u5668\u8fdb\u6808<\/p>\n
\n\tPUSH B ;B\u5bc4\u5b58\u5668\u8fdb\u6808<\/p>\n
\n\tCLR TR0 ;\u505c\u6b62T0\u5b9a\u65f6<\/p>\n
\n\tMOV TH0,#0FAH ;\u91cd\u7f6e1.67ms\u5b9a\u65f6\u521d\u503c<\/p>\n
\n\tMOV TL0,#00H<\/p>\n
\n\tSETB TR0 ;\u542f\u52a8T0\u5b9a\u65f6<\/p>\n
\n\tMOV R5,0FH ;\u4f4d\u63a7\u7801\u9001R4\u3001R5<\/p>\n
\n\tMOV R4,0EH<\/p>\n
\n\tLCALL DIS1 ;\u8c03\u7528\u663e\u793a\u4e00\u4f4d\u6570\u7801\u7ba1\u5b50\u7a0b\u5e8f<\/p>\n
\n\tSETB C ;\u5f62\u6210\u663e\u793a\u4e0b\u4e00\u4f4d\u4f4d\u63a7\u7801\u5e76\u7f6e\u4e8e1\u533aR6\u3001R7\u4e2d<\/p>\n
\n\tMOV A,R6<\/p>\n
\n\tSETB ACC.4<\/p>\n
\n\tRRC A<\/p>\n
\n\tMOV R6,A<\/p>\n
\n\tMOV A,R7<\/p>\n
\n\tRRC A<\/p>\n
\n\tMOV R7,A<\/p>\n
\n\tDJNZ DS20,LOOP1 ;12\u4f4d\u663e\u793a\u5b8c\u4e86\u5426\uff0c\u6ca1\u5b8c\u9000\u51fa\uff0c\u82e5\u663e\u793a\u5b8c\u91cd\u7f6e<\/p>\n
\n\tMOV DS20,#12 ;\u91cd\u7f6e\u663e\u793a\u8ba1\u6570\u5668<\/p>\n
\n\tMOV R0,#DISBUF ;\u91cd\u7f6e\u663e\u793a\u7f13\u51b2\u533a\u6307\u9488<\/p>\n
\n\tMOV R7,#0FFH ;\u91cd\u7f6e\u521d\u59cb\u4f4d\u63a7\u7801<\/p>\n
\n\tMOV R6,#07H<\/p>\n
\n\tLOOP1: POP B ;\u6062\u590d\u73b0\u573a<\/p>\n
\n\tPOP ACC<\/p>\n
\n\tPOP PSW<\/p>\n
\n\tRETI ;\u4e2d\u65ad\u8fd4\u56de<\/p>\n
\n\tDIS1: MOV DPTR,#TAB ;\u663e\u793a\u4e00\u4f4d\u6570\u7801\u7ba1\u5b50\u7a0b\u5e8f\uff0c\u6307\u5411\u6bb5\u7801\u8868<\/p>\n
\n\tMOV A,@R0 ;\u53d6\u5f85\u663e\u793a\u5b57\u7b26\u6570\u636e<\/p>\n
\n\tINC R0 ;\u4fee\u6539\u7f13\u51b2\u533a\u6307\u9488<\/p>\n
\n\tMOVC A,@A+DPTR ;\u67e5\u8868\u53d6\u663e\u793a\u5b57\u7b26\u6bb5\u7801<\/p>\n
\n\tMOV R3,A ;\u5c06\u6bb5\u7801\u4e0e\u4f4d\u63a7\u7801\u7ec4\u5408\u621020\u4f4d\u6709\u6548\u4e32\u884c\u7801<\/p>\n
\n\tMOV R1,#0CH ;20\u4f4d\u6709\u6548\u4e32\u884c\u7801\u7f6e\u4e8eR3\u3001R4\u3001R5\u4e2d<\/p>\n
\n\tMOV A,@R1<\/p>\n
\n\tSWAP A<\/p>\n
\n\tMOV @R1,A<\/p>\n
\n\tMOV A,R3<\/p>\n
\n\tXCHD A,@R1<\/p>\n
\n\tMOV A,@R1<\/p>\n
\n\tSWAP A<\/p>\n
\n\tMOV @R1,A<\/p>\n
\n\tMOV A,R3<\/p>\n
\n\tSWAP A<\/p>\n
\n\tMOV R3,A<\/p>\n
\n\tMOV R1,#20 ;\u7f6e\u4e32\u884c\u8f93\u51fa\u8ba1\u6570\u5668<\/p>\n
\n\tDIS0: MOV A,R3 ;R3\u3001R4\u3001R5\u4e32\u884c\u79fb\u4f4d\uff0c\u7531R5\u9ad8\u4f4d\u8f93\u51fa\u3002<\/p>\n
\n\tRRC A<\/p>\n
\n\tMOV R3,A<\/p>\n
\n\tMOV A,R4<\/p>\n
\n\tRRC A<\/p>\n
\n\tMOV R4,A<\/p>\n
\n\tMOV A,R5<\/p>\n
\n\tRRC A<\/p>\n
\n\tMOV R5,A<\/p>\n
\n\tMOV DSDATE,C ;\u6700\u9ad8\u4f4d\u9001\u81f3595\u82af\u7247\u4e32\u884c\u8f93\u5165\u7aef<\/p>\n
\n\tSETB DSCLK ;\u4ea7\u751f595\u82af\u7247\u4e32\u884c\u8f93\u5165\u4fe1\u53f7<\/p>\n
\n\tNOP<\/p>\n
\n\tCLR DSCLK ;\u4e32\u884c\u8f93\u5165\u9501\u5b58<\/p>\n
\n\tDJNZ R1,DIS0 ;20\u4f4d\u4e8c\u8fdb\u7801\u8f93\u51fa\u5b8c\u5426\uff0c\u6ca1\u5b8c\u7ee7\u7eed<\/p>\n
\n\tSETB DSLUCK ;\u4ea7\u751f595\u82af\u7247\u5e76\u884c\u8f93\u51fa\u4fe1\u53f7\uff0c\u5b57\u7b26\u5f00\u59cb\u663e\u793a<\/p>\n
\n\tNOP<\/p>\n
\n\tCLR DSLUCK ;\u8f93\u51fa\u5b57\u7b26\u6570\u636e\u7531595\u82af\u7247\u9501\u5b58<\/p>\n
\n\tRET<\/p>\n
\n\tTAB: DB 3FH,06H,5BH ;\u663e\u793a\u6bb5\u7801\u8868<\/p>\n
\n\tDB 4FH,66H,6DH<\/p>\n
\n\tDB 7DH,07H,7FH<\/p>\n
\n\tDB 6FH,00H,40H<\/p>\n
\n\tEND<\/p>\n","protected":false},"excerpt":{"rendered":"
\u5728\u5355\u7247\u673a\u7cfb\u7edf\u8bbe\u8ba1\u4e2d\uff0cLED\u663e\u793a\u65b9\u5f0f\u7531\u4e8e\u5177\u6709\u4f7f\u7528\u65b9\u4fbf\u3001\u4ef7\u683c\u4f4e\u5ec9\u7b49\u4f18\u70b9\u800c\u5f97\u5230\u5e7f\u6cdb\u5e94\u7528\u3002\u5728\u91c7\u7528\u5e76\u884c\u663e\u793a\u65b9\u5f0f\u65f6\uff0c\u663e\u793a\u7535\u8def\u7684\u6bb5\u7801\u4e0e\u4f4d\u63a7\u7801\u8981\u5360\u7528\u5355\u7247\u673a\u7684\u8f83\u591a\u53e3\u7ebf\uff0c\u5c3d\u7ba1\u53ef\u91c7\u75288155\u7b49\u63a5<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"_links":{"self":[{"href":"http:\/\/www.szryc.com\/index.php?rest_route=\/wp\/v2\/posts\/1723"}],"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=1723"}],"version-history":[{"count":0,"href":"http:\/\/www.szryc.com\/index.php?rest_route=\/wp\/v2\/posts\/1723\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1723"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1723"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1723"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}