EM73866 is an advanced single chip CMOS 4-bit micro-controller. It contains 8K-byte ROM, 500-nibble RAM,
4-bit ALU, 13-level subroutine nesting, 22-stage time base, two 12-bit timer/counters for the kernel function.
EM73866 also contains 6 interrupt sources, 2 input port, 7 bidirection ports, Max LCD display (32x4), built-in
watch-dog-timer and high speed Timer/Counter.
EM73866 has plentiful operating modes (SLOW, IDLE, STOP) intended to reduce the power consumption.
Instruction set: 107 powerful instructions.
Instruction cycle time : Up to 2us for 4 MHz (high speed clock).
ROM capacity: 8192 X 8 bits.
RAM capacity: 500 X 4 bits.
Input port: 2 ports (P0, P2), P0(0..3), P2 (0..3), IDLE/STOP releasing function are available
Bidirection port: 7 ports (P1, P3, P4, P5, P6, P7, P8). P4.1 is shared with HTC external input.
12-bit timer/counter: Two 12-bit timer/counters are programmable for timer, event counter and pulse width
Built-in watch-dog-timer : It is available by mask option.
Built-in time base counter : 22 stages.
Built-in high Speed Timer/Counter : Could be timer, melody out or pulse width measurement.
Subrountine nesting: Up to 13 levels.
normal current push-pull
high current push-pull
NMOS open-drain
PMOS open-drain
* This specification are subject to be changed without notice.
12.29.1999
2
EM73866
4-BIT MICRO-CONTROLLER FOR LCD PRODUCT
PIN DESCRIPTIONS
Symbol Pin-typeFunction
P3(0,1)/SEG(30,31) I/O-O2-bit bidirection I/O pins are shared with LCD segment pin
mask option :segment pin
low current push-pull
normal current push-pull
open-drain
P3(2,3), P6(0,1) I/O-N4-bit bidirection I/O pins
mask option :low current push-pull
normal current push-pull
open-drain
P4.0/SOUND/WAKEUP8 I/O-R11-bit bidirection I/O with inverse sound output and IDLE/STOP
releasing function.
mask option :wakeup disable, low current push-pull
wakeup disable, normal current push-pull
wakeup disable, high current push-pull
wakeup disable, open-drain
wakeup disable, SOUND
wakup enable, low current push-pull
wakeup enable, normal current push-pull
P4.1(TRGH)/WAKEUP9 I/O-R11-bit bidirection I/O with HTC output and IDLE/STOP releasing
function.
mask option :wakeup disble, low current push-pull
wakeup disable, normal current push-pull
wakeup disable, high current push-pull
wakeup disable, NMOS open-drain
wakeup disable, PMOS open-drain
wakeup enable, low current push-pull
wakeup enable, normal current push-pull
P4(2,3)/WAKEUP(10,11) I/O-R12-bit bidirection I/O pins with IDLE/STOP releasing function
mask option :wakeup disble, low current push-pull
wakeup disable, normal current push-pull
wakeup disable, high current push-pull
wakeup disable, NMOS open-drain
wakeup disable, PMOS open-drain
wakeup enable, low current push-pull
wakeup enable, normal current push-pull
P5(0..3)/WAKEUP(12..15) I/O-S4-bit bidirection I/O pins with IDLE/STOP releasing function
mask option :wakeup disable, low current push-pull
wakeup disable, normal current push-pull
wakeup disable, open-drain
wakeup enable, low current push-pull
wakeup enable, normal current push-pull
P7.0/TRGA/WAKEUPDI/O-S2-bit bidirection I/O pins with timer/counterA, B external intput and
P8.1/TRGB/WAKEUPBIDLE/STOP releasing function
mask option :wakeup disable, low current push-pull
wakeup disable, normal current push-pull
wakeup disable, open-drain
wakeup enable, low current push-pull
wakeup enable, normal current push-pull
* This specification are subject to be changed without notice.
12.29.1999
3
4-BIT MICRO-CONTROLLER FOR LCD PRODUCT
PIN DESCRIPTIONS
Symbol Pin-typeFunction
P8.0(INT1)/WAKEUPAI/O-S2-bit bidirection I/O pins with interrupt 0, 1 external intput and
P8.2(INT0)/WAKEUPCIDLE/STOP releasing function
mask option :wakeup disable, low current push-pull
wakeup disable, normal current push-pull
wakeup disable, open-drain
wakeup enable, low current push-pull
wakeup enable, normal current push-pull
COM(0..3)--LCD common pins
SEG(0..29)--LCD segment pins
V1, V2, V3, V
RLC
--LCD bias pins
EM73866
FUNCTION DESCRIPTIONS
PROGRAM ROM ( 8K X 8 bits )
8 K x 8 bits program ROM contains user's program and some fixed data.
The basic structure of the program ROM may be categorized into 5 partitions.
1. Address 0000h: Reset start address.
2. Address 0002h - 000Ch : 6 kinds of interrupt service routine entry addresses.
3. Address 000Eh - 0086h : SCALL subroutine entry address, only available at 000Eh, 0016h, 001Eh, 0026h, 002Eh,
0036h, 003Eh, 0046h, 004Eh, 0056h, 005Eh, 0066h, 006Eh, 0076h, 007Eh, 0086h.
Subroutine call entry address
designated by [LCALL a]
instruction
Data table for
[LDAX],[LDAXI]
instruction
DP is a 12-bit data register that stores the program ROM address as pointer for the ROM code data.
User has to initially load ROM address into DP with instructions "STADPL", and "STADPM, STADPH",
then then to obtain the lower nibble of ROM code data by instruction "LDAX" and higher nibble by instruction
"LDAXI"
PROGRAM EXAMPLE: Read out the ROM code of address 1777h by table-look-up instruction.
A total 500-nibble data RAM is available from address 000 to 1FFh. DATA RAM includes the zero page region,
stacks and data areas.
* This specification are subject to be changed without notice.
12.29.1999
5
EM73866
4-BIT MICRO-CONTROLLER FOR LCD PRODUCT
:
:
:
:
:
:
:
:
:
Increment
Level 0
Level 4
Level 8
Level 12
Zero-page
Level 1
Level 5
Level 9
Level 2
Level 6
Level 10
Increment
Level 3
Level 7
Level 11
Bank 0
Bank 1
Address
000h - 00Fh
010h - 01Fh
020h - 02Fh
0C0h - 0CFh
0D0h - 0DFh
0E0h - 0EFh
0F0h - 0F3h
100h - 10Fh
110h - 11Fh
1F0h - 1FFh
ZERO- PAGE:
From 000h to 00Fh is the zero-page location. It is used as the zero-page address mode pointer for the
instruction of "STD #k,y; ADD #k,y; CLR y,b; CMP k,y".
PROGRAM EXAMPLE: To write immediate data "07h" to RAM [03] and to clear bit 2 of RAM [0Eh].
STD#07h, 03h; RAM[03] ← 07h
CLR0Eh,2; RAM[0Eh]
← 0
2
STACK:
There are 13 (maximum) stack levels that user can use for subroutine (including interrupt and CALL).
User can assign any level be the starting stack by providing the level number to stack pointer (SP).
When an instruction (CALL or interrupt) is invoked, before enter the subroutine, the previous PC address
is saved into the stack until returned from those subroutines, the PC value is restored by the data saved in stack.
SPECIAL PURPOSE REGISTER:
The instruction concerning with "Timer/counter", "Data Pointer" and "Stack Pointer" at instruction table 14
be sure the RAM bank must be set in Bank0.
DATA AREA:
Except the area used by user's application, the whole RAM can be used as data area for storing and loading
general data.
ADDRESSING MODE
The 500 nibble data memory consists of two banks (bank 0 and bank 1). There are 244x4 bits (address
000h~0F3h) in bank 0 and 256x4 bits (address 100h~1FFh) in bank 1.
* This specification are subject to be changed without notice.
12.29.1999
6
EM73866
4-BIT MICRO-CONTROLLER FOR LCD PRODUCT
The bank is selected by P9.3. When P9.3 is cleared to "0", the bank 0 is selected. When P9.3 is set to "1", the bank
1 is selected.
There are 3 addressing mode to access the data memory, namely -
(1) Indirect addressing mode:
The address in the certain bank is specified by the HL registers.
P9.3HRLR
RAM address
PROGRAM EXAMPLE: Load the data of RAM address "143h" to RAM address "032h".
The address is the lower 4 bits code of the second byte in the instruction field.This kind of instructions are
only available for the zero page. Area in bank0, even the P9.3 is set.
xxxxxxxx
instruction field
yyyy
RAM address
0
PROGRAM EXAMPLE: Write immediate "0Fh" to RAM address "005h".
STD#0Fh, 05h; RAM[05h]← 0Fh
* This specification are subject to be changed without notice.
0000
yyyy
12.29.1999
7
EM73866
4-BIT MICRO-CONTROLLER FOR LCD PRODUCT
PROGRAM COUNTER (8K ROM)
Program counter ( PC ) is composed by a 13-bit counter, which indicates the next executed address for the
instruction of program ROM instruction.
For BRANCH and CALL instructions, PC is changed by instruction indicated. PC can only indicate the address
from 0000h-1FFFh.
Condition: SF=1; PC ← a ( branch condition satisified )
PCaaaaaaaaaaaa a
SF=0 ; PC ← PC + 3 ( branch condition not satisified )
PCOriginal PC value + 3
(2) Subrountine instruction:
SCALL a
Object code: 1110 nnnn
Condition : PC ← a ; a=8n+6 ; n=1..Fh ; a=86h, n=0
PC00000aaaaa aaa
* This specification are subject to be changed without notice.
12.29.1999
8
4-BIT MICRO-CONTROLLER FOR LCD PRODUCT
LCALL a
Object code: 0100 0aaa aaaa aaaa
Condition: PC ← a
PC00aaaaaaaaaa a
RET
Object code: 0100 1111
Condition: PC ← STACK[SP]; SP + 1
PCThe return address stored in stack
RT I
Object code: 0100 1101
Condition : FLAG. PC ← STACK[SP]; EI ← 1; SP + 1
PCThe return address stored in stack
EM73866
(3) Interrupt acceptance operation:
When an interrupt is accepted, the original PC is pushed into stack and interrupt vector will be loaded into
PC,The interrupt vectors are as following:
INT0 (External interrupt from P8.2)
PC0000000000010
TRGH (High speed counter interrupt)
PC0000000000100
TRGA (Timer A overflow interrupt)
PC0000000000110
TRGB (Time B overflow interrupt)
PC0000000001000
TBI (Time base interrupt)
PC0000000001010
INT1 (External interrupt from P8.0)
PC0000000001100
(4) Reset operation:
PC000000000000 0
* This specification are subject to be changed without notice.
12.29.1999
9
EM73866
4-BIT MICRO-CONTROLLER FOR LCD PRODUCT
(5) Other operations:
For 1-byte instruction execution: PC + 1
For 2-byte instruction execution: PC + 2
For 3-byte instruction execution: PC + 3
ACCUMULATOR
Accumulator is a 4-bit data register for temporary data. For the arithematic, logic and comparative opertion
.., ACC plays a role which holds the source data and result.
FLAGS
There are 3 kinds of flag, CF ( Carry flag ), ZF ( Zero flag ), SF ( Status flag ), these 3 1-bit flags are affected
by the arithematic, logic and comparative .... operation.
All flags will be put into stack when an interrupt subrountine is served, and the flags will be restored after
RTI instruction executed.
(1) Carry Flag ( CF )
The carry flag is affected by following operation :
a. Addition : CF as a carry out indicator, when the addition operation has a carry-out, CF will be "1", in
another word, if the operation has no carry-out, CF will be "0".
b. Subtraction : CF as a borrow-in indicator, when the subtraction operation must has a borrow-in, the CF
will be "0", in another word, if no borrow-in, CF will be "1".
c. Comparision : CF is as a borrow-in indicator for Comparision operation as the same as subtraction
operation.
d. Rotation : CF shifts into the empty bit of accumulator for the rotation and holds the shift out data after
rotation.
e. CF test instruction : For TFCFC instruction, the content of CF sends into SF then clear itself "0".
For TTSFC instruction, the content of CF sends into SF then set itself "1".
(2) Zero Flag ( ZF )
ZF is affected by the result of ALU, if the ALU operation generate a "0" result, the ZF will be "1", otherwise,
the ZF will be "0".
(3) Status Flag ( SF )
The SF is affected by instruction operation and system status.
a. SF is initiated to "1" for reset condition.
b. Branch instruction is decided by SF, when SF=1, branch condition will be satisified, otherwise, branch
condition will not be satisified by SF = 0.
PROGRAM EXAMPLE:
Check following arithematic operation for CF, ZF, SF
* This specification are subject to be changed without notice.
The arithematic operation of 4-bit data is performed in ALU unit. There are 2 flags can be affected by the
result of ALU operation, ZF and SF. The operation of ALU can be affected by CF only.
ALU STRUCTURE
ALU supported user arithematic operation function, including : addition, subtraction and rotaion.
DATA BUS
ALU
ZF CF SF
ALU FUNCTION
(1) Addition:
For instruction ADDAM, ADCAM, ADDM #k, ADD #k,y .... ALU supports additional function.
The additional operation can affect CF and ZF. For additional operation, if the result is "0", ZF will be
"1", otherwise, not equal "0", ZF will be "0". When the addition operation has a carry-out, CF will be "1",
otherwise, CF will be "0".
EXAMPLE:
OperationCarryZero
3+4=700
7+F=610
0+0=001
8+8=011
(2) Subtraction:
For instruction SUBM #k, SUBA #k, SBCAM, DECM... ALU supports user subtraction function. The
subtraction operation can affect CF and ZF, For subtraction operation, if the result is negative, CF will
be "0", it means a borrow out, otherwise, if the result is positive, CF will be "1". For ZF, if the result
of subtraction operation is "0", the ZF will be "1", otherwise, ZF will be "1".
* This specification are subject to be changed without notice.
There are two kinds of rotation operation, one is rotation left, the other is rotation right.
RLCA instruction rotates Acc value to left, shift the CF value into the LSB bit of Acc and the shift out data
will be hold in CF.
MSBLSB
ACC
CF
RRCA instruction operation rotates Acc value to right, shift the CF value into the MSB bit of Acc and the
shift out data will be hold in CF.
MSBLSB
ACC
CF
PROGRAM EXAMPLE: To rotate Acc right and shift a "1" into the MSB bit of Acc.
TTCFS; CF ← 1
RRCA; rotate Acc right and shift CF=1 into MSB.
HL REGISTER
HL register are two 4-bit registers, they are used as a pair of pointer for the address of RAM memory and also
2 independent temporary 4-bit data registers. For some instruction, L register can be a pointer to indicate the
pin number (Port4).
HL REGISTER STRUCTURE
3 2 1 0
3 2 1 0
H REGISTER
* This specification are subject to be changed without notice.
L REGISTER
12.29.1999
12
Loading...
+ 27 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.