MC40P5004 MC40P5204 MC40P5404: User's Manual
MC40P5004 MC40P5204 MC40P5404: User's Manual
MC40P5004 MC40P5204 MC40P5404: User's Manual
MC40P5004
MC40P5204
MC40P5404
User’s Manual
REVISION HISTORY
VERSION 1.01 (Sep 3, 2010) this book
Corrected the instruction explanation of NEGA, ALEI, EORM.
VERSION 1.0 (Aug 12, 2010)
Added circuit diagram of MC40P5404.
VERSION 0.3 (MAY 11, 2010)
The REMDRV port was renamed to REMOUT port.
The MC40P5004R model was changed to 20SSOP package from 20TSSOP.
VERSION 0.2 (Nov 11, 2009)
The package with push-pull REMOUT port (MC40P5102 and MC40P5304) is removed from line-up.
The 20TSSOP package model MC40P5004R is added to line-up.
VERSION 0.1 (Apr 21, 2008)
Version 1.01
Published by FAE Team
2009 ABOV Semiconductor Co., Ltd. All rights reserved.
Additional information of this manual may be served by ABOV Semiconductor offices in Korea or
Distributors.
ABOV Semiconductor reserves the right to make changes to any information here in at any time without
notice.
The information, diagrams and other data in this manual are correct and reliable; however, ABOV
Semiconductor is in no way responsible for any violations of patents or other rights of the third party
generated by the use of this manual.
Table of Contents
1. OVERVIEW ...................................................................................................................................................... 4
1.1 Description ................................................................................................................................................... 4
1.2 Features ........................................................................................................................................................ 4
1.3 Ordering Information ................................................................................................................................... 5
2. BLOCK DIAGRAM ......................................................................................................................................... 6
2.1 MC40P5004 (20 pin package) ..................................................................................................................... 6
2.2 MC40P5204 (24 pin package) ..................................................................................................................... 7
2.3 MC40P5404 (20 pin package) ..................................................................................................................... 8
3. PIN ASSIGNMENT ......................................................................................................................................... 9
4. PACKAGE DIAGRAM .................................................................................................................................. 10
5. PIN DESCRIPTION ....................................................................................................................................... 13
5.1 PIN DESCRIPTION .................................................................................................................................. 13
6. PORT STRUCTURES .................................................................................................................................. 14
7. ELECTRICAL CHARACTERISTICS ......................................................................................................... 16
7.1 Absolute Maximum Ratings (Ta = 25℃) .................................................................................................. 16
7.2 Recommended Operating Conditions ........................................................................................................ 16
7.3 Electrical characteristics (Ta=25℃, VDD= 3V) .......................................................................................... 16
8. Architecture .................................................................................................................................................. 19
8.1 Program Memory (EPROM) ...................................................................................................................... 19
8.2 EPROM Address Register ......................................................................................................................... 20
8.3 Data memory (RAM) ................................................................................................................................. 21
8.4 X-register (X) ............................................................................................................................................. 22
8.5 Y-register (Y) ............................................................................................................................................. 22
8.6 Accumulator (Acc) .................................................................................................................................... 22
8.7 Arithmetic and Logic Unit (ALU) ............................................................................................................. 22
8.8 State Counter (SC) ..................................................................................................................................... 22
8.9 Clock Generator ......................................................................................................................................... 23
8.10 Pulse Generator ........................................................................................................................................ 24
8.11 Reset Operation........................................................................................................................................ 25
8.12 STOP Operation ....................................................................................................................................... 27
8.13 Port Operation .......................................................................................................................................... 27
9. Instruction ..................................................................................................................................................... 28
9.1 Instruction Table ........................................................................................................................................ 29
9.2 DETAILS OF INSTRUCTION SYSTEM................................................................................................. 31
9.3 Assembler Macro ....................................................................................................................................... 44
10. SPGM(Serial Program) ............................................................................................................................. 45
Summary of Protocol ....................................................................................................................................... 45
11. APPLICATION ............................................................................................................................................ 49
11.1 Circuit Diagram of MC40P5004 and MC40P5404 .................................................................................. 49
MC40P5004
MC40P5204
MC40P5404
CMOS SINGLE-CHIP 4-BIT MICROCONTROLLER
1. OVERVIEW
1.1 Description
The MC40P5x04 series is 4-bit remote control MCU which uses CMOS technology and the 4K bytes EPROM
version. This enables transmission code outputs of different configurations, multiple custom code output, and
double push key output for easy fabrication. The MC40P5x04 series is suitable for remote control of TV, VCR,
FANS, Air-conditioners, Audio Equipments, Toys, Games etc.
1.2 Features
Data memory 32 x 4
I/O Ports 2 2 2 2
Input Ports 6 6 6 6
Output Ports 6 6 10 7
(D0~D5) (D0~D5) (D0~D9) (D0~D6)
Built-in Drive O O O O
Tr.
2. BLOCK DIAGRAM
VDD GND
20 1
Power-on
Watchdog Reset
EPROM timer
4bank 64word 12 3-level
16 page Program counter
Stack
8 8 bit
12
4 4
8 4
M
U 4
Instruction
Decoder X
MUX ALU
4 4
4
Control Signal 2 RAM RAM
X-reg 16 Y-reg ST
16word Word 4
2page 4bit Selector
ACC
4 6
R-Latch D-Latch
OSC Pulse
Generator
4 4 4 I.R. LED
Drive Tr
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
OSC1 OSC2 K0 ~ K3 R0 ~ R3 D0 D1 D2 D3 D4 D5 PGND REMOUT
VDD GND
24 1
Power-on
Watchdog Reset
EPROM timer
4bank 64word 12 3-level
16 page Program counter
Stack
8 8 bit
12
4 4
8 4
M
U 4
Instruction
Decoder X
MUX ALU
4 4
4
Control Signal 2 RAM RAM
X-reg 16 Y-reg ST
16word Word 4
2page 4bit Selector
ACC
4 10
R-Latch D-Latch
OSC Pulse
Generator
10
4 4 4 I.R. LED
Drive Tr
2 3 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 4 22 23
OSC1 OSC2 K0 ~ K3 R0 ~ R3 D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 PGND REMOUT
VDD GND
20 1
Power-on
Watchdog Reset
EPROM timer
4bank 64word 12 3-level
16 page Program counter
Stack
8 8 bit
12
4 4
8 4
M
U 4
Instruction
Decoder X
MUX ALU
4 4
4
Control Signal 2 RAM RAM
X-reg 16 Y-reg ST
16word Word 4
2page 4bit Selector
ACC
4 6
R-Latch D-Latch
OSC Pulse
Generator
4 4 4 I.R. LED
Drive Tr
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
OSC1 OSC2 K0 ~ K3 R0 ~ R3 D0 D1 D2 D3 D4 D5 D6 REMOUT
3. PIN ASSIGNMENT
MC40P5404
OSC2 3 18 PGND OSC2 3 18 D6
K1 5 16 D4 K1 5 16 D4
K2 6 15 D3 K2 6 15 D3
VPP/K3 7 14 D2 VPP/K3 7 14 D2
R0 8 13 D1 R0 8 13 D1
R1 9 12 D0 R1 9 12 D0
R2 10 11 R3 R2 10 11 R3
Fig 3-1 MC40P5004 Pin Assignment Fig 3-3 MC40P5404 Pin Assignment
(20 PIN) (20 PIN)
REMOUT : open drain output REMOUT : open drain output
VPP : K3 ( PIN No.7) VPP : K3 ( PIN No.7)
GND 1 24 VDD
OSC1 2 23 REMOUT
OSC2 3 22 PGND
MC40P5204
D9 4 21 D8
SCL/K0 5 20 D7
K1 6 19 D6
K2 7 18 D5/SDA
VPP/K3 8 17 D4
R0 9 16 D3
R1 10 15 D2
R2 11 14 D1
R3 12 13 D0
4. PACKAGE DIAGRAM
5. PIN DESCRIPTION
6. PORT STRUCTURES
- CMOS output.
- "H" output at reset.
R2 ~ R3 I/O - Built in MOS Tr for
pull-up, about 140 ㏀.
OSC2 O
- Built in feedback-resistor
about 1 ㏁
OSC1 I
Note: The gate voltage of REMOUT port (NMOS Transistor) is always higher than VDD voltage when it
drives REMOUT port as Logic “LOW”..
7. ELECTRICAL CHARACTERISTICS
Limits
Parameter Symbol Unit Condition
Min. Typ. Max.
Fig 7-2. IOL4 vs. VOL4 Graph (REMOUT Port with built-in Transistor of MC40P5004,MC40P5204 and MC40P5404)
8. Architecture
The MC40P5x04 series can incorporate maximum 4,096 words (4 bank x 64 words x 16 page x 8bits) for
program memory. Program counter PC (A0~A5), Page address register (A6~A9) and Bank address register
(A10, A11) are used to address the whole area of program memory having an instruction (8bits) to be next
executed.
The program memory consists of 64 words on each page, and thus each page can hold up to 64 steps of
instructions.
The program memory is composed as shown below
Bank 0
Bank 3
0 1
2
8 3 4
5 6
7
63
2
0 1 2 15
Program counter (PC) Page address register (PA) 6 Page Buffer (PB)
6 6
( Level “2” )
PA/PB PC
Command PA PB PC
XX_XXXX XX_XXXX pc
bits so that page and word can not be specified at the same time.
In case a return instruction (RTN) is executed within the subroutine that has been called In the other page, the
page address will be changed at the same time.
Up to 32 nibbles (16 words x 2pages x 4bits) is incorporated for storing data. The whole data memory area is
indirectly specified by a data pointer (X, Y). Page number is specified by zero bit of X register, and words in
the page by 4 bits in Y-register. Data memory is composed in 16 nibbles/page. Figure 8-3 shows the
configuration.
Output port 0
1
2
3
page 0 page 1
12
13
14
15
4 A0 ~ A3
0 1
4 2
X-register is consist of 2bit, X0 is a data pointer of page in the RAM, X1 is only used for selecting of D8~D9
with value of Y-register
X1 = 0 X1 = 1
(X=0 or 1) (X=2 or 3)
Y=0 D0 D8
Y=1 D1 D9
Table 8-1 Mapping table between X and Y register for port access
In this unit, 4bits of adder/comparator are connected in parallel as it's main components and they are combined
with status latch and status logic (flag.)
A fundamental machine cycle timing chart is shown below. Every instruction is one byte length. Its
execution time is the same. Execution of one instruction takes 48 clocks for fetch cycle and 48clocks for
execute cycle (96 clocks in total).
Virtually these two cycles proceed simultaneously, and thus it is apparently completed in 48clocks (one
machine cycle). Exceptionally BR, CAL and RTN instructions is normal execution time since they change an
addressing sequentially. Therefore, the next instruction is prefetched so that its execution is completed within
the fetch cycle.
Phase I
Phase II
Phase III
The oscillator circuit is designed to operate with an external ceramic resonator. Oscillator circuit is able to
organize by connecting ceramic resonator to outside.
* It is necessary to connect capacitor to outside in order to change ceramic resonator, you must refer to a
manufacturer`s resonator matching guide.
OSC1 OSC2
C1 C2
The following frequency and duty ratio are selected for carrier signal outputted from the REMOUT port
depending on a PMR (Pulse Mode Register) value set in a program.
T1
REMOUT port
Carrier frequency
PMR REMOUT signal
(fOSC = 3.64MHz)
0 T=1/fPUL = 96/ fOSC, T1/T = 1/2 37.92KHz
MC40P5x04 series have three reset sources. One is a built-in Power-on reset circuit,
Another is a built-in Low VDD Detection circuit, the other is the overflow of Watch Dog Timer
WDT). All reset operations are internal in the MC40P5x04 series.
MC40P5x04 series has a built-in Power-on reset circuit consisting of an about 1 ㏁ Resistor and a 3pF
Capacitor. When the Power-on reset pulse occurs, system reset signal is latched and WDT is cleared. After the
overflow time of WDT(213 x System clock time), system reset signal is released.
VCC
1MΩ
Counter System
( WDT ) RESETB
3pF
GND
VCC
System
RESETB
VDD
RESET
Voltage
Internal
RESETB
Watch dog timer is organized binary of 14 steps. The signal of fosc /48 or fosc/12 cycle comes in the first step
of WDT after WDT reset. If this counter was overflowed, reset signal automatically come out so that internal
circuit is initialized.
The overflow time is 8 x 6 x 213 /fosc (108.026ms at fosc = 3.64MHz)
Normally, the binary counter must be reset before the overflow by using reset instruction (WDTR), Power-on
reset pulse or Low VDD detection pulse.
* It is constantly reset in STOP mode. When STOP is released, counting is restarted. (Refer to STOP operation)
Binary counter
fosc/48 or 12 ( 14 steps )
RESET (edge-trigger )
Reset
by instruction
Power-on Reset
RO : REMOUT ← 1 (High-Z)
SO : D0 ~ D9 ← 1 (High-Z)
0 or 1 9
RO : D0 ~ D9 ← 0
SO : R(Y-Ah) ← 1
0 or 1 A~D
RO : R(Y-Ah) ← 0
SO : R0 ~ R3 ← 1
0 or 1 E
RO : R0 ~ R3 ← 0
SO : D0 ~ D9 ← 1, R0 ~ R3 ← 1
0 or 1 F
RO : D0 ~ D9 ← 0, R0 ~ R3 ← 0
SO : D(8) ← 1
2 or 3 0
RO : D(8) ← 0
SO : D(9) ← 1
2 or 3 1
RO : D(9) ← 0
9. Instruction
INSTRUCTION FORMAT
All of the 43 instruction in MC40P5x04 series is format in two fields of OP code and operand which consist of
eight bits. The following formats are available with different types of operands.
*FormatⅠ
All eight bits are for OP code without operand.
*FormatⅡ
Two bits are for operand and six bits for OP code. Two bits of operand are used for specifying bits of RAM and
X-register (bit 1 and bit 7 are fixed at ″0″)
*FormatⅢ
Four bits are for operand and the others are OP code. Four bits of operand are used for specifying a constant
loaded in RAM or Y-register, a comparison value of compare command, or page addressing in ROM.
*Format Ⅳ
Six bits are for operand and the others are OP code. Six bits of operand are used for word addressing in the
ROM.
1 LAY A ← Y S
Register to
2 LYA Y ← A S
Register
3 LAZ A ← 0 S
4 LMA M(X, Y) ← A S
5 LMAIY M(X, Y) ← A, Y ← Y + 1 S
RAM to
6 LYM Y ← M(X, Y) S
Register
7 LAM A ← M(X, Y) S
8 XMA A ↔ M(X, Y) S
9 LYI i Y ← i S
11 LXI n X ← n S
12 SEM n M(n) ← 1 S
RAM Bit
13 REM n M(n) ← 0 S
Manipulation
14 TM n TEST M(n) ← 1 E
15 BR a if ST = 1 then Branch S
19 AM A ← A + M(X, Y) C
20 SM A ← M(X, Y) – A B
21 IM A ← M(X, Y) + 1 C
Arithmetic
22 DM A ← M(X, Y) - 1 B
23 IA A ← A+1 S
24 IY Y ← Y+1 C
25 DA A ← A-1 B
26 DY Y ← Y-1 B
Arithmetic
27 EORM A ← A M(X, Y) S
28 NEGA A ← +1 Z
30 ALEI i TEST A i E
33 YNEI i TEST Y i N
34 KNEZ TEST K 0 N
35 RNEZ TEST R 0 N
36 LAK A ← K S
37
Input/
LAR A ← R S
Output
38 SO Output(Y) ← 1*2 S
39 RO Output(Y) ← 0*2 S
43 NOP No operation S
All 43 basic instructions of the MC40P5X04 Series are one by one described in detail below.
Description Form.
Each instruction is headlined with its mnemonic symbol according to the instructions table given earlier. Then,
for quick reference, it is described with basic items as shown below. After that, detailed comment follows.
*Items :
- Naming : Full spelling of mnemonic symbol
- Status : Check of status function
- Format : Categorized into Ⅰ to Ⅳ
- Operand : Omitted for Format Ⅰ
- Function
(1) LAY
Naming : Load Accumulator from Y-Register
Status : Set
Format : I
Function : A ← Y
<Comment> Data of four bits in the Y-register is unconditionally transferred to the accumulator. Data
in the Y-register is left unchanged.
(2) LYA
Naming : Load Y-register from Accumulator
Status : Set
Format : I
Function : Y ← A
<Comment> Load Y-register from Accumulator
(3) LAZ
Naming : Clear Accumulator
Status : Set
Format : I
Function : A ← 0
<Comment> Data in the accumulator is unconditionally reset to zero.
(4) LMA
Naming : Load Memory from Accumulator
Status : Set
Format : I
Function : M(X,Y) ← A
<Comment> Data of four bits from the accumulator is stored in the RAM location addressed by the X-
register and Y-register. Such data is left unchanged.
(5) LMAIY
Naming : Load Memory from Accumulator and Increment Y-Register
Status : Set
Format : I
Function : M(X,Y) ← A, Y ← Y+1
<Comment> Data of four bits from the accumulator is stored in the RAM location addressed by the X
register and Y-register. Such data is left unchanged.
(6) LYM
Naming : Load Y-Register form Memory
Status : Set
Format : I
Function : Y ← M(X,Y)
<Comment> Data from the RAM location addressed by the X-register and Y-register is loaded into the
Y-register. Data in the memory is left unchanged.
(7) LAM
Naming : Load Accumulator from Memory
Status : Set
Format : I
Function : A ← M(X,Y)
<Comment> Data from the RAM location addressed by the X-register and Y-register is loaded into the
Y-register. Data in the memory is left unchanged.
(8) XMA
Naming : Exchanged Memory and Accumulator
Status : Set
Format : I
Function : M(X,Y) ↔ A
<Comment> Data from the memory addressed by X-register and Y-register is exchanged with data from
the accumulator. For example, this instruction is useful to fetch a memory word into the
accumulator for operation and store current data from the accumulator into the RAM. The
accumulator can be restored by another XMA instruction.
(9) LYI i
Naming : Load Y-Register from Immediate
Status : Set
Format : Ⅲ
Operand : Constant 0 ≤ i ≤ 15
Function : Y ← i
<Purpose> To load a constant in Y-register. It is typically used to specify Y-register in a particular
RAM word address, to specify the address of a selected output line, to set Y-register for
specifying a carrier signal outputted from OUT port, and to initialize Y-register for loop
control. The accumulator can be restored by another XMA instruction.
<Comment> Data of four bits from operand of instruction is transferred to the Y-register.
(10) LMIIY i
Naming : Load Memory from Immediate and Increment Y-Register
Status : Set
Format : Ⅲ
Operand : Constant 0 ≤ i ≤ 15
(11) LXI n
Naming : Load X-Register from Immediate
Status : Set
Format : Ⅱ
Function : X ← n
<Comment> A constant is loaded in X-register. It is used to set X-register in an index of desired RAM
page. Operand of 1 bit of command is loaded in X-register.
(12) SEM n
Naming : Set Memory Bit
Status : Set
Format : Ⅱ
Function : M(X,Y,n) ← 1
<Comment> Depending on the selection in operand of operand, one of four bits is set as logic 1 in the
RAM memory addressed in accordance with the data of the X-register and Y-register.
(13) REM n
Naming : Reset Memory Bit
Status : Set
Format : Ⅱ
Function : M(X,Y,n) ← 0
<Comment> Depending on the selection in operand of operand, one of four bits is set as logic 0 in the
RAM memory addressed in accordance with the data of the X-register and Y-register.
(14) TM n
Naming : Test Memory Bit
Status : Comparison results to status
Format : Ⅱ
(15) BR a
Naming : Branch on status 1
Status : Conditional depending on the status
Format : Ⅳ
Operand : Branch address a (Addr)
Function : When ST =1 , PA ← PB, PC ← a(Addr)
When ST = 0, PC ← PC + 1, ST ← 1
Note : PC indicates the next address in a fixed sequence that is actually pseudo-random
count.
<Purpose> For some programs, normal sequential program execution can be change. A branch is
conditionally implemented depending on the status of results obtained by executing the
previous instruction.
<Comment> • Branch instruction is always conditional depending on the status.
a. If the status is reset (logic 0), a branch instruction is not rightly executed but the next
instruction of the sequence is executed.
b. If the status is set (logic 1), a branch instruction is executed as follows.
• Branch is available in two types - short and long. The former is for addressing in the
current page and the latter for addressing in the other page. Which type of branch to
execute is decided according to the PB register. To execute a long branch, data of the PB
register should in advance be modified to a desired page address through the LPBI
instruction.
(16) CAL a
Naming : Subroutine Call on status 1
Status : Conditional depending on the status
Format : Ⅳ
Operand : Subroutine code address a(Addr)
Function : When ST =1 , PC ← a(Addr) PA ← PB
SR1 ← PC + 1, PSR1 ← PA
When ST = 0, PC ← PC + 1 PB ← PS ST ← 1
Note : PC actually has pseudo-random count against the next instruction.
<Comment> • In a program, control is allowed to be transferred to a mutual subroutine. Since a call
instruction preserves the return address, it is possible to call the subroutine from different
locations in a program, and the subroutine can return control accurately to the address that is
preserved by the use of the call return instruction (RTN).
Such calling is always conditional depending on the status.
a. If the status is reset, call is not executed.
b. If the status is set, call is rightly executed.
The subroutine stack (SR) of three levels enables a subroutine to be manipulated on three
levels. Besides, a long call (to call another page) can be executed on any level.
• For a long call, an LPBI instruction should be executed before the CAL. When LPBI is
omitted (and when PA=PB), a short call (calling in the same page) is executed.
(17) RTN
Naming : Return from Subroutine
Status : Set
Format : Ⅰ
ST ← 1
<Purpose> Control is returned from the called subroutine to the calling program.
<Comment> Control is returned to its home routine by transferring to the PC the data of the return
address that has been saved in the stack register (SR1). At the same time, data of the page
stack register (PSR1) is transferred to the PA and PB.
(18) LPBI i
Naming : Load Page Buffer Register from Immediate
Status : Set
Format : Ⅲ
Function : PB ← i
<Purpose> A new ROM page address is loaded into the page buffer register (PB). This loading is
necessary for a long branch or call instruction. Refer to ABL and ACALL macro.
<Comment> The PB register is loaded together with three bits from 4 bit operand.
(19) AM
Naming : Add Accumulator to Memory and Status 1 on Carry
Status : Carry to status
Format : Ⅰ
(20) SM
Naming : Subtract Accumulator to Memory and Status 1 Not Borrow
Status : Carry to status
Format : Ⅰ
(21) IM
Naming : Increment Memory and Status 1 on Carry
Status : Carry to status
Format : Ⅰ
(22) DM
Naming : Decrement Memory and Status 1 on Not Borrow
Status : Carry to status
Format : Ⅰ
ST ← 0 (when M(X,Y) = 0)
<Comment> Data of the memory addressed by the X and Y-register is fetched, and one is subtracted
from this word (addition of Fh)> Results are stored in the accumulator. Carry data as
results is transferred to the status. If the data is more than or equal to one, the status is set
to indicate that no borrow is caused. The memory is left unchanged.
(23) IA
Naming : Increment Accumulator
Status : Set
Format : Ⅰ
Function : A ← A+1
<Comment> Data of the accumulator is incremented by one. Results are returned to the accumulator.
A carry is not allowed to have effect upon the status.
(24) IY
Naming : Increment Y-Register and Status 1 on Carry
Status : Carry to status
Format : Ⅰ
(25) DA
Naming : Decrement Accumulator and Status 1 on Borrow
Status : Carry to status
Format : Ⅰ
ST ← 0 (when A = 0)
<Comment> Data of the accumulator is decremented by one. As a result (by addition of Fh), if a orrow
is caused, the status is reset to ″0″ by logic. If the data is more than one, no borrow
occurs and thus the status is set to ″1″.
(26) DY
Naming : Decrement Y-Register and Status 1 on Not Borrow
Status : Carry to status
Format : Ⅰ
Function : Y ← Y -1 ST ← 1 (when Y ≥ 1)
ST ← 0 (when Y = 0)
<Purpose> Data of the Y-register is decremented by one.
<Comment> Data of the Y-register is decremented by one by addition of minus 1 (Fh). Carry data as
results is transferred to the status. When the results is equal to 15, the status is set to
indicate that no borrow has not occurred.
(27) EORM
Naming : Exclusive or Memory and Accumulator
Status : Set
Format : Ⅰ
Function : A ← M(X,Y) A
<Comment> Data of the accumulator is, through a Exclusive OR, subtracted from the memory word
addressed by X and Y-register. Results are stored into the accumulator.
(28) NEGA
Naming : Negate Accumulator and Status 1 on Zero
Status : Carry to status
Format : Ⅰ
Function : A ← +1 ST ← 1(when A = 0)
ST ← 0 (when A != 0)
<Purpose> The 2`s complement of a word in the accumulator is obtained.
<Comment> The 2`s complement in the accumulator is calculated by adding one to the 1`s complement
in the accumulator. Results are stored into the accumulator. Carry data is transferred to the
status. When data of the accumulator is zero, a carry is caused to set the status to ″1″.
(29) ALEM
Naming : Accumulator Less Equal Memory
Status : Carry to status
Format : Ⅰ
(30) ALEI
Naming : Accumulator Less Equal Immediate
Status : Carry to status
Format : Ⅲ
Operand : Constant 0 ≤ i ≤ 15
Function : A ≤ i ST ← 1 (when A ≤ i)
ST ← 0 (when A > i)
<Purpose> Data of the accumulator and the constant are arithmetically compared.
<Comment> Data of the accumulator is, through a complemental addition, subtracted from the constant
that exists in 4bit operand. Carry data obtained is transferred to the status. The status is
set when the accumulator value is less than or equal to the constant. Data of the
accumulator is left unchanged.
(31) MNEZ
Naming : Memory Not Equal Zero
Status : Comparison results to status
Format : Ⅰ
Function : M(X,Y) ≠ 0 ST ← 1(when M(X,Y) ≠ 0)
ST ← 0 (when M(X,Y) = 0)
<Purpose> A memory word is compared with zero.
<Comment> Data in the memory addressed by the X and Y-register is logically compared with zero.
Comparison data is transferred to the status. Unless it is zero, the status is set.
(32) YNEA
Naming : Y-Register Not Equal Accumulator
Status : Comparison results to status
Format : Ⅰ
Function : Y ≠ A ST ← 1 (when Y ≠ A)
ST ← 0 (when Y = A)
<Purpose> Data of Y-register and accumulator are compared to check if they are not equal.
<Comment> Data of the Y-register and accumulator are logically compared. Results are transferred to the
status. Unless they are equal, the status is set.
(33) YNEI
Naming : Y-Register Not Equal Immediate
Status : Comparison results to status
Format : Ⅲ
Operand : Constant 0 ≤ i ≤ 15
Function : Y ≠ i ST ← 1 (when Y ≠ i)
ST ← 0 (when Y = i)
<Comment> The constant of the Y-register is logically compared with 4bit operand. Results are
transferred to the status. Unless the operand is equal to the constant, the status is set.
(34) KNEZ
Naming : K Not Equal Zero
Status : The status is set only when not equal
Format : Ⅰ
Function : When K ≠ 0, ST ← 1
<Purpose> A test is made to check if K is not zero.
<Comment> Data on K are compared with zero. Results are transferred to the status. For input data
not equal to zero, the status is set.
(35) RNEZ
Naming : R Not Equal Zero
Status : The status is set only when not equal
Format : Ⅰ
Function : When R ≠ 0, ST ← 1
<Purpose> A test is made to check if R is not zero.
<Comment> Data on R are compared with zero. Results are transferred to the status. For input data not
equal to zero, the status is set.
(36) LAK
Naming : Load Accumulator from K
Status : Set
Format : Ⅰ
Function : A ← K
<Comment> Data on K are transferred to the accumulator
(37) LAR
Naming : Load Accumulator from R
Status : Set
Format : Ⅰ
Function : A ← R
<Comment> Data on R are transferred to the accumulator
(38) SO
Naming : Set Output Register Latch
Status : Set
Format : Ⅰ
Function : D(Y) ← 1 0 ≤ Y ≤ 7
REMOUT(PMR=5) ← 0 Y=8
R(Y) ← 1 Ah ≤ Y ≤ Dh
R ← 1 Y = Eh
D0~D9, R ← 1 Y = Fh
<Purpose> A single D output line is set to logic 1, if data of Y-register is between 0 to 7. Carrier
frequency comes out from REMOUT port, if data of Y-register is 8.
All D output line is set to logic 1, if data of Y-register is 9. It is no operation, if data of Y-
register between 10 to 15.
When Y is between Ah and Dh, one of R output lines is set at logic 1.
When Y is Eh, the output of R is set at logic 1.
When Y is Fh, the output D0~D9 and R are set at logic 1.
<Comment> Data of Y-register is between 0 to 7, selects appropriate D output.
Data of Y-register is 8, selects REMOUT port.
Data of Y-register is 9, selects all D port.
Data in Y-register, when between Ah and Dh, selects an appropriate R output (R0~R3).
Data in Y-register, when it is Eh, selects all of R0~R3.
Data in Y-register, when it is Fh, selects all of D0~D9 and R0~R3.
(39) RO
Naming : Reset Output Register Latch
Status : Set
Format : Ⅰ
Function : D(Y) ← 0 0 ≤ Y ≤ 7
D0~D9 ← 0 Y=9
R(Y) ← 0 Ah ≤ Y ≤ Dh
R ← 0 Y = Eh
D0~D9, R ← 0 Y = Fh
<Purpose> A single D output line is set to logic 0, if data of Y-register is between 0 to 9.
REMOUT port is set to logic 0, if data of Y-register is 9.
All D output line is set to logic 0, if data of Y-register is 9.
When Y is between Ah and Dh, one of R output lines is set at logic 0.
When Y is Eh, the output of R is set at logic 0
When Y is Fh, the output D0~D9 and R are set at logic 1.
<Comment> Data of Y-register is between 0 to 7, selects appropriate D output.
Data of Y-register is 8, selects REMOUT port.
Data of Y-register is 9, selects D port.
Data in Y-register, when between Ah and Dh, selects an appropriate R output (R0~R3).
Data in Y-register, when it is Eh, selects all of R0~R3.
Data in Y-register, when it is Fh, selects all of D0~D9 and R0~R3.
(40) WDTR
Naming : Watch Dog Timer Reset
Status : Set
Format : Ⅰ
Function : Reset Watch Dog Timer (WDT)
<Purpose> Normally, you should reset this counter before overflowed counter for dc watch dog timer.
this instruction controls this reset signal.
(41) STOP
Naming : STOP
Status : Set
Format : Ⅰ
Function : Operate the stop function
<Purpose> Stopped oscillator, and little current.
(See STOP function.)
(42) LPY
Naming : Pulse Mode Set
Status : Set
Format : Ⅰ
Function : PMR ← Y
<Comment> Selects a pulse signal outputted from REMOUT port.
(43) NOP
Naming : No Operation
Status : Set
Format : Ⅰ
Function : No operation
Summary of Protocol
CLKSEL : change the Main Clock fosc/48, fosc/12 (default fosc/48). If you select fosc/12, instruction
cycle is 4 times faster than fosc/48, but Carrier Frequency isn’t affected.
“0” : fosc/12
“1” : fosc/48
ID 7 ID 6 ID 5 ID 4 ID 3 ID 2 ID 1 ID0
※ For protection the written program code, in other words it can not be read, you have to clear the Option
bit to “0”, and for this, you have to write the Option Register to 1111_1110b. In this time, ID7 – ID0
keep the existing value without any effect
ID byte ID 8bit
1110 :
CPU start address is 0x000
1st write 1K
1st write 2K
000 000 000
1st write 4K
1100 :
CPU start address is 0x400
2nd write 1K 400
10X0 :
CPU start address is 0x800 800 800
1000: 3rd write 1K
1010: 2nd write 2K
Case 1K 1K 1K 1K Available
1K*4 O
2K*2 O
4K*1 O
1K, 1K, 2K X
1K, 2K O
1K, 2K, 1K X
2K, 1K, 1K O
1st PGM
2nd PGM
3rd PGM
4th PGM
Expired
11. APPLICATION