The HTG12B0 is a processor from HOLTEK¢s
4-bit stand-alone single chip microcontroller
specially designed for LCD display and time
piece product applications.
HTG12B0
4-Bit Microcontroller
RC oscillator & 32768Hz crystal oscillator
·
8-bit timer with internal or external clock
·
source
Internal timer overflow
·
Up to 4ms instruction cycle with 1MHz
·
system clock
One level subroutine nesting
·
Halt feature reduces power consumption
·
8-bit table read instruction
·
It is ideally suited for multiple LCD for time
piece low power applications among which are
calculators, scales, calendar and hand held
LCD products.
1September 8, 1999
Block Diagram
HTG12B0
XIN
XOUT
OSCI
OSCO
RES
TEST1
TEST2
T1D
T512
VDD
VSS
C ontrol
&
Tim ing
Circuit
Stack
Program
C ounter
ROM
In stru ction
D ecoder
ROM B
RAMB
LC D C
Tem porary
D ata R AM
D isplay D ata R AM
R0
R1
R2
R3
R4
ALU
ACC
Tim er
PA
PB
PS
PM
Sound
Effect
TM C LK
PA0
PA1
PA2
PA3
PB0
PB1
PB2
PB3
PS0
PS1
PS2
PS3
PM 0
PM 1
PM 2
PM 3
BZ
BZ
VOUT1
VOUT2
VOUT3
VOUT4
SEG 0
Note: ACC: Accumulator
R0~R4: Working registers
ROMB: ROM bank switch
RAMB: RAM bank switch
LCDC: LCD control register
PA, PB: I/O ports
PS, PM: Input ports
For test mode only
TEST1 and TEST2 are left open when the chip is
in normal operation (with an internal pull-high
resistor).
Note: 1. The system clock provides six different sources selectable by mask option to drive the
sound effect clock. If the Holtek sound library is used, only 128K and 64K are acceptable.
2. Each bit of ports PM, PS can be a trigger source of the HALT interrupt, selectable by
mask option.
3. Each bit of ports PA, PB can be selected as CMOS for output pin only, or as NMOS for
I/O pin with pull-high resistor or none by mask option.
4. 14 internal clock sources can be selected by mask option to drive TMCLK. Note that
TMCLK should not be connected to a pull high resistor if an internal source is used.
5September 8, 1999
Absolute Maximum Ratings
HTG12B0
Supply Voltage ..............................-0.3V to 5.5V
Storage Temperature.................-50°Cto125°C
Input Voltage ......................V
-0.3 to VDD+0.3
SS
Operating Temperature ..................0°Cto70°C
Note: These are stress ratings only. Stresses exceeding the range specified under ²Absolute Maxi
mum Ratings² may cause substantial damage to the device. Functional operation of this device
at other conditions beyond those listed in the specification is not implied and prolonged expo
sure to extreme conditions may affect device reliability.
D.C. Characteristics
Ta=25°C
Test Conditions
SymbolParameter
V
DD
I
DD
Operating Voltage
Operating Current3V
V
DD
Conditions
¾¾
No load,
=512kHz
f
SYS
Min.Typ.Max. Unit
2.433.6V
¾
200300
mA
Standby Current,
I
STB
(f
OFF and RTC ON,
SYS
3V Halt mode
¾
1015
mA
LCD ON)
V
V
I
I
I
I
R
V
IL
IH
OL1
OH1
OL2
OH2
PH
LCD
Input Low Voltage3V
Input High Voltage3V
PA, PB, BZ and BZ
Output Sink Current
PA, PB, BZ and BZ
Output Source Current
Segment Output Sink
Current
Segment Output Source
Current
3V
3V
3V
3V
Pull-high Resistor3V
V
Output Voltage
LCD
3V
¾
¾
=0.3V
V
OL
=2.7V
V
OH
VOL=0.44V
V
=4.4V
LCD
VOH=4.0V
V
=4.4V
LCD
PS, PM, RES
TMCLK
¾
0.8V
0
DD
¾
¾
1.53
-0.5-1¾
100200
3060
,
50100150
3.964.44.84V
0.2V
DD
V
DD
¾
¾mA
¾mA
V
V
mA
mA
kW
-
-
6September 8, 1999
HTG12B0
A.C. Characteristics
SymbolParameter
f
SYS
t
CY
f
TIMER
t
RES
f
SOUND
System Clock3V
Cycle Time3V
Timer I/P Frequency
(TMCLK)
Reset Pulse Width
Sound Effect Clock
*: Only these two clocking signal frequencies are supported by the Holtek sound library.
Test Conditions
V
DD
Conditions
R=620kW~51kW
f
=1MHz
SYS
3V
¾
¾¾
¾¾ ¾
Min.Typ.Max.Unit
128
¾
0
5
*64 or 128
¾
4
¾
1000kHz
¾ms
1000kHz
¾¾
¾
Functional Description
·
Program counter - PC
This counter addresses the program ROM and
is arranged as a 12-bit binary counter from PC0
to PC11 whose contents specify a maximum of 4096
addresses. The program counter counts with an
increment of 1 or 2 with each execution of an instruc
tion.
When executing the jump instruction (JMP,
JNZ, JC, JTMR,...), a subroutine call, initial reset, internal interrupt, RTC interrupt or returning from a subroutine, the program
counter is loaded with the corresponding instruction data as shown in the table.
Note: P0~P11: Instruction code
@: PC11 keeps current value
S0~S11: Stack register bits
ROMB0 and ROMB1 are set to 0 at
power on reset.
Program memory - ROM
The program memory is the executable memory
and is arranged in a 4096´8-bit format. There
are four banks for program memory in
HTG12B0, each bank shown in the figure can be
switched by assigning ROMB0 and ROMB1 (bit0
and bit1 of ROMB). ROMB is the ROM bank
pointer and can be written only by executing
²MOV ROMB, A² instruction. Bit 2 and bit 3 of
ROMB are unused bits. The address is specified
by the program counter (PC). Four special loca
tions are reserved as described next.
-
-
Location 000H: (Bank 0)
Activating the processor RES
pin causes the
first instruction to be fetched from location 0.
000H
004H
008H
00BH
F00H
FFFH
R e s e t in itia l p r o g r a m
Tim er interrupt subroutine
R T C interrupt subroutine
Page N look-up table
Page F look-up table (256 bytes)
8 bits
Program memory ROMB=XX00B
000H
004H
008H
00BH
F00H
FFFH
Tim er interrupt subroutine
R T C interrupt subroutine
Page N look-up table
Page F look-up table (256 bytes)
8 bits
Program memory ROMB=XX01B
Ta=25°C
ms
kHz
Program
ROM
Bank 0
Program
ROM
Bank 1
7September 8, 1999
HTG12B0
·
Location 004H: (Bank 0~3)
Contains the timer interrupt resulting from a
TIMER overflow. If the interrupt is enabled, the
CPU begins execution at location 004H.
·
Location 008H: (Bank 0~3)
Activating the RTC of the processor with the
interrupts enabled causes the program to
jump to this location.
·
Locations n00H to nFFH: (Bank 0~3)
Each page in the program memory consists of
256 bytes. This area from n00H to nFFH and
F00H to FFFH can be used as a look-up table.
Instructions such as READ R4A, READ
MR0A, READF R4A, READF MR0A can read
the table and transfer the contents of the ta
ble to ACC and R4 or to ACC and a data mem
ory address specified by the register pair
R1,R0. However as R1,R0 can only store 8
bits, these instructions cannot fully specify
the full 12 bit program memory address. For
this reason a jump instruction should first be
used to place the program counter in the right
page. The above instructions can then be used
to read the look up table data.
Note that the page number n must be greater
than zero since some locations in page 0 are reserved for specific usage. This area may function as normal program memory.
The program memory mapping is shown in the
diagram.
Mode
Initial
reset
Internal
interrupt
RTC
interrupt
Jump, call
instruction
Conditional
branch
Return from
subroutine
PC13PC12 PC11 PC10 PC9PC8PC7PC6PC5PC4PC3PC2PC1PC0
ROMB1 ROMB0000000000000
ROMB1 ROMB0000000000100
ROMB1 ROMB0000000001000
ROMB1 ROMB0 P11P10P9P8P7P6P5P4P3P2P1P0
ROMB1 ROMB0@P10P9P8P7P6P5P4P3P2P1P0
ROMB1 ROMB0 S11S10S9S8S7S6S5S4S3S2S1S0
In the execution of an instruction, the program
counter is added before the execution phase, so
careful manipulation of READ MR0A and
READ R4A is required in the page margin.
000H
004H
008H
00BH
F00H
FFFH
-
Tim er interrupt subroutine
R T C interrupt subroutine
Page N look-up table
Page F look-up table (256 bytes)
8 bits
Program memory ROMB=XX10B
-
000H
004H
008H
00BH
F00H
FFFH
Tim er interrupt subroutine
R T C interrupt subroutine
Page N look-up table
Page F look-up table (256 bytes)
8 bits
Program memory ROMB=XX11B
Program Counter
Program
ROM
Bank 2
Program
ROM
Bank 3
Program memory
8September 8, 1999
HTG12B0
R A M B ank 1
(RAM B=X001B)
Tem porary D ata A rea
00H
Tem porary D ata A rea
7FH
R A M B ank 0
(RAM B=X000B)
(128 x 4)
4 bits
00H
7FH
Temporary data memory
Stack register
The stack register is a group of registers used to
save the contents of the program counter (PC)
and is arranged into 13 bits ´ 1 level. One bit is
used to store the carry flag. An interrupt will
force the contents of the PC and the carry flag
onto the stack register. A subroutine call will
also cause the PC contents to be pushed onto
the stack; however the carry flag will not be
stored. At the end of a subroutine or an inter
rupt routine which is signaled by a return in
struction, RET or RETI restore the program
counter to its previous value from stack regis
ter. Executing ²RETI² instruction will restore
the carry flag from the stack register, but
²RET² does not.
Working registers - R0, R1, R2, R3, R4
There are five working registers (R0, R1, R2, R3,
R4) usually used to store the frequently accessed
intermediate results. Using the instructions INC
Rn and DEC Rn the working registers can increment (+1) or decrement (-1). The JNZ Rn (n=0, 1,
4) instruction makes efficient use of the working
registers as a program loop counter. Also the register pairs R0,R1 and R2,R3 are used as a data
memory pointer when the memory transfer instruction is executed.
Data memory - RAM
The static data memory (RAM) is arranged in
128´4-bit format and is used to store data. All
of the data memory locations are indirectly
addressable through the register pair R1,R0 or
R3,R2; for example MOV A,[R3R2] or MOV
[R3R2],A.
There are two areas in the data memory, the
temporary data area and display data area. Ac
cess to the temporary data area is from 00H to
R A M B ank 7
(RAM B=X111B)
00H
(128 x 4)
4 bits
Tem porary D ata A rea
7FH
(128 x 4)
4 bits
7FH of RAM bank 0~RAM bank 7. Access to the
display data area is from B0H to FFH of LCD
bank 0 and bank 1.
There are eight banks for the temporary data
memory in HTG12B0, each bank shown in the
figure can be switched by assigning
RAMB0~RAMB2 (bit 0~bit 2 of RAMB). RAMB
is the RAM bank pointer and can be written
only by executing ²MOV RAMB, A² instruction.
Bit 3 of RAMB is unused bit. Each bank maps to
different area of the data memory.
-
There are two banks for displaying the data
memory, each bank can be switched by the as
signment of LCDC0 (bit 0 of LCDC). LCDC is a
control register for LCD application and can be
written only by executing ²MOV LCDC, A² in
struction.
When data is written into the display data area,
it is automatically read by the LCD driver
which then generates the corresponding LCD
driving signals.
LC D B ank 0
(LCDC =XXX0B)
B0H
FFH
B0H
FFH
D isplay D ata Area
(80 x 4)
4 bits
LC D B ank 1
(LC DC =XXX1B)
D isplay D ata Area
(80 x 4)
4 bits
Display data memory
-
-
-
9September 8, 1999
HTG12B0
The locations between the temporary and
display data areas are undefined and cannot be
used.
Accumulator - ACC
The accumulator is the most important data
register in the processor. It is one of the sources
of input to the ALU and the destination of the
results of the operations performed in the ALU.
Data to and from the I/O ports and memory also
passes through the accumulator.
Arithmetic and logic unit - ALU
This circuit performs the following arithmetic
and logic operations ...
·
Add with or without carry
·
Subtract with or without carry
·
AND, OR, Exclusive-OR
·
Rotate right, left through carry
·
BCD decimal adjust for addition
·
Increment, decrement
·
Data transfers
·
Branch decisions
The ALU not only outputs the results of data
operations, but also sets the status of the carry
flag (CF) in some instructions.
Timer/counter
The HTG12B0 contains a programmable 8-bit
count-upcounter which can be used to count external
events or used as a clock to generate an accurate
time base.
If the 8-bit timer clock is supplied by an exter
nal source from pin TMCLK, synchronization
problems may occur when reading the data
from the timer. It is therefore recommended
that the timer is stopped before retrieving the
data. The 8-bit counter will increment on the
rising edge of the clock whether it is internally
or externally generated.
The Timer/Counter may be set and read with
software instructions and stopped by a hard
ware reset or a TIMER OFF instruction. To re
start the timer, load the counter with the value
XXH and then issue a TIMER ON instruction.
Note that XX is the desired start count immedi
ate value of the 8 bits. Once the Timer/Counter
is started it increments to a maximum count of
FFH and then overflows to zero (00H). It then
continues to count until stopped by a TIMER
OFF instruction or a reset.
The increment from the maximum count of
FFH to a zero (00H) triggers a timer flag TF
and an internal interrupt request. The inter
rupt may be enabled or disabled by executing
the EI and DI instructions. If the interrupt is
enabled, the timer overflow will cause a subrou
tine call to location 4. The state of the timer flag
can also be tested with the conditional jump in
struction JTMR. The timer flag is cleared after
the interrupt or the JTMR instruction is exe
cuted.
If an internal source is used, the frequency is
determined by the system clock and the param
eter n as defined in the equation. The frequency
of the internal frequency source can be selected
by mask option.
Frequency of TIMER clock =
system clock
where n=0, 1, 2... 3 selectable by mask option.
RTC
There is a real time clock (RTC) function implemented on the HTG12B0. The RTC function is
used to generate an accurate time period. The
RTC circuit clock source comes from the 32768Hz
crystal oscillator. The block diagram is shown as
follows.
-
X'tal 32768H z
1
128
1
, n=0~7
n
2
M ask O ptio n
The output of RTC can be selected by mask op
tion.
256
Frequency of RTC output =
-
The RTC output is used to generate an inter
-
rupt signal.
n
2
, n=0~7
n
2
In te rru p t
-
-
-
-
-
-
-
-
10September 8, 1999
Loading...
+ 23 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.