拉暮式數(shù)碼管顯示
一、設計任務
1、單片機的P0口接在7SEG-MPX8上,P2.0~P2.3口接74LS138的A 、B、C口,Y0~Y7接在數(shù)碼管位選的1~8上。用單片實現(xiàn):數(shù)字1~8從數(shù)碼管的最右邊依次向左邊移動,就像拉幕是一樣。
三、設計程序
//拉暮式顯示數(shù)字1—8
DISP_CNT EQU 30HTCNT EQU 31HORG 00HSJMP STARTORG 0BHLJMP INT_T0START: MOV DISP_CNT,#00HMOV TCNT,#00HMOV P2,#00HMOV TMOD,#01HMOV TH0,#(65536-5000)/256MOV TL0,#(65536-5000)MOD 256MOV IE,#82HSETB TR0DISP: MOV A,DISP_CNTMOV DPTR,#TABLEMOV R0,P2ADD A,R0MOVC A,@A+DPTRMOV P0,ALJMP DISPINT_T0:MOV TH0,#(65536-5000)/256MOV TL0,#(65536-5000)MOD 256INC P2MOV A,P2CJNE A,#08H,RETUNEMOV P2,#00HINC TCNTMOV A,TCNTCJNE A,#10,RETUNEMOV TCNT,#00HINC DISP_CNTCJNE A,#15,RETUNEMOV P2,#00HMOV DISP_CNT,#00HMOV TCNT,#00HRETUNE:RETITABLE: DB 00H,00H,00H,00H,00H,00H,00HDB 06H,5BH,4FH,66H,6DH,7DH,07H,7FHDB 00H,00H,00H,00H,00H,00H,00H,00HEND
評論