The 3850 group (spec. H) is the 8-bit microcomputer based on the
740 family core technology.
The 3850 group (spec. H) is designed for the household products
and office automation equipment and includes serial I/O functions,
8-bit timer, and A-D converter.
NamePin
Power source
CNVSS inputCNVSS
Reset input
Clock input
Clock output
I/O port P0
I/O port P1P10–P17
I/O port P2
I/O port P3
I/O port P4
Functions
•Apply voltage of 2.7 V – 5.5 V to Vcc, and 0 V to Vss.
•This pin controls the operation mode of the chip.
•Normally connected to VSS.
•Reset input pin for active “L.”
•Input and output pins for the clock generating circuit.
•Connect a ceramic resonator or quartz-crystal oscillator between the XIN and XOUT pins to set
the oscillation frequency.
•When an external clock is used, connect the clock source to the XIN pin and leave the XOUT
pin open.
•8-bit CMOS I/O port.
•I/O direction register allows each pin to be individually
programmed as either input or output.
•CMOS compatible input level.
•CMOS 3-state output structure.
•P10 to P17 (8 bits) are enabled to output large current for LED drive.
•8-bit CMOS I/O port.
•I/O direction register allows each pin to be individually
programmed as either input or output.
•CMOS compatible input level.
•P20, P21, P24 to P27: CMOS3-state output structure.
•P22, P23: N-channel open-drain structure.
•8-bit CMOS I/O port with the same function as port P0.
•CMOS compatible input level.
•CMOS 3-state output structure.
•8-bit CMOS I/O port with the same function as port P0.
•CMOS compatible input level.
•CMOS 3-state output structure.
Function except a port function
• Serial I/O2 function pin
• Sub-clock generating circuit I/O
pins (connect a resonator)
• Serial I/O1 function pin
• Serial I/O1 function pin/
Timer X function pin
• A-D converter input pin
• Timer Y function pin
• Interrupt input pins
• Interrupt input pin
• SCMP2 output pin
• Interrupt input pin
• PWM output pin
3
PART NUMBERING
MITSUBISHI MICROCOMPUTERS
3850 Group (Spec. H)
SINGLE-CHIP 8-BIT CMOS MICROCOMPUTER
P r o d u c t n a m e
M 3 8 5 0 3M 4 H– X X XS P
P a c k a g e t y p e
S P : 4 2 P 4 B
F P : 4 2 P 2 R - A / E
S S : 4 2 S 1 B - A
R O M n u m b e r
O m i t t e d i n O n e T i m e P R O M v e r s i o n s h i p p e d i n b l a n k ,
E P R O M v e r s i o n , a n d f l a s h m e m o r y v e r s i o n .
– : s t a n d a r d
O m i t t e d i n O n e T i m e P R O M v e r s i o n s h i p p e d i n b l a n k , E P R O M
v e r s i o n , a n d f l a s h m e m o r y v e r s i o n .
H – : P a r t i a l s p e c i f i c a t i o n c h a n g e d v e r s i o n
R O M / P R O M / F l a s h m e m o r y s i z e
: 3 6 8 6 4 b y t e s
: 4 0 9 6 b y t e s
1
: 8 1 9 2 b y t e s
2
: 1 2 2 8 8 b y t e s
3
: 1 6 3 8 4 b y t e s
4
: 2 0 4 8 0 b y t e s
5
: 2 4 5 7 6 b y t e s
6
: 2 8 6 7 2 b y t e s
7
: 3 2 7 6 8 b y t e s
8
T h e f i r s t 1 2 8 b y t e s a n d t h e l a s t 2 b y t e s o f R O M a r e r e s e r v e d a r e a s ; t h e y
c a n n o t b e u s e d a s a u s e r ’ s R O M a r e a .
H o w e v e r , t h e y c a n b e p r o g r a m m e d o r e r a s e d i n t h e f l a s h m e m o r y v e r s i o n ,
s o t h a t t h e u s e r s c a n u s e t h e m .
9
: 4 0 9 6 0 b y t e s
A
: 4 5 0 5 6 b y t e s
B
: 4 9 1 5 2 b y t e s
C
: 5 3 2 4 8 b y t e s
D
: 5 7 3 4 4 b y t e s
E
: 6 1 4 4 0 b y t e s
F
Fig. 3 Part numbering
M e m o r y t y p e
M: M a s k R O M v e r s i o n
E : E P R O M o r O n e T i m e P R O M v e r s i o n
F: F l a s h m e m o r y v e r s i o n
R A M s i z e
5
0
: 1 9 2 b y t e s
1
: 2 5 6 b y t e s
2
: 3 8 4 b y t e s
3
: 5 1 2 b y t e s
4
: 6 4 0 b y t e s
: 7 6 8 b y t e s
6
: 8 9 6 b y t e s
7
: 1 0 2 4 b y t e s
8
: 1 5 3 6 b y t e s
9
: 2 0 4 8 b y t e s
4
MITSUBISHI MICROCOMPUTERS
3850 Group (Spec. H)
SINGLE-CHIP 8-BIT CMOS MICROCOMPUTER
GROUP EXPANSION
Mitsubishi plans to expand the 3850 group (spec. H) as follows.
Memory Type
Support for mask ROM, One Time PROM, and flash memory versions.
Memory Size
Flash memory size .........................................................32 K bytes
One Time PROM size.....................................................24 K bytes
Mask ROM size ................................................... 8 K to 32 K bytes
RAM size ...............................................................512 to 1 K bytes
P r o d u c t s u n d e r d e v e l o p m e n t o r p l a n n i n g : t h e d e v e l o p m e n t s c h e d u l e a n d s p e c i f i c a t i o n m a y b e r e v i s e d w i t h o u t n o t i c e .
T h e d e v e l o p m e n t o f pl a n n i n g p r o d u c t s m a y b e s t o p p e d .
Mask ROM version
Mask ROM version
Mask ROM version
Mask ROM version
Mask ROM version
One Time PROM version
One Time PROM version (blank)
EPROM version
Mask ROM version
One Time PROM version
One Time PROM version (blank)
Table 4 Differences between 3850 group (standard) and 3850 group (spec. H)
3850 group (spec. H)
Serial I/O
A-D converter
Large current port
3850 group (standard)
1: Serial I/O (UART or Clock-synchronized)
Unserviceable in low-speed mode
5: P13–P17
2: Serial I/O1 (UART or Clock-synchronized)
Serial I/O2 (Clock-synchronized)
Serviceable in low-speed mode
8: P10–P17
Notes on differences between 3850 group (standard) and 3850 group (spec. H)
(1) The absolute maximum ratings of 3850 group (spec. H) is smaller than that of 3850 group (standard).
•Power source voltage Vcc = –0.3 to 6.5 V
•CNVss input voltage VI = –0.3 to Vcc +0.3 V
(2) The oscillation circuit constants of XIN-XOUT, XCIN-XCOUT may be some differences between 3850 group (standard) and 3850 group
(spec. H).
(3) Do not write any data to the reserved area and the reserved bit. (Do not change the contents after rest.)
(4) Fix bit 3 of the CPU mode register to “1”.
(5) Be sure to perform the termination of unused pins.
6
MITSUBISHI MICROCOMPUTERS
3850 Group (Spec. H)
SINGLE-CHIP 8-BIT CMOS MICROCOMPUTER
FUNCTIONAL DESCRIPTION
CENTRAL PROCESSING UNIT (CPU)
The 3850 group (spec. H) uses the standard 740 Family instruction set. Refer to the table of 740 Family addressing modes and
machine instructions or the 740 Family Software Manual for details on the instruction set.
Machine-resident 740 Family instructions are as follows:
The FST and SLW instructions cannot be used.
The STP, WIT, MUL, and DIV instructions can be used.
[Accumulator (A)]
The accumulator is an 8-bit register. Data operations such as data
transfer, etc., are executed mainly through the accumulator.
[Index Register X (X)]
The index register X is an 8-bit register. In the index addressing
modes, the value of the OPERAND is added to the contents of
register X and specifies the real address.
[Index Register Y (Y)]
The index register Y is an 8-bit register. In partial instruction, the
value of the OPERAND is added to the contents of register Y and
specifies the real address.
[Stack Pointer (S)]
The stack pointer is an 8-bit register used during subroutine calls
and interrupts. This register indicates start address of stored area
(stack) for storing registers during subroutine calls and interrupts.
The low-order 8 bits of the stack address are determined by the
contents of the stack pointer. The high-order 8 bits of the stack address are determined by the stack page selection bit. If the stack
page selection bit is “0” , the high-order 8 bits becomes “0016”. If
the stack page selection bit is “1”, the high-order 8 bits becomes
“0116”.
The operations of pushing register contents onto the stack and
popping them from the stack are shown in Figure 6.
Store registers other than those described in Figure 6 with program when the user needs them during interrupts or subroutine
calls.
[Program Counter (PC)]
The program counter is a 16-bit counter consisting of two 8-bit
registers PCH and PCL. It is used to indicate the address of the
next instruction to be executed.
b7
b0
AAccumulator
b7
b0
XIndex register X
b7
b0
YIndex register Y
b7b0
SStack pointer
b7b15b0
H
PC
L
Program counterPC
b7b0
N V T B D I Z CProcessor status register (PS)
Carry flag
Zero flag
Interrupt disable flag
Decimal mode flag
Break flag
Index X mode flag
Overflow flag
Negative flag
Fig. 5 740 Family CPU register structure
7
e
O n - g o i n g R o u t i n
MITSUBISHI MICROCOMPUTERS
3850 Group (Spec. H)
SINGLE-CHIP 8-BIT CMOS MICROCOMPUTER
P u s h r e t u r n a d d r e s s
o n s t a c k
P O P re t u r n
a d d r e s s f r o m s t a c k
I n t e r r u p t r e q u e s t
M ( S )( P CH)
( S )
M ( S )( P CL)
( S )
S u b r o u t i n e
E x e c u t e R T S
( S )
( P CL)M ( S )
( S )
( P CH)M ( S )
( S ) – 1
( S ) + 1
( S ) + 1
( N o t e )
( S ) – 1
E x e c u t e J S R
M ( S )( P CH)
( S )
( S ) – 1
M ( S )( P CL)
( S )
( S ) – 1
M ( S )( P S )
( S )
( S ) – 1
I n t e r r u p t
S e r v i c e R o u t i n e
E x e c u t e R T I
( S )
( S ) + 1
( P S )M ( S )
( S )
( S ) + 1
( P CL)M ( S )
( S )
( S ) + 1
P u s h r e t u r n a d d r e s s
o n s t a c k
P u s h c o n t e n t s o f p r o c e s s o r
s t a t u s r e g i s t e r o n s t a c k
I F l a g i s s e t f r o m “ 0 ” t o “ 1 ”
F e t c h t h e j u m p v e c t o r
P O P c o n t e n t s o f
p r o c e s s o r s t a t u s
r e g i s t e r f r o m s t a c k
P O P r e t u r n
a d d r e s s
f r o m s t a c k
N o t e: C o n d i t i o n f o r a c c e p t a n c e o f a n i n t e r r u p t I n t e r r u p t e n a b l e f l a g i s “ 1 ”
Fig. 6 Register push and pop at interrupt generation and subroutine call
Table 5 Push and pop instructions of accumulator or processor status register
Push instruction to stack
Accumulator
Processor status register
PHA
PHP
I n t e r r u p t d i s a b l e f l a g i s “ 0 ”
( P CH)M ( S )
Pop instruction from stack
PLA
PLP
8
MITSUBISHI MICROCOMPUTERS
3850 Group (Spec. H)
SINGLE-CHIP 8-BIT CMOS MICROCOMPUTER
[Processor status register (PS)]
The processor status register is an 8-bit register consisting of 5
flags which indicate the status of the processor after an arithmetic
operation and 3 flags which decide MCU operation. Branch operations can be performed by testing the Carry (C) flag , Zero (Z) flag,
Overflow (V) flag, or the Negative (N) flag. In decimal mode, the Z,
V, N flags are not valid.
•Bit 0: Carry flag (C)
The C flag contains a carry or borrow generated by the arithmetic
logic unit (ALU) immediately after an arithmetic operation. It can
also be changed by a shift or rotate instruction.
•Bit 1: Zero flag (Z)
The Z flag is set if the result of an immediate arithmetic operation
or a data transfer is “0”, and cleared if the result is anything other
than “0”.
•Bit 2: Interrupt disable flag (I)
The I flag disables all interrupts except for the interrupt
generated by the BRK instruction.
Interrupts are disabled when the I flag is “1”.
•Bit 3: Decimal mode flag (D)
The D flag determines whether additions and subtractions are
executed in binary or decimal. Binary arithmetic is executed when
this flag is “0”; decimal arithmetic is executed when it is “1”.
Decimal correction is automatic in decimal mode. Only the ADC
and SBC instructions can be used for decimal arithmetic.
•Bit 4: Break flag (B)
The B flag is used to indicate that the current interrupt was
generated by the BRK instruction. The BRK flag in the processor
status register is always “0”. When the BRK instruction is used to
generate an interrupt, the processor status register is pushed
onto the stack with the break flag set to “1”.
•Bit 5: Index X mode flag (T)
When the T flag is “0”, arithmetic operations are performed
between accumulator and memory. When the T flag is “1”, direct
arithmetic operations and direct data transfers are enabled
between memory locations.
•Bit 6: Overflow flag (V)
The V flag is used during the addition or subtraction of one byte
of signed data. It is set if the result exceeds +127 to -128. When
the BIT instruction is executed, bit 6 of the memory location
operated on by the BIT instruction is stored in the overflow flag.
•Bit 7: Negative flag (N)
The N flag is set if the result of an arithmetic operation or data
transfer is negative. When the BIT instruction is executed, bit 7 of
the memory location operated on by the BIT instruction is stored
in the negative flag.
Table 6 Set and clear instructions of each bit of processor status register
C flagZ flagI flagD flagB flagT flagV flagN flag
Set instruction
Clear instruction
SEC
CLC
_
_
SEI
CLI
SED
CLD
_
_
SET
CLTCLV
_
_
_
9
[CPU Mode Register (CPUM)] 003B16
The CPU mode register contains the stack page selection bit, etc.
The CPU mode register is allocated at address 003B16.
T i m e r c o u n t s o u r c e s e l e c t i o n r e g i s t e r ( T C S S )
1 6
1 6
1 6
1 6
R e s e r v e d ✽
R e s e r v e d ✽
1 6
1 6
R e s e r v e d ✽
1 6
R e s e r v e d ✽
1 6
R e s e r v e d ✽
1 6
R e s e r v e d ✽
1 6
R e s e r v e d ✽
1 6
1 6
A - D c o n t r o l r e g i s t e r ( A D C O N )
1 6
A - D c o n v e r s i o n l o w - o r d e r r e g i s t e r ( A D L )
1 6
A - D c o n v e r s i o n h i g h - o r d e r r e g i s t e r ( A D H )
1 6
1 6
R e s e r v e d ✽
M I S R G
1 6
W a t c h d o g t i m e r c o n t r o l r e g i s t e r ( W D T C O N )
1 6
I n t e r r u p t e d g e s e l e c t i o n r e g i s t e r ( I N T E D G E )
1 6
C P U m o d e r e g i s t e r ( C P U M )
1 6
I n t e r r u p t r e q u e s t r e g i s t e r 1 ( I R E Q 1 )
1 6
I n t e r r u p t r e q u e s t r e g i s t e r 2 ( I R E Q 2 )
1 6
I n t e r r u p t c o n t r o l r e g i s t e r 1 ( I C O N 1 )
1 6
I n t e r r u p t c o n t r o l r e g i s t e r 2 ( I C O N 2 )
1 6
✽ R e s e r v e d : D o n o t w r i t e a n y d a t a t o t h i s a d d r e s s e s , b e c a u s e t h e s e a r e a s a r e r e s e r v e d .
Fig. 9 Memory map of special function register (SFR)
12
I/O PORTS
The I/O ports have direction registers which determine the input/
output direction of each individual pin. Each bit in a direction
register corresponds to one pin, and each pin can be set to be
input port or output port.
When “0” is written to the bit corresponding to a pin, that pin
becomes an input pin. When “1” is written to that bit, that pin
becomes an output pin.
If data is read from a pin which is set to output, the value of the
port output latch is read, not the value of the pin itself. Pins set to
input are floating. If a pin set to input is written to, only the port
output latch is written to and the pin remains floating.