Beruflich Dokumente
Kultur Dokumente
General Description
The device is an 8-bit high performance RISC-like The program and option memories can be electrically
microcontroller designed for multiple I/O product appli- programmed, making the microcontroller suitable for
cations. The device is particularly suitable for use in use in product development.
products such as battery charger controllers and A/D
applications. A HALT feature is included to reduce
power consumption.
Block Diagram
P A 5 /IN T
In te rru p t
C ir c u it M P r e s c a le r fS Y S
T M R U
S T A C K X P A 4 /T M R
P ro g ra m P ro g ra m IN T C T M R C
R O M C o u n te r
P A 4
P A 3 /P F D
S Y S C L K /4
In s tr u c tio n M
W D T
R e g is te r W D T U
M P M D A T A P r e s c a le r
X
U M e m o ry
X
P W M R C O S C
P D C P O R T D
P D 0 /P W M
P D
In s tr u c tio n M U X
D e c o d e r 4 -C h a n n e l
A /D C o n v e rte r
A L U S T A T U S
P B C P O R T B
T im in g S h ifte r P B 0 /A N 0 ~ P B 3 /A N 3
P B
G e n e ra to r
P A 3 , P A 5
P A 0 ~ P A 2
P A C P O R T A P A 3 / P F D
O p tio n
P A 4 / T M R
O S C 2 O S C 1 A C C L V R P R O M P A
P A 5 / IN T
R E S P A 6 , P A 7
V D D
V S S
Pin Assignment
P A 3 /P F D 1 1 8 P A 4 /T M R
P A 2 2 1 7 P A 5 /IN T
P A 1 3 1 6 P A 6
P A 0 4 1 5 P A 7
P B 3 /A N 3 5 1 4 O S C 2
P B 2 /A N 2 6 1 3 O S C 1
P B 1 /A N 1 7 1 2 V D D
P B 0 /A N 0 8 1 1 R E S
V S S 9 1 0 P D 0 /P W M
H T 4 6 R 4 7
1 8 D IP -A /S O P -A
Pin Description
ROM Code
Pin No. Pin Name I/O Description
Option
4~2 PA0~PA2 Bidirectional 8-bit input/output port. Each bit can be configured as
1 PA3/PFD Pull-high wake-up input by ROM code option. Software instructions determine the
18 PA4/TMR I/O Wake-up CMOS output or Schmitt trigger input with or without pull-high resistor (de-
17 PA5/INT PA3 or PFD termined by pull-high options: bit option). The PFD, TMR and INT are
16, 15 PA6, PA7 pin-shared with PA3, PA4 and PA5, respectively.
Bidirectional 4-bit input/output port. Software instructions determine the
8 PB0/AN0
CMOS output, Schmitt trigger input with or without pull-high resistor (de-
7 PB1/AN1
I/O Pull-high termined by pull-high options: bit option) or A/D input.
6 PB2/AN2
Once a PB line is selected as an A/D input (by using software control),
5 PB3/AN3
the I/O function and pull-high resistor are disabled automatically.
9 VSS ¾ ¾ Negative power supply, ground.
Bidirectional I/O line. Software instructions determine the CMOS output,
Pull-high
Schmitt trigger input with or without a pull-high resistor (determined by
10 PD0/PWM I/O PD0 or
pull-high options: bit option). The PWM output function is pin-shared with
PWM
PD0 (dependent on PWM options).
11 RES I ¾ Schmitt trigger reset input. Active low.
Note: These are stress ratings only. Stresses exceeding the range specified under ²Absolute Maximum 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 exposure to extreme conditions may affect device reliabil-
ity.
Test Conditions
Symbol Parameter Min. Typ. Max. Unit
VDD Conditions
VDD1 Operating Voltage ¾ fSYS=4MHz 3.3 ¾ 5.5 V
VDD2 Operating Voltage ¾ fSYS=8MHz 4.5 ¾ 5.5 V
3.3V ¾ ¾ 5 mA
ISTB1 Standby Current (WDT Enabled) No load, system HALT
5V ¾ ¾ 10 mA
3.3V ¾ ¾ 1 mA
ISTB2 Standby Current (WDT Disabled) No load, system HALT
5V ¾ ¾ 2 mA
VAD A/D Input Voltage ¾ ¾ 0 ¾ VDD V
3.3V ¾ 0 ¾ 0.4VDD V
VIL2 Input Low Voltage (RES)
5V ¾ 0 ¾ 0.4VDD V
3.3V VOL=0.1VDD 4 8 ¾ mA
IOL I/O Port Sink Current
5V VOL=0.1VDD 10 20 ¾ mA
3.3V VOH=0.9VDD -2 -4 ¾ mA
IOH I/O Port Source Current
5V VOH=0.9VDD -5 -10 ¾ mA
3.3V ¾ 40 60 80 kW
RPH Pull-high Resistance
5V ¾ 10 30 50 kW
EAD A/D Conversion Error ¾ ¾ ¾ ±0.5 ±1 LSB
Test Conditions
Symbol Parameter Min. Typ. Max. Unit
VDD Conditions
3.3V ¾ 400 ¾ 4000 kHz
fSYS1 System Clock (Crystal OSC)
5V ¾ 400 ¾ 8000 kHz
3.3V ¾ 43 86 168 ms
tWDTOSC Watchdog Oscillator
5V ¾ 36 72 144 ms
3.3V 1.4 2.8~5.6 11 s
tWDT1 Watchdog Time-out Period (RC) ¾
5V 1.1 2.3~4.7 9.4 s
Watchdog Time-out Period
tWDT2 ¾ ¾ 217 ¾ 218 tSYS
(System Clock)
tRES External Reset Low Pulse Width ¾ ¾ 1 ¾ ¾ ms
tSST System Start-up Timer Period ¾ Wake-up from HALT ¾ 1024 ¾ *tSYS
Note: *tSYS=1/fSYS
Functional Description
Execution flow incremented by one. The program counter then points to
The system clock for the microcontroller is derived from the memory word containing the next instruction code.
either a crystal or an RC oscillator. The system clock is When executing a jump instruction, conditional skip ex-
internally divided into four non-overlapping clocks. One ecution, loading PCL register, subroutine call, initial re-
instruction cycle consists of four system clock cycles. set, internal interrupt, external interrupt or return from
Instruction fetching and execution are pipelined in such subroutine, the PC manipulates the program transfer by
a way that a fetch takes an instruction cycle while de- loading the address corresponding to each instruction.
coding and execution takes the next instruction cycle. The conditional skip is activated by instructions. Once
However, the pipelining scheme causes each instruc- the condition is met, the next instruction, fetched during
tion to effectively execute in a cycle. If an instruction the current instruction execution, is discarded and a
changes the program counter, two cycles are required to dummy cycle replaces it to get the proper instruction.
complete the instruction. Otherwise proceed with the next instruction.
The lower byte of the program counter (PCL) is a read-
Program counter - PC
able and writeable register (06H). Moving data into the
The program counter (PC) controls the sequence in PCL performs a short jump. The destination will be
which the instructions stored in program PROM are exe- within 256 locations.
cuted and its contents specify full range of program
memory. When a control transfer takes place, an additional
dummy cycle is required.
After accessing a program memory word to fetch an in-
struction code, the contents of the program counter are
T 1 T 2 T 3 T 4 T 1 T 2 T 3 T 4 T 1 T 2 T 3 T 4
S y s te m C lo c k
O S C 2 ( R C o n ly )
P C P C P C + 1 P C + 2
F e tc h IN S T (P C )
E x e c u te IN S T (P C -1 ) F e tc h IN S T (P C + 1 )
E x e c u te IN S T (P C ) F e tc h IN S T (P C + 2 )
E x e c u te IN S T (P C + 1 )
Execution flow
Program Counter
Mode
*10 *9 *8 *7 *6 *5 *4 *3 *2 *1 *0
Initial Reset 0 0 0 0 0 0 0 0 0 0 0
External Interrupt 0 0 0 0 0 0 0 0 1 0 0
Timer/Event Counter Overflow 0 0 0 0 0 0 0 1 0 0 0
A/D Converter Interrupt 0 0 0 0 0 0 0 1 1 0 0
Skip PC+2
Loading PCL *10 *9 *8 @7 @6 @5 @4 @3 @2 @1 @0
Jump, Call Branch #10 #9 #8 #7 #6 #5 #4 #3 #2 #1 #0
Return from Subroutine S10 S9 S8 S7 S6 S5 S4 S3 S2 S1 S0
Program counter
The program memory is used to store the program in- This area is reserved for the A/D converter interrupt
structions which are to be executed. It also contains service program. If an A/D converter interrupt results
data, table, and interrupt entries, and is organized into from an end of A/D conversion, and if the interrupt is
2048´14 bits, addressed by the program counter and ta- enabled and the stack is not full, the program begins
ble pointer. execution at location 00CH.
Certain locations in the program memory are reserved · Table location
for special usage: Any location in the PROM space can be used as
· Location 000H look-up tables. The instructions ²TABRDC [m]² (the
This area is reserved for program initialization. After current page, 1 page=256 words) and ²TABRDL [m]²
chip reset, the program always begins execution at lo- (the last page) transfer the contents of the lower-order
cation 000H. byte to the specified data memory, and the
higher-order byte to TBLH (08H). Only the destination
· Location 004H
of the lower-order byte in the table is well-defined, the
This area is reserved for the external interrupt service other bits of the table word are transferred to the lower
program. If the input pin is activated, the interrupt is portion of TBLH, and the remaining 2 bits are read as
enabled and the stack is not full, the program begins ²0². The Table Higher-order byte register (TBLH) is
execution at location 004H. read only. The table pointer (TBLP) is a read/write reg-
· Location 008H ister (07H), which indicates the table location. Before
This area is reserved for the timer/event counter inter- accessing the table, the location must be placed in
rupt service program. If a timer interrupt results from a TBLP. The TBLH is read only and cannot be restored.
timer/event counter overflow, and if the interrupt is en- If the main routine and the ISR (Interrupt Service Rou-
abled and the stack is not full, the program begins exe- tine) both employ the table read instruction, the con-
cution at location 008H. tents of the TBLH in the main routine are likely to be
changed by the table read instruction used in the ISR.
Errors can occur. In other words, using the table read
0 0 0 H
D e v ic e In itia liz a tio n P r o g r a m instruction in the main routine and the ISR simulta-
0 0 4 H neously should be avoided. However, if the table read
E x te r n a l In te r r u p t S u b r o u tin e instruction has to be applied in both the main routine
0 0 8 H and the ISR, the interrupt is supposed to be disabled
T im e r /E v e n t C o u n te r In te r r u p t S u b r o u tin e prior to the table read instruction. It will not be enabled
0 0 C H until the TBLH has been backed up. All table related
A /D C o n v e r te r In te r r u p t S u b r o u tin e instructions require two cycles to complete the opera-
P ro g ra m
M e m o ry
tion. These areas may function as normal program
memory depending upon the requirements.
n 0 0 H
L o o k - u p T a b le ( 2 5 6 w o r d s )
n F F H Stack register - STACK
This is a special part of the memory which is used to
save the contents of the program counter (PC) only. The
7 0 0 H
stack is organized into 6 levels and is neither part of the
L o o k - u p T a b le ( 2 5 6 w o r d s ) data nor part of the program space, and is neither read-
7 F F H
1 4 b its able nor writeable. The activated level is indexed by the
N o te : n ra n g e s fro m 0 to 7 stack pointer (SP) and is neither readable nor writeable.
At a subroutine call or interrupt acknowledgment, the
Program memory contents of the program counter are pushed onto the
stack. At the end of a subroutine or an interrupt routine,
Table Location
Instruction
*10 *9 *8 *7 *6 *5 *4 *3 *2 *1 *0
TABRDC [m] P10 P9 P8 @7 @6 @5 @4 @3 @2 @1 @0
TABRDL [m] 1 1 1 @7 @6 @5 @4 @3 @2 @1 @0
Table location
Note: *10~*0: Table location bits P10~P8: Current program counter bits
@7~@0: Table pointer bits
stack. After a chip reset, the SP will point to the top of the 0 2 H
0 3 H
stack.
0 4 H
If the stack is full and a non-masked interrupt takes 0 5 H A C C
0 6 H P C L
place, the interrupt request flag will be recorded but the
0 7 H T B L P
acknowledgment will be inhibited. When the stack T B L H
0 8 H
pointer is decremented (by RET or RETI), the interrupt 0 9 H
will be serviced. This feature prevents stack overflow al- 0 A H S T A T U S
lowing the programmer to use the structure more easily. 0 B H IN T C S p e c ia l P u r p o s e
0 C H D A T A M E M O R Y
In a similar case, if the stack is full and a ²CALL² is sub-
0 D H T M R
sequently executed, stack overflow occurs and the first 0 E H T M R C
entry will be lost (only the most recent 6 return ad- 0 F H
dresses are stored). 1 0 H
1 1 H
1 2 H P A
Data memory - RAM
1 3 H P A C
The data memory is designed with 85´8 bits. The data 1 4 H P B
memory is divided into two functional groups: special 1 5 H P B C
1 6 H
function registers and general purpose data memory
1 7 H
(64´8). Most are read/write, but some are read only. 1 8 H P D
1 9 H P D C : U n u s e d
The special function registers include the indirect ad-
1 A H P W M R e a d a s "0 0 "
dressing register (00H), timer/event counter 1 B H
(TMR;0DH), timer/event counter control register 1 C H
(TMRC;0EH), program counter lower-order byte regis- 1 D H
All of the data memory areas can handle arithmetic, The accumulator is closely related to ALU operations. It
logic, increment, decrement and rotate operations di- is also mapped to location of the data memory and can
rectly. Except for some dedicated bits, each bit in the carry out immediate data operations. The data move-
data memory can be set and reset by ²SET [m].i² and ment between two data memory locations must pass
through the accumulator.
²CLR [m].i². They are also indirectly accessible through
memory pointer register (MP;01H).
Arithmetic and logic unit - ALU
Indirect addressing register This circuit performs 8-bit arithmetic and logic opera-
Location 00H is an indirect addressing register that is not tions. The ALU provides the following functions:
physically implemented. Any read/write operation of [00H] · Arithmetic operations (ADD, ADC, SUB, SBC, DAA)
accesses data memory pointed to by MP (01H). Reading · Logic operations (AND, OR, XOR, CPL)
location 00H itself indirectly will return the result 00H. Writ- · Rotation (RL, RR, RLC, RRC)
ing indirectly results in no operation. · Increment and Decrement (INC, DEC)
The memory pointer register MP (01H) is a 7-bit register. · Branch decision (SZ, SNZ, SIZ, SDZ ....)
The bit 7 of MP is undefined and reading will return the re- The ALU not only saves the results of a data operation
sult ²1². Any writing operation to MP will only transfer the but also changes the status register.
Status register
Register Bit No. Label Function
0 EMI Controls the master (global) interrupt (1= enabled; 0= disabled)
1 EEI Controls the external interrupt (1= enabled; 0= disabled)
2 ETI Controls the timer/event counter interrupt (1= enabled; 0= disabled)
INTC 3 EADI Controls the A/D converter interrupt (1= enabled; 0= disabled)
(0BH) 4 EIF External interrupt request flag (1= active; 0= inactive)
5 TF Internal timer/event counter request flag (1= active; 0= inactive)
6 ADF A/D converter request flag (1= active; 0= inactive)
7 ¾ Unused bit, read as ²0²
INTC register
which corrupts the desired control sequence, the con- It is recommended that a program does not use the
tents should be saved in advance. ²CALL subroutine² within the interrupt subroutine. In-
External interrupts are triggered by a high to low transi- terrupts often occur in an unpredictable manner or
tion of and the related interrupt request flag (EIF; bit 4 of need to be serviced immediately in some applications.
INTC) will be set. When the interrupt is enabled, the If only one stack is left and enabling the interrupt is not
stack is not full and the external interrupt is active, a sub- well controlled, the original control sequence will be dam-
routine call to location 04H will occur. The interrupt re- aged once the ²CALL² operates in the interrupt subrou-
quest flag (EIF) and EMI bits will be cleared to disable tine.
other interrupts.
Oscillator configuration
The internal timer/event counter interrupt is initialized by
There are two oscillator circuits in the microcontroller.
setting the timer/event counter interrupt request flag
(TF; bit 5 of INTC), caused by a timer overflow. When
O S C 1 O S C 1
the interrupt is enabled, the stack is not full and the TF
bit is set, a subroutine call to location 08H will occur. The
related interrupt request flag (TF) will be reset and the
O S C 2 fS Y S /4 O S C 2
EMI bit cleared to disable further interrupts. N M O S O p e n D r a in
C r y s ta l O s c illa to r R C O s c illa to r
The A/D converter interrupt is initialized by setting the
A/D converter request flag (ADF; bit 6 of INTC), caused System oscillator
by an end of A/D conversion. When the interrupt is en-
abled, the stack is not full and the ADF is set, a subrou- Both are designed for system clocks, namely the RC os-
tine call to location 0CH will occur. The related interrupt cillator and the Crystal oscillator, which are determined
request flag (ADF) will be reset and the EMI bit cleared by the ROM code option. No matter what oscillator type
to disable further interrupts. is selected, the signal provides the system clock. The
During the execution of an interrupt subroutine, other in- HALT mode stops the system oscillator and ignores an
external signal to conserve power.
terrupt acknowledgments are held until the ²RETI² in-
struction is executed or the EMI bit and the related If an RC oscillator is used, an external resistor between
interrupt control bit are set to 1 (of course, if the stack is and VSS is required and the resistance must range
not full). To return from the interrupt subroutine, ²RET² or from 30kW to 750kW. The system clock, divided by 4, is
²RETI² may be invoked. RETI will set the EMI bit to en- available on OSC2, which can be used to synchronize
able an interrupt service, but RET will not. external logic. The RC oscillator provides the most cost
effective solution. However, the frequency of oscillation
Interrupts, occurring in the interval between the rising
may vary with VDD, temperatures and the chip itself
edges of two consecutive pulses, will be serviced on the
due to process variations. It is, therefore, not suitable
latter of the two T2 pulses, if the corresponding inter-
for timing sensitive operations where an accurate oscil-
rupts are enabled. In the case of simultaneous requests
lator frequency is desired.
the following table shows the priority that is applied.
These can be masked by resetting the EMI bit. If the Crystal oscillator is used, a crystal across OSC1
and OSC2 is needed to provide the feedback and phase
No. Interrupt Source Priority Vector
shift required for the oscillator, and no other external
a External Interrupt 1 components are required. Instead of a crystal, a resona-
b Timer/event Counter Overflow 2 tor can also be connected between OSC1 and OSC2 to
get a frequency reference, but two external capacitors in
c A/D Converter Interrupt 3 OSC1 and OSC2 are required (If the oscillating fre-
The timer/event counter interrupt request flag (TF), ex- quency is less than 1MHz).
ternal interrupt request flag (EIF), A/D converter request The oscillator is a free running on-chip RC oscillator,
flag (ADF), enable timer/event counter bit (ETI), enable and no external components are required. Even if the
external interrupt bit (EEI), enable A/D converter inter- system enters the power down mode, the system clock
rupt bit (EADI) and enable master interrupt bit (EMI) is stopped, but the WDT oscillator still works with a pe-
constitute an interrupt control register (INTC) which is riod of approximately 72ms@5V. The WDT oscillator can
located at 0BH in the data memory. EMI, EEI, ETI, EADI be disabled by ROM code option to conserve power.
are used to control the enabling/disabling of interrupts.
These bits prevent the requested interrupt from being Watchdog Timer - WDT
serviced. Once the interrupt request flags (TF, EIF, ADF)
The clock source of is implemented by a dedicated RC
are set, they will remain in the INTC register until the in-
oscillator (WDT oscillator) or instruction clock (system
terrupts are serviced or cleared by a software instruc-
clock divided by 4), decided by ROM code option. This
tion.
timer is designed to prevent a software malfunction or
S y s te m C lo c k /4
R O M
C o d e fS W D T T im e - o u t
8 - b it C o u n te r 7 - b it C o u n te r T T 1 5 1 6
O p tio n fS /2 ~ fS /2
W D T S e le c t
O S C C L R W D T
Watchdog Timer
sequence from jumping to an unknown location with un- · All of the I/O ports maintain their original status.
predictable results. The Watchdog Timer can be dis- · The PD flag is set and the TO flag is cleared.
abled by a ROM code option. If the Watchdog Timer is The system can leave the HALT mode by means of an
disabled, all the executions related to the WDT result in external reset, an interrupt, an external falling edge sig-
no operation. nal on port A or a WDT overflow. An external reset
Once the internal oscillator (RC oscillator with a period causes a device initialization and the WDT overflow per-
of 72ms@5V normally) is selected, it is divided by forms a ²warm reset². After the TO and PD flags are ex-
32768~65536 to get the nominal time-out period of ap- amined, the reason for chip reset can be determined.
proximately 2.3s@5V~ 4.7s@5V. This time-out period The PD flag is cleared by system power-up or executing
may vary with temperatures, and process variations. If the ²CLR WDT² instruction and is set when executing
the WDT oscillator is disabled, the WDT clock may still the ²HALT² instruction. The TO flag is set if the WDT
come from the instruction clock and operate in the same time-out occurs, and causes a wake-up that only resets
manner except that in the HALT state the WDT may stop the PC and SP; the others keep their original status.
counting and lose its protecting purpose. In this situation The port A wake-up and interrupt methods can be con-
the logic can only be restarted by external logic. sidered as a continuation of normal execution. Each bit
If the device operates in a noisy environment, using the in port A can be independently selected to wake up the
on-chip RC oscillator (WDT OSC) is strongly recom- device by the ROM code option. Awakening from an I/O
mended, since the HALT will stop the system clock. port stimulus, the program will resume execution of the
next instruction. If it is awakening from an interrupt, two
The WDT overflow under normal operation will initialize
sequences may happen. If the related interrupt is dis-
²chip reset² and set the status bit ²TO². But in the HALT
abled or the interrupt is enabled but the stack is full, the
mode, the overflow will initialize a ²warm reset², and
program will resume execution at the next instruction. If
only the PC and SP are reset to zero. To clear the con-
the interrupt is enabled and the stack is not full, the regu-
tents of WDT, three methods are adopted; external reset
lar interrupt response takes place. If an interrupt request
(a low level to RES), software instruction and a ²HALT²
flag is set to ²1² before entering the HALT mode, the
instruction. The software instruction include ²CLR
wake-up function of the related interrupt will be disabled.
WDT² and the other set - ²CLR WDT1² and ²CLR Once a wake-up event occurs, it takes 1024 tSYS (sys-
WDT2². Of these two types of instruction, only one can tem clock period) to resume normal operation. In other
be active depending on the ROM code option - ²CLR words, a dummy period will be inserted after wake-up. If
WDT times selection option². If the ²CLR WDT² is se- the wake-up results from an interrupt acknowledgment,
lected (i.e. CLRWDT times equal one), any execution of the actual interrupt subroutine execution will be delayed
the ²CLR WDT² instruction will clear the WDT. In the by one or more cycles. If the wake-up results in the next
case that ²CLR WDT1² and ²CLR WDT2² are chosen instruction execution, this will be executed immediately
(i.e. CLRWDT times equal two), these two instructions after the dummy period is finished.
must be executed to clear the WDT; otherwise, the WDT To minimize power consumption, all the I/O pins should
may reset the chip as a result of time-out. be carefully managed before entering the HALT status.
TO RESET Conditions C h ip R e s e t
0 0 RES reset during power-up
Reset timing chart
u u RES reset during normal operation
0 1 RES wake-up HALT V D D
Timer/Event Counter The , TM1 bits define the operating mode. The event
A timer/event counter (TMR) is implemented in the count mode is used to count external events, which
microcontroller. The timer/event counter contains an means the clock source comes from an external (TMR)
8-bit programmable count-up counter and the clock may pin. The timer mode functions as a normal timer with the
come from an external source or the system clock. clock source coming from the fINT clock. The pulse
width measurement mode can be used to count the high
Using external clock input allows the user to count exter-
or low level duration of the external signal (TMR). The
nal events, measure time internals or pulse widths, or
counting is based on the fINT.
generate an accurate time base. While using the inter-
nal clock allows the user to generate an accurate time In the event count or timer mode, once the timer/event
base. counter starts counting, it will count from the current
contents in the timer/event counter to FFH. Once over-
The timer/event counter can generate PFD signal by us-
flow occurs, the counter is reloaded from the timer/event
ing external or internal clock and PFD frequency is de-
counter preload register and generates the interrupt re-
termine by the equation fINT/[2´(256-N)].
quest flag (TF; bit 5 of INTC) at the same time.
There are 2 registers related to the timer/event counter;
In the pulse width measurement mode with the TON
([0DH]), TMRC ([0EH]). Two physical registers are
and TE bits equal to one, once the TMR has received a
mapped to TMR location; writing TMR makes the start-
transient from low to high (or high to low if the TE bits is
ing value be placed in the timer/event counter preload
²0²) it will start counting until the TMR returns to the orig-
register and reading TMR gets the contents of the
inal level and resets the TON. The measured result will
timer/event counter. The TMRC is a timer/event counter
remain in the timer/event counter even if the activated
control register, which defines some options.
transient occurs again. In other words, only one cycle
TMRC register
P W M
(6 + 2 ) c o m p a re to P D 0 c ir c u it
fS Y S 8 - s ta g e p r e s c a le r
f IN T D a ta B u s
8 -1 M U X
T M 1
T M 0 T im e r /E v e n t C o u n te r R e lo a d
P S C 2 ~ P S C 0 T M R P r e lo a d R e g is te r
T E
P u ls e W id th T im e r /E v e n t O v e r flo w
T M 1 M e a s u re m e n t C o u n te r
T M 0 to In te rru p t
M o d e C o n tro l
T O N
1 /2 P F D
Timer/Event Counter
measurement can be done. Until setting the TON, the In the case of timer/event counter OFF condition, writ-
cycle measurement will function again as long as it re- ing data to the timer/event counter register will also re-
ceives further transient pulse. Note that, in this operat- load that data to the timer/event counter. But if the
ing mode, the timer/event counter starts counting not timer/event counter is turned on, data written to it will
according to the logic level but according to the transient only be kept in the timer/event counter preload register.
edges. In the case of counter overflows, the counter is The timer/event counter will still operate until overflow oc-
reloaded from the timer/event counter preload register curs. When the timer/event counter (reading TMR) is read,
and issues the interrupt request just like the other two the clock will be blocked to avoid errors. As clock blocking
modes. To enable the counting operation, the timer ON may results in a counting error, this must be taken into con-
bit (TON; bit 4 of TMRC) should be set to 1. In the pulse sideration by the programmer.
width measurement mode, the TON will be cleared au- The bit0~bit2 of the can be used to define the
tomatically after the measurement cycle is completed. pre-scaling stages of the internal clock sources of
But in the other two modes the TON can only be reset by timer/event counter. The definitions are as shown. The
instructions. The overflow of the timer/event counter is overflow signal of timer/event counter can be used to
one of the wake-up sources. No matter what the opera- generate the PFD signal.
tion mode is, writing a 0 to ETI can disable the interrupt
service.
Input/output ports [m].i², ²CPL [m]², ²CPLA [m]² read the entire port states
There are 13 bidirectional input/output lines in the , la- into the CPU, execute the defined operations
beled as PA, PB and PD, which are mapped to the data (bit-operation), and then write the results back to the
memory of [12H], [14H] and [18H] respectively. All of latches or the accumulator.
these I/O ports can be used for input and output opera- Each line of port A has the capability of waking-up the
tions. For input operation, these ports are non-latching, device. The highest 4-bit of port B and 7 bits of port D
that is, the inputs must be ready at the T2 rising edge of are not physically implemented; on reading them a ²0² is
instruction ²MOV A,[m]² (m=12H, 14H or 18H). For out- returned whereas writing then results in a no-operation.
put operation, all the data is latched and remains un- See Application note.
changed until the output latch is rewritten.
Each I/O line has a pull-high option. Once the pull-high
Each I/O line has its own control register (PAC, , PDC) to option is selected, the I/O line has a pull-high resistor,
control the input/output configuration. With this control otherwise, there¢s none. Take note that a non-pull-high
register, CMOS output or Schmitt trigger input with or I/O line operating in input mode will cause a floating
without pull-high resistor structures can be reconfigured state.
dynamically (i.e. on-the-fly) under software control. To
The PA3 is pin-shared with the PFD signal. If the PFD
function as an input, the corresponding latch of the con-
option is selected, the output signal in output mode of
trol register must write ²1². The input source also de-
PA3 will be the PFD signal generated by timer/event
pends on the control register. If the control register bit is
counter overflow signal. The input mode always remain-
²1², the input will read the pad state. If the control regis-
ing its original functions. Once the PFD option is se-
ter bit is ²0², the contents of the latches will move to the
lected, the PFD output signal is controlled by PA3 data
in t e rn a l b u s . The l at t er i s p o s s i bl e i n t h e
register only. Writing ²1² to PA3 data register will enable
²read-modify-write² instruction.
the PFD output function and writing ²0² will force the
For output function, CMOS is the only configuration. PA3 to remain at ²0². The I/O functions of PA3 are
These control registers are mapped to locations , 15H shown below.
and 19H.
I/O I/P O/P I/P O/P
After a chip reset, these input/output lines remain at high Mode (Normal) (Normal) (PFD) (PFD)
levels or floating state (dependent on pull-high options). Logical Logical Logical PFD
PA3
Each bit of these input/output latches can be set or Input Output Input (Timer on)
cleared by ²SET [m].i² and ²CLR [m].i² (m=12H, 14H or
Note: The frequency is the timer/event counter over-
18H) instructions.
flow frequency divided by 2.
Some instructions first input data and then follow the
The PA5 and PA4 are pin-shared with INT and TMR pins
output operations. For example, ²SET [m].², ²CLR
respectively.
V D D
C o n tr o l B it P U
D a ta B u s D Q
W r ite C o n tr o l R e g is te r C K Q B
C h ip R e s e t S P A 0 ~ P A 2
P A 3 /P F D
P A 4 /T M R
R e a d C o n tr o l R e g is te r P A 5 /IN T
D a ta B it P A 6 , P A 7
D Q P B 0 /A N 0 ~ P B 3 /A N 3
P D 0 /P W M
W r ite D a ta R e g is te r C K Q B
S
M
P A 3 U
(P D 0 o r P W M ) X
P F D
P F D E N
M (P A 3 )
U
X
R e a d D a ta R e g is te r
S y s te m W a k e -u p
( P A o n ly ) O P 0 ~ O P 7
IN T fo r P A 5 O n ly
T M R fo r P A 4 O n ly
Input/output ports
The PB can also be used as A/D converter inputs. The The modulation frequency, cycle frequency and cycle
A/D function will be described later. There is a function duty of the PWM output signal are summarized in the
shared with PD0. If the PWM function is enabled, the following table.
PWM signal will appear on PD0 (if PD0 is operating in PWM
output mode). The I/O functions of PD0 are as shown. PWM Cycle PWM Cycle
Modulation
Frequency Duty
Frequency
I/O I/P O/P I/P O/P
Mode (Normal) (Normal) (PWM) (PWM) fSYS/64 fSYS/256 [PWM]/256
Logical Logical Logical
PD0 PWM
Input Output Input A/D converter
It is recommended that unused or not bonded out I/O The 4 channels and 9-bit resolution A/D (8-bit accuracy)
lines should be set as output pins by software instruction converter are implemented in this microcontroller. The
to avoid consuming power under input floating state. reference voltage is VDD. The A/D converter contains 4
special registers which are; ADRL (20H), ADRH (21H),
PWM ADCR (22H) and ACSR (23H). The ADRH and ADRL
The microcontroller provides 1 channel (6+2) bits PWM are A/D result register higher-order byte and
output shared with PD0. The PWM channel has its data lower-order byte and are read-only. After the A/D con-
register denoted as PWM (1AH). The frequency source version is completed, the ADRH and ADRL should be
of the PWM counter comes from fSYS. The PWM register read to get the conversion result data. The ADCR is an
is an eight bits register. The waveforms of PWM output A/D converter control register, which defines the A/D
are as shown. Once the PD0 is selected as the PWM channel number, analog channel select, start A/D con-
output and the output function of PD0 is enabled version control bit and the end of A/D conversion flag. If
(PDC.0=²0²), writing 1 to PD0 data register will enable the users want to start an A/D conversion, define PB
the PWM output function and writing ²0² will force the configuration, select the converted analog channel, and
PD0 to stay at ²0². give START bit a raising edge and a falling edge
(0®1®0). At the end of A/D conversion, the EOC bit is
A cycle is divided into four modulation cycles (modula-
cleared and an A/D converter interrupt occurs (if the A/D
tion cycle 0~modulation cycle 3). Each modulation cycle
converter interrupt is enabled). The ACSR is A/D clock
has 64 PWM input clock period. In a (6+2) bit PWM func-
setting register, which is used to select the A/D clock
tion, the contents of the PWM register is divided into two
source.
groups. Group 1 of the PWM register is denoted by DC
which is the value of PWM.7~PWM.2. The A/D converter control register is used to control the
A/D converter. The bit2~bit0 of the ADCR are used to
The group 2 is denoted by AC which is the value of
select an analog input channel. There are a total of four
PWM.1~PWM.0.
channels to select. The bit5~bit3 of the ADCR are used
In a PWM cycle, the duty cycle of each modulation cycle to set PB configurations. PB can be an analog input or
is shown in the table. as digital I/O line decided by these 3 bits. Once a PB line
Parameter AC (0~3) Duty Cycle is selected as an analog input, the I/O functions and
pull-high resistor of this I/O line are disabled, and the
DC + 1
i<AC A/D converter circuit is power on. The EOC bit (bit6 of
Modulation cycle i 64
the ADCR) is end of A/D conversion flag. Check this bit
(i=0~3) DC
i³AC to know when A/D conversion is completed. The START
64
bit of the ADCR is used to begin the conversion of A/D
fS Y S /2
[P W M ] = 1 0 0
P W M
2 5 /6 4 2 5 /6 4 2 5 /6 4 2 5 /6 4 2 5 /6 4
[P W M ] = 1 0 1
P W M
2 6 /6 4 2 5 /6 4 2 5 /6 4 2 5 /6 4 2 6 /6 4
[P W M ] = 1 0 2
P W M
2 6 /6 4 2 6 /6 4 2 5 /6 4 2 5 /6 4 2 6 /6 4
[P W M ] = 1 0 3
P W M
2 6 /6 4 2 6 /6 4 2 6 /6 4 2 5 /6 4 2 6 /6 4
P W M m o d u la tio n p e r io d : 6 4 /fS Y S
P W M c y c le : 2 5 6 /fS Y S
PWM
Bits Function
ADCS1, ADCS0: Select the A/D converter clock source.
0, 0: fSYS/2
ADCS0 0
0, 1: fSYS/8
ADCS1 1
1, 0: fSYS/32
1, 1: Undefined, cannot be used.
¾ 2~6 Unused bit, read as ²0².
TEST 7 For internal test only.
converter. Give START bit a raising edge and falling The LVR includes the following specifications:
edge that means the A/D conversion has started. In or- · The low voltage (0.9V~3.3V) has to remain in their
der to ensure the A/D conversion is completed, the original state to exceed 1ms. If the low voltage state
START should stay at ²0² until the EOC is cleared to ²0² does not exceed 1ms, the LVR will ignore it and do not
(end of A/D conversion). perform a reset function.
The bit 7 of the ACSR is used for testing purpose only. It · The LVR uses the ²OR² function with the external RES
can not be used for the users. The bit1 and bit0 of the signal to perform chip reset.
ACSR are used to select A/D clock sources. The relationship between VDD and VLVR is shown below.
When the A/D conversion is completed, the A/D inter-
rupt request flag is set. The EOC bit is set to ²1² when V D D V O P R
3 .3 V
* D0~D8 is A/D conversion result data bit LSB~MSB.
3 .0 V
Low voltage reset - LVR
The microcontroller provides low voltage reset circuit in
order to monitor the supply voltage of the device. If the 0 .9 V
supply voltage of the device is within the range Note: VOPR is the voltage range for proper chip opera-
0.9V~3.3V, such as changing a battery, the LVR will au- tion at 4MHz system clock.
tomatically reset the device internally.
S T A R T
E O C
*7 6 T A D *7 6 T A D
P C R 0 ~ P C R 2 0 0 0 B 1 0 0 B 1 0 0 B 0 0 0 B
A C S 0 ~ A C S 2 0 0 0 B 0 1 0 B 0 0 0 B **X X X B
P o w e r S ta rt o f A /D S ta rt o f A /D 1 : A ll P B lin e is d ig ita l in p u t
O n c o n v e r s io n c o n v e r s io n
R e s e t 2 : A /D c o n v e r te r is p o w e r o ff
R e s e t A /D R e s e t A /D to r e d u c e p o w e r c o n s u m p tio n
c o n v e rte r c o n v e rte r
1 : D e fin e P B c o n fig u r a tio n E n d o f A /D E n d o f A /D
2 : S e le c t a n a lo g c h a n n e l c o n v e rte r c o n v e rte r
***3 : S e le c t A D C c lo c k
(E x a m p le : 4 c h a n n e l, A N 2 ,
fS Y S /8 )
V D D
5 .5 V
V L V R L V R D e te c t V o lta g e
0 .9 V
0 V
R e s e t S ig n a l
R e s e t N o r m a l O p e r a tio n R e s e t
*1 *2
Note: *1:To make sure that the system oscillator has stabilized, the SST provides an extra delay of
1024 system clock pulses before entering the normal operation.
*2:Since the low voltage has to maintain in its original state and exceed 1ms, therefore 1ms
delay enter the reset mode.
Application Circuits
Battery charger for 1-set battery charger applications
P A 0 , P A 1 1 2 V
O S C 1
P A 3 /P F D
O S C
C ir c u it P A 4 /T M R
P A 5 /IN T
O S C 2
S e e b e lo w P A 6 , P A 7
H T 4 6 R 4 7 5 V
5 V P D 0 /P W M
V D D V R t
P B 0 /A N 0
1 0 0 k W V b a t
P B 1 /A N 1
0 .1 m F R E S
1 0 k W
P A 2
0 .1 m F
If
V S S P B 2 /A N 2
P B 3 /A N 3
V D D
2 7 0 p F
O S C 1 R C s y s te m o s c illa to r
R O S C 3 0 k W < R O S C < 7 5 0 k W
fS Y S /4
O S C 2
O S C 1
C 1 C r y s ta l s y s te m o s c illa to r
C 1 = C 2 = 3 0 0 p F , if fS Y S < 1 M H z
O S C 2 O th e r w is e , C 1 = C 2 = 0
C 2
N o te : T h e r e s is ta n c e a n d c a p a c ita n c e fo r r e s e t c ir c u it s h o u ld b e d e s ig n e d
to e n s u r e th a t th e V D D is s ta b le a n d r e m a in s in a v a lid r a n g e o f th e
o p e r a tin g v o lta g e b e fo r e b r in g in g R E S to h ig h .
V b a t: 3 .6 V ( N iC d , N iM H ) o r 4 .1 V ( L i + )
1 2 V
O S C 1 P A 0
O S C P A 3 /P F D
C ir c u it P A 4 /T M R
O S C 2 P A 5 /IN T
S e e b e lo w
P D 0 /P W M
5 V
V D D
H T 4 6 R 4 7
1 0 0 k W C H 0
P A 6
0 .1 m F R E S
C H 1
1 0 k W P A 7
V b a t0
P B 0 /A N 0
0 .1 m F V b a t1
V S S
P B 1 /A N 1
P B 3 /A N 3 P A 1
P A 2
If
P B 2 /A N 2
V D D
2 7 0 p F
O S C 1 R C s y s te m o s c illa to r
R O S C 3 0 k W < R O S C < 7 5 0 k W
fS Y S /4
O S C 2
O S C 1
C 1 C r y s ta l s y s te m o s c illa to r
C 1 = C 2 = 3 0 0 p F , if fS Y S < 1 M H z
O S C 2 O th e r w is e , C 1 = C 2 = 0
C 2
N o te : T h e r e s is ta n c e a n d c a p a c ita n c e fo r r e s e t c ir c u it s h o u ld b e d e s ig n e d
to e n s u r e th a t th e V D D is s ta b le a n d r e m a in s in a v a lid r a n g e o f th e
o p e r a tin g v o lta g e b e fo r e b r in g in g R E S to h ig h .
V b a t: 3 .6 V ( N iC d , N iM H ) o r 4 .1 V ( L i + )
Instruction Flag
Mnemonic Description
Cycle Affected
Branch
JMP addr Jump unconditionally 2 None
SZ [m] Skip if data memory is zero 1(2) None
SZA [m] Skip if data memory is zero with data movement to ACC 1(2) None
SZ [m].i Skip if bit i of data memory is zero 1(2) None
SNZ [m].i Skip if bit i of data memory is not zero 1(2) None
SIZ [m] Skip if increment data memory is zero 1(3) None
SDZ [m] Skip if decrement data memory is zero 1(3) None
SIZA [m] Skip if increment data memory is zero with result in ACC 1(2) None
SDZA [m] Skip if decrement data memory is zero with result in ACC 1(2) None
CALL addr Subroutine call 2 None
RET Return from subroutine 2 None
RET A,x Return from subroutine and load immediate data to ACC 2 None
RETI Return from interrupt 2 None
Table Read
TABRDC [m] Read ROM code (current page) to data memory and TBLH 2(1) None
TABRDL [m] Read ROM code (last page) to data memory and TBLH 2(1) None
Miscellaneous
NOP No operation 1 None
CLR [m] Clear data memory 1(1) None
SET [m] Set data memory 1(1) None
CLR WDT Clear Watchdog Timer 1 TO,PD
CLR WDT1 Pre-clear Watchdog Timer 1 TO(4),PD(4)
CLR WDT2 Pre-clear Watchdog Timer 1 TO(4),PD(4)
SWAP [m] Swap nibbles of data memory 1(1) None
SWAPA [m] Swap nibbles of data memory with result in ACC 1 None
HALT Enter power down mode 1 TO,PD
Instruction Definition
¾ ¾ ¾ ¾ Ö Ö Ö Ö
¾ ¾ ¾ ¾ Ö Ö Ö Ö
¾ ¾ ¾ ¾ Ö Ö Ö Ö
¾ ¾ ¾ ¾ Ö Ö Ö Ö
¾ ¾ ¾ ¾ Ö Ö Ö Ö
¾ ¾ ¾ ¾ ¾ Ö ¾ ¾
¾ ¾ ¾ ¾ ¾ Ö ¾ ¾
¾ ¾ ¾ ¾ ¾ Ö ¾ ¾
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
¾ ¾ 0 0 ¾ ¾ ¾ ¾
¾ ¾ 0* 0* ¾ ¾ ¾ ¾
¾ ¾ 0* 0* ¾ ¾ ¾ ¾
¾ ¾ ¾ ¾ ¾ Ö ¾ ¾
CPLA [m] Complement data memory and place result in the accumulator
Description Each bit of the specified data memory is logically complemented (1¢s complement). Bits
which previously contained a 1 are changed to 0 and vice-versa. The complemented result
is stored in the accumulator and the contents of the data memory remain unchanged.
Operation ACC ¬ [m]
Affected flag(s)
TC2 TC1 TO PD OV Z AC C
¾ ¾ ¾ ¾ ¾ Ö ¾ ¾
¾ ¾ ¾ ¾ ¾ ¾ ¾ Ö
¾ ¾ ¾ ¾ ¾ Ö ¾ ¾
DECA [m] Decrement data memory and place result in the accumulator
Description Data in the specified data memory is decremented by 1, leaving the result in the accumula-
tor. The contents of the data memory remain unchanged.
Operation ACC ¬ [m]-1
Affected flag(s)
TC2 TC1 TO PD OV Z AC C
¾ ¾ ¾ ¾ ¾ Ö ¾ ¾
¾ ¾ 0 1 ¾ ¾ ¾ ¾
¾ ¾ ¾ ¾ ¾ Ö ¾ ¾
INCA [m] Increment data memory and place result in the accumulator
Description Data in the specified data memory is incremented by 1, leaving the result in the accumula-
tor. The contents of the data memory remain unchanged.
Operation ACC ¬ [m]+1
Affected flag(s)
TC2 TC1 TO PD OV Z AC C
¾ ¾ ¾ ¾ ¾ Ö ¾ ¾
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
NOP No operation
Description No operation is performed. Execution continues with the next instruction.
Operation PC ¬ PC+1
Affected flag(s)
TC2 TC1 TO PD OV Z AC C
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
¾ ¾ ¾ ¾ ¾ Ö ¾ ¾
¾ ¾ ¾ ¾ ¾ Ö ¾ ¾
¾ ¾ ¾ ¾ ¾ Ö ¾ ¾
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
RLA [m] Rotate data memory left and place result in the accumulator
Description Data in the specified data memory is rotated 1 bit left with bit 7 rotated into bit 0, leaving the
rotated result in the accumulator. The contents of the data memory remain unchanged.
Operation ACC.(i+1) ¬ [m].i; [m].i:bit i of the data memory (i=0~6)
ACC.0 ¬ [m].7
Affected flag(s)
TC2 TC1 TO PD OV Z AC C
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
¾ ¾ ¾ ¾ ¾ ¾ ¾ Ö
RLCA [m] Rotate left through carry and place result in the accumulator
Description Data in the specified data memory and the carry flag are rotated 1 bit left. Bit 7 replaces the
carry bit and the original carry flag is rotated into bit 0 position. The rotated result is stored
in the accumulator but the contents of the data memory remain unchanged.
Operation ACC.(i+1) ¬ [m].i; [m].i:bit i of the data memory (i=0~6)
ACC.0 ¬ C
C ¬ [m].7
Affected flag(s)
TC2 TC1 TO PD OV Z AC C
¾ ¾ ¾ ¾ ¾ ¾ ¾ Ö
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
¾ ¾ ¾ ¾ ¾ ¾ ¾ Ö
RRCA [m] Rotate right through carry and place result in the accumulator
Description Data of the specified data memory and the carry flag are rotated 1 bit right. Bit 0 replaces
the carry bit and the original carry flag is rotated into the bit 7 position. The rotated result is
stored in the accumulator. The contents of the data memory remain unchanged.
Operation ACC.i ¬ [m].(i+1); [m].i:bit i of the data memory (i=0~6)
ACC.7 ¬ C
C ¬ [m].0
Affected flag(s)
TC2 TC1 TO PD OV Z AC C
¾ ¾ ¾ ¾ ¾ ¾ ¾ Ö
SBC A,[m] Subtract data memory and carry from the accumulator
Description The contents of the specified data memory and the complement of the carry flag are sub-
tracted from the accumulator, leaving the result in the accumulator.
Operation ACC ¬ ACC+[m]+C
Affected flag(s)
TC2 TC1 TO PD OV Z AC C
¾ ¾ ¾ ¾ Ö Ö Ö Ö
SBCM A,[m] Subtract data memory and carry from the accumulator
Description The contents of the specified data memory and the complement of the carry flag are sub-
tracted from the accumulator, leaving the result in the data memory.
Operation [m] ¬ ACC+[m]+C
Affected flag(s)
TC2 TC1 TO PD OV Z AC C
¾ ¾ ¾ ¾ Ö Ö Ö Ö
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
SDZA [m] Decrement data memory and place result in ACC, skip if 0
Description The contents of the specified data memory are decremented by 1. If the result is 0, the next
instruction is skipped. The result is stored in the accumulator but the data memory remains
unchanged. If the result is 0, the following instruction, fetched during the current instruction
execution, is discarded and a dummy cycle is replaced to get the proper instruction (2 cy-
cles). Otherwise proceed with the next instruction (1 cycle).
Operation Skip if ([m]-1)=0, ACC ¬ ([m]-1)
Affected flag(s)
TC2 TC1 TO PD OV Z AC C
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
SIZA [m] Increment data memory and place result in ACC, skip if 0
Description The contents of the specified data memory are incremented by 1. If the result is 0, the next
instruction is skipped and the result is stored in the accumulator. The data memory re-
mains unchanged. If the result is 0, the following instruction, fetched during the current in-
struction execution, is discarded and a dummy cycle is replaced to get the proper
instruction (2 cycles). Otherwise proceed with the next instruction (1 cycle).
Operation Skip if ([m]+1)=0, ACC ¬ ([m]+1)
Affected flag(s)
TC2 TC1 TO PD OV Z AC C
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
¾ ¾ ¾ ¾ Ö Ö Ö Ö
¾ ¾ ¾ ¾ Ö Ö Ö Ö
¾ ¾ ¾ ¾ Ö Ö Ö Ö
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
SWAPA [m] Swap data memory and place result in the accumulator
Description The low-order and high-order nibbles of the specified data memory are interchanged, writ-
ing the result to the accumulator. The contents of the data memory remain unchanged.
Operation ACC.3~ACC.0 ¬ [m].7~[m].4
ACC.7~ACC.4 ¬ [m].3~[m].0
Affected flag(s)
TC2 TC1 TO PD OV Z AC C
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
TABRDC [m] Move the ROM code (current page) to TBLH and data memory
Description The low byte of ROM code (current page) addressed by the table pointer (TBLP) is moved
to the specified data memory and the high byte transferred to TBLH directly.
Operation [m] ¬ ROM code (low byte)
TBLH ¬ ROM code (high byte)
Affected flag(s)
TC2 TC1 TO PD OV Z AC C
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
TABRDL [m] Move the ROM code (last page) to TBLH and data memory
Description The low byte of ROM code (last page) addressed by the table pointer (TBLP) is moved to
the data memory and the high byte transferred to TBLH directly.
Operation [m] ¬ ROM code (low byte)
TBLH ¬ ROM code (high byte)
Affected flag(s)
TC2 TC1 TO PD OV Z AC C
¾ ¾ ¾ ¾ ¾ ¾ ¾ ¾
¾ ¾ ¾ ¾ ¾ Ö ¾ ¾
¾ ¾ ¾ ¾ ¾ Ö ¾ ¾
¾ ¾ ¾ ¾ ¾ Ö ¾ ¾