HOLTEK HA0064E

312 Decoder (10+2 - Corresponds to HT6010/HT6012)
312 Decoder (10+2 - Corresponds to
HT6010/HT6012)
D/N: HA0064E
Introduction
12
This application shows how to use the HT48R50A-1 to simulate the HT6032 3
decoder
function to decode the 10 Address bits and 2 Data bits for the HT6010/HT6012.
Function and Theory
12
The 3 Decoder function can decode the 10 Address bits and 2 Data bits each of which
can be set individually to either ″1″ and ″0″.
MCU: HT48R50A-1
Method: uses the HT6032 decoding process (see the HT6032 datasheet) to check the
corresponding signal width to judge if the signal is either a ″0″, ″1″ or ″floating″. The
corresponding width can decode skewed signals, the tolerance of which can be adjusted
by MAXDURATION in the program.
Pin Function:
PB0~PB7: Address input pins
PC0~PC1: Address input pins
PD2~PD3: Data output pins
PA5: Serial data input pin
PD4: Valid transmission pin
1
312 Decoder (10+2 - Corresponds to HT6010/HT6012)
12
Software IP: 3 _10+2 Decoder Subroutine Usage Description Table
IP Name
(Label)
System Resources
Functional Description
12
12
3 _10+2D Function
Decode 12 bits of information from the 3 Encoder
MCU
HT48R50A-1
ROM
213
RAM
15 Bytes: ″HI_COUNT″ ″LO_COUNT″
″HI_COUNT_SAVE″
″LO_COUNT_SAVE″ ″BITCOUNTER″
″DATARES″ ″ADD_RES2″
″ADD_RES1″ ″ADD_RES0″
″WORDCNT″ ″VTCOUNT1″
″VTCOUNT0″ ″DECODER_CODE[2]″
″DECODER_CODE[1]″
″DECODER_CODE[0]″
、
、
、
、
、
、
、
、
、
、
、
、
、
、
、
、
5 Bits: ″DECODER_EN″ ″DECODER_FLAG″
″DECODER_STATUS″ ″MATCHBIT″
″VTBIT″
、
Stack
1 level used
Subroutine/Macro
Subroutine
I/O lines
14 I/O lines
PB0~PB7: input pins(I/O), non-pull high
PC0~PC1: input pins(I/O), non-pull high
PD2~PD4: output pin(I/O), pull high
PA5: input pin(I/O), pull high
fSYS
8MHz RC
Other MCU resources
TMR INTERUPT
User interface
Set address pins
CALL DECODER_INITIAL
2
、
312 Decoder (10+2 - Corresponds to HT6010/HT6012)
Program Flowchart
A
INITIAL
N
DECODER_STATUS= 1?
N
VTCOUNT1=0?
HI_COUNT Increase 1
Y
N
Read 10-bit address
Y
VTCOUNT1
Decrease 1
VTCOUNT0=0?
N
N
Match with
receives ?
’
Z= 1?
Y
Y
Y
Clear VT pin
Clear VTBIT
Y
WORDCNT=0?
LO_COUNT
Decrease 1
N
Return to Main
MATCHBIT=0?
N
Y
VTCOUNT1=E3H
Set DECODER_STATUS
VTCOUNT0
Decrease 1
DECODERPIN=0
Move HI_COUNT to
HI_COUNT_SAVE
N
?
N
Y
DECODER_STATUS= 0
LO_COUNT_SAVE<
MAXDURATION?
B
?
WORDCNT=1?
Y
Set MATCHBIT
Return to Main
Y
N
N
HI_COUNT_SAVE
>LO_COUNT_SAVE
Y
LO_COUNT Increase 1
N
N
Y
Set
DECODER_FLAG
Output data to data
pins
Clear C
,
Z=1?
VTCOUNT1=E3H
VTCOUNT0=06H
Y
Set C
LO_COUNT
Decrease 1
RRC
DECODER_CODE[2]
Return to Main
Set VT
and VTBIT
Return to Main
RRC
DECODER_CODE[1]
Clear DECODER_STATUS
RRC
DECODER_CODE[0]
Move LO_COUNT to
LO_COUNT_SAVE
BITCOUNTER
Decrease 1
Clear LO_COUNT
N
BITCOUNTER=0?
HI_COUNT_SAVE<
MAXDURATION?
Clear LO_COUNT_SAVE
and HI_COUNT_SAVE
Y
Y
Return to Main
N
N
B
Clear
DECODER_FLAG,
MATCHBIT
WORDCNT=3?
BITCOUNTER=12
Y
Move
DECODER_CODE[1]
to DATARES
Clear
DECODER_CODE[0],DE
CODER_CODE[1]
WORDCNT
Decrease 1
Return to Main
A
3
Return to Main
312 Decoder (10+2 - Corresponds to HT6010/HT6012)
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 10+2.ASM and MAIN.ASM files to
their project. The ASM text file include the DEFINE.ASM, INTERUPT.ASM, STDUC.ASM,
MEMORY.ASM and MACRO.ASM files that should be added in the project.
4