Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 4.4 指撥開關與單顆七段 當 DIP 為 ON 輸入接腳為 LOW 當 DIP 為 OFF 輸入接腳為 HIGH.

Similar presentations


Presentation on theme: "1 4.4 指撥開關與單顆七段 當 DIP 為 ON 輸入接腳為 LOW 當 DIP 為 OFF 輸入接腳為 HIGH."— Presentation transcript:

1 1 4.4 指撥開關與單顆七段 當 DIP 為 ON 輸入接腳為 LOW 當 DIP 為 OFF 輸入接腳為 HIGH

2 2 共陰極七段顯示器 C ommon Cathod 以指撥開關控制七段顯示器速度 (0-9) 查表法 HT46R23 接腳 VDD(20) RES(19) OSC1(21) OSC2(22) VSS(11) 指撥開關 PA0-PA7(6,5,4,3,26,25,24,23) 七段顯示器 PB0-PB7(10,9,8,7,2,1,28,27) 指撥開關 on 輸入接腳 off PA 有 PULL-HIGH 功能 (40K-80K)

3 3 4.4 #INCLUDEHT46R23.INC.CHIPHT46R23 MY_DATA.SECTION'DATA' DEL1 DB ? ;DELAY LOOP COUNT 1 DEL2 DB ? ;DELAY LOOP COUNT 2 DEL3DB ? ;DELAY LOOP COUNT 3 COUNTDB ? SEG_PORTEQUPB ;DEFINE 7-SEG PORT SEG_PORTCEQUPBC ;DEFINE 7-SEG PORT CONTROL REG. DIP_PORT EQUPA ;DEFINE DIP PORT DIP_PORTC EQUPAC ;DEFINE DIP PORT CONTROL REG. MY_CODE.SECTIONAT 0 'CODE' ;== PROGRAM SECTION == ORG 00H ;HT-46RXX RESET VECTOR SETDIP_PORTC ;CONFIG DIP_PORT AS INPUT MODE CLRSEG_PORTC ;CONFIG SEG_PORT AS OUTPUT MODE MAIN: MOVA,OFFSET TAB_7_SEG MOVTBLP,A ;INITIAL POINTER START ADDRESS

4 4 MOVA,10 MOVCOUNT,A;SET DATA COUNT OF TAB_7_SEG LOOP: TABRDLSEG_PORT;READ TABLE AND SEND TO SEG_PORT MOVA,DIP_PORT;GET DELAY FACTOR FROM DIP_SW MOVDEL1,A;SET DELAY FACTOR CALL DELAY;DELAY DIP_PORT*10mS INCTBLP;UPDATE TABLE POINTER SDZCOUNT;COUNT DOWN BY 1 JMPLOOP;JUMP IF NOT TABLE END JMPMAIN ;RESTART DELAY PROC MOV A,30 MOV DEL2,A;SET DEL2 COUNTER DEL_2:MOVA,110 MOVDEL3,A;SET DEL3 COUNTER DEL_3: SDZ DEL3 ;DEL3 DOWN COUNT JMP DEL_3 SDZ DEL2 ;DEL2 DOWN COUNT JMP DEL_2 SDZDEL1;DEL1 DOWN COUNT JMPDELAY RET DELAYENDP

5 5 ORGLASTPAGE TAB_7_SEG: DC ;7 SEG CODE FOR COMMOM CATHOD LED DC ;CONNECT BIT 0~7 FOR SEGMENT A~H DC ;LOW-BYTE FOR 7 SEG DISPLAY CODE DC ;HIGH 7 BITs FOR DELAY FACTOR DC DC DC DC DC DC END


Download ppt "1 4.4 指撥開關與單顆七段 當 DIP 為 ON 輸入接腳為 LOW 當 DIP 為 OFF 輸入接腳為 HIGH."

Similar presentations


Ads by Google