Вы находитесь на странице: 1из 4

39 Decoder (9+0 - Corresponds to HT6026)

39 Decoder (9+0 - Corresponds to HT6026)


D/N: HA0062E

Introduction
This application shows how to use the HT48R50A-1 to simulate the decoder function to decode the 3 Address bits and 0 Data bits of the HT6026.
9

Function and Theory


The 3 Decoder function can encode the 9 Address bits and 0 Data bits into one of three states, 1, 0 or floating. MCU: HT48R50A-1 Method: Owing to the higher coding frequency of the 3 Encoder and the reason that the program cannot provide interrupts for sampling at each short intervals, the SWIP uses the external timer mode with an initial value of FFH or FFFFH. When the TMR pin has a rising edge, the timer will overflow and the timer interrupt routine is executed. There are signal flags that will change the timer to the internal time mode. The initial value of the timer will be reset and generate an interrupt every 111s (this value will enable the decorder to tolerate a coding deviation of up to 40%) and will then jump out of the interrupt. After 111s the program will generate an interrupt and sample signals and store the level status of the pin. Then set the timer into the external timer mode with an initial value of FFH or FFFFH and jump out of the interrupt. Thus data signals to the pins will be recorded completely for decoding.
9 9

39 Decoder (9+0 - Corresponds to HT6026)


Pin Function: PB0~PB7: Address input pins PC0: Address input pins PA5: Serial data input pin PD4: Valid transmission pin TMR0: Trigger pin Software IP: 3 _9+0 Decoder Subroutine Usage Description Table IP Name (label) 3 _9+0D
9 9

System Resources Function MCU ROM RAM

Functional Description Decode 9 bits of information from the 3 Encoder HT48R50A-1 174
9

8 Bytes: BITCOUNTER COUNTER ADD_RES1 ADD_RES0 WORDCNT DECODER_CODE[2] DECODER_CODE[1] DECODER_CODE[0]

5 Bits: CODE_IN_FLAG DECODER_FLAG DECODER_EN MATCHBIT VTBIT

Stack Subroutine/Macro I/O lines

1 level used Subroutine 11 I/O lines PB0~PB7: input pins(I/O), non-pull high PC0: input pins(I/O), non-pull high PD4: output pin(I/O), pull high PA5: input pin(I/O), pull high 8MHz RC TMR INTERUPT, TMR Pin Set address pins CALL DECODER_INITIAL

fSYS Other MCU resources User interface

39 Decoder (9+0 - Corresponds to HT6026)

Program Flowchart
ENTER IN TMR INT A N TIMEBEGIN CODE_IN_FLAG=0? Y SET CODE_IN_FLAG N STOPTIME RETURN TO MAIN BITCOUNTER=0? Y Clean up data SET TMR INTERNAL MODE BITCOUNTER=18 TIMEBEGIN N Clear T0F B Read 9-bit address Clear VT pin RETURN TO MAIN Match with receives ? RETURN TO MAIN Clear VT pin and VTBIT BITCOUNTER Decrease 1 Set DECODER_FLAG C

INITIAL TMR

VTBIT=0? Y SET VT PIN

Clear DECODER_CODE

CLEAR CODE_IN_FLAG

Y Clear DECODER_CODE WORDCNT=02

STOPTIMR WORDCNT=0? N SET TMR EXTERNAL MODE N MATCHBIT=0? Y N DECODERPIN=0 Y CLEAR C RETURN TO MAIN SET C WORDCNT=1? Y Set MATCHBIT C Clear ADD_RES1,ADD_RES0 Y C Clear DECODER_FLAG, and MATCHBIT

INITIAL TMR

SET VTBIT

RETURN TO MAIN

SAVE DATA TO DECODER_CODE

TIMEBEGIN

39 Decoder (9+0 - Corresponds to HT6026)

Program Description
Refer to the ASM file that contains one main program code file for users to follow and add their own programs. Users need to add the INCLUDE 9+10.ASM and MAIN.ASM files to their project. The ASM text file includes DEFINE.ASM, INTERUPT.ASM, STDUC.ASM, MEMORY.ASM and MACRO.ASM files that should be added in the project.

Вам также может понравиться