問答

LED顯示屏驅(qū)動程序

提問者: lejun2011 2013-02-28 00:00

我用51單片機(jī)系列, 1.用匯編程序 2.P1.0到P1.3接4~16譯碼器,為行輸出 3.P2.0到P2.2接移位寄存器74HC595,為列輸出 4我有16*16顯示屏字模點(diǎn)陣 誰能用匯編弄出驅(qū)動程序,謝謝了,說的具體點(diǎn),很滿意可多給分

最佳答案

網(wǎng)上有。 ORG 0000H A1 EQU 20H ;用A1代替直接尋址單元20H A2 EQU 21H A3 EQU 22H A4 EQU 23H A5 EQU 24H ;代表字的碼表 A6 EQU 25H ;代表要顯示字的個數(shù) START: MOV P1,#00H ;初始化 MOV P0,#00H MOV P2,#00H MOV A1,#00H MOV A2,#00H MOV A3,#00H MOV A4,#00H MOV A5,#00H MOV A6,#00H MOV A1,#0FFH MOV A2,#00H MOV R4,#01H ;為遁環(huán)次數(shù) START1: MOV P0,A1 ;此子程序?yàn)闇y試程序,測試模塊有沒有壞點(diǎn) MOV P2,A1 MOV P1,A2 LCALL DELAY125 MOV A,A1 RL A MOV A1,A INC A2 MOV A,A2 CJNE A,#10H,START1 ;跑完16列后執(zhí)行至顯示中文文字程序! MOV A2,#00H START3: MOV A1,#00H ;初始化條件 MOV A3,#00H MOV P0,#00H MOV P1,#00H MOV P2,#00H MOV A6,#1 MOV A5,#0 ACALL DELAY1S ;1S不秒顯示! ZHONG1: MOV R3,#02H ;R3與R4為顯示字的時間的參數(shù),越大則顯示的字越久!=R3*R4 ZY6: MOV R4,#3FH ZY2: AJMP TJ1 ;跳至選字的碼程序! MAIN1: NOP ;空操作 MAIN2: MOV A,A3 MOVC A,@A+DPTR ;讀取程序中字的碼,上半部分! MOV P0,A INC A3 MOV A,A3 MOVC A,@A+DPTR ;讀取程序中字的碼,下半部分! MOV P2,A MOV P1,A1 LCALL DELAY5 ;延時5MS后再返回取下一個字的碼! INC A3 INC A1 MOV A,A1 CJNE A,#0FH,MAIN2 MOV A1,#0 MOV A3,#0 DJNZ R4,ZY2 DJNZ R3,ZY6 INC A5 INC A6 LCALL DELAY125 MOV A,A6 CJNE A,#8,ZHONG1 ;一共顯示6個字后馬上返回(7-1=6) LCALL DELAY1S ;顯示完后延時1S AJMP START3 ;無條件跳轉(zhuǎn)至開始條件,從新開始 TJ1: MOV A,A6 ;顯示第一個字,則A6等于1,第二個字A6等于2,如此類推! CJNE A,#1,TJ2 MOV DPTR,#TAB1 ZY1: MOV A,A5 ;附加程序,主要用來程序擴(kuò)展!比如說四個LED的程序! MOV B,#2 DIV AB MOV A,B CJNE A,#0,MAIN1 AJMP MAIN1 TJ2: CJNE A,#2,TJ3 MOV DPTR,#TAB2 AJMP ZY1 TJ3: CJNE A,#3,TJ4 MOV DPTR,#TAB3 AJMP ZY1 TJ4: CJNE A,#4,TJ5 MOV DPTR,#TAB4 AJMP ZY1 TJ5: CJNE A,#5,TJ6 MOV DPTR,#TAB5 AJMP ZY1 TJ6: CJNE A,#6,TJ7 MOV DPTR,#TAB6 AJMP ZY1 TJ7: CJNE A,#6,TJ8 MOV DPTR,#TAB7 AJMP ZY1 TJ8: AJMP START3 ;程序跳轉(zhuǎn)返回 DELAY125: MOV R7,#0FFH ;125MS延時,用顯示字的間隔 D1: MOV R6,#0FFH DJNZ R6,$ DJNZ R7,D1 RET DELAY1S: MOV R7,#08H ;1S延時 D2: MOV R6,#0FFH D3: MOV R5,#0FFH DJNZ R5,$ DJNZ R6,D3 DJNZ R7,D2 RET DELAY5: MOV R7,#2 ;5MS延時,用于列掃描的時間 D4: MOV R6,#09FH DJNZ R6,$ DJNZ R7,D4 RET TAB1: DB 02H,00H,04H,00H,1FH,0FFH,0E0H,00H ;你 DB 02H,00H,04H,10H,18H,20H,0F0H,0C2H DB 10H,01H,13H,0FEH,10H,00H,10H,80H DB 14H,60H,18H,30H,00H,00H,00H,00H TAB2: DB 08H,02H,08H,44H,0FH,0A8H,0F8H,10H ;好 DB 08H,28H,0FH,0C6H,01H,00H,41H,00H DB 41H,02H,41H,01H,47H,0FEH,49H,00H DB 51H,00H,63H,00H,01H,00H,00H,00H TAB3: DB 20H,08H,2CH,10H,23H,60H,20H,80H ;歡 DB 23H,41H,3CH,31H,04H,02H,08H,0CH DB 0F0H,30H,17H,0C0H,10H,30H,10H,08H DB 14H,06H,18H,03H,00H,02H,00H,00H TAB4: DB 02H,00H,42H,02H,22H,04H,13H,0F8H ;迎 DB 00H,04H,3FH,0E2H,20H,42H,40H,82H DB 41H,02H,3FH,0FEH,20H,02H,20H,42H DB 20H,22H,7FH,0C6H,20H,04H,00H,00H TAB5: DB 02H,00H,02H,01H,42H,02H,22H,04H ;光 DB 1AH,18H,03H,0E0H,02H,00H,0FEH,00H DB 02H,00H,03H,0FCH,0AH,02H,12H,02H DB 62H,02H,26H,02H,02H,0EH,00H,00H TAB6: DB 00H,00H,3FH,0F8H,00H,00H,0FFH,0FFH ;臨 DB 02H,00H,04H,0FFH,08H,82H,30H,82H DB 0D4H,82H,12H,0FEH,13H,82H,10H,82H DB 10H,82H,31H,0FFH,10H,80H,00H,00H TAB7: DB 00H,00H,00H,00H,00H,00H,00H,00H ;空的字 DB 00H,00H,00H,00H,00H,0H,00H,00H DB 00H,00H,00H,00H,00H,00H,00H,00H DB 00H,00H,00H,00H,00H,00H,00H,00H END

回答者:在路上ko2016-02-28 00:00

相關(guān)問題

車友關(guān)注

最新標(biāo)簽

按字母分類:
ABCDEFGHIJKLMNOPQRSTWXYZ0-9