R5F21191SP#U0 Renesas Electronics America, R5F21191SP#U0 Datasheet

IC R8C MCU FLASH 8K 20SSOP

R5F21191SP#U0

Manufacturer Part Number
R5F21191SP#U0
Description
IC R8C MCU FLASH 8K 20SSOP
Manufacturer
Renesas Electronics America
Series
M16C™ M16C/R8C/Tiny/19r
Datasheets

Specifications of R5F21191SP#U0

Core Processor
R8C
Core Size
16-Bit
Speed
20MHz
Connectivity
SIO, UART/USART
Peripherals
LED, POR, Voltage Detect, WDT
Number Of I /o
13
Program Memory Size
4KB (4K x 8)
Program Memory Type
FLASH
Ram Size
384 x 8
Voltage - Supply (vcc/vdd)
2.7 V ~ 5.5 V
Data Converters
A/D 4x1b
Oscillator Type
Internal
Operating Temperature
-20°C ~ 85°C
Package / Case
20-SSOP
For Use With
R0K521134S000BE - KIT EVAL STARTER FOR R8C/13R0E521174CPE10 - EMULATOR COMPACT R8C/18/19/1
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
Eeprom Size
-
To our customers,
Corporation, and Renesas Electronics Corporation took over all the business of both
companies. Therefore, although the old company name remains in this document, it is a valid
Renesas Electronics document. We appreciate your understanding.
Issued by: Renesas Electronics Corporation (http://www.renesas.com)
Send any inquiries to http://www.renesas.com/inquiry.
On April 1
st
, 2010, NEC Electronics Corporation merged with Renesas Technology
Renesas Electronics website:
Old Company Name in Catalogs and Other Documents
http://www.renesas.com
April 1
Renesas Electronics Corporation
st
, 2010

Related parts for R5F21191SP#U0

R5F21191SP#U0 Summary of contents

Page 1

To our customers, Old Company Name in Catalogs and Other Documents st On April 1 , 2010, NEC Electronics Corporation merged with Renesas Technology Corporation, and Renesas Electronics Corporation took over all the business of both companies. Therefore, although the ...

Page 2

All information included in this document is current as of the date this document is issued. Such information, however, is subject to change without any prior notice. Before purchasing or using any Renesas Electronics products listed herein, please confirm ...

Page 3

R8C/18 Group, 16 R8C/19 Group Hardware Manual RENESAS 16-BIT SINGLE-CHIP MCU R8C FAMILY / R8C/1x SERIES All information contained in these materials, including products and product specifications, represents information on the product at the time of publication and is subject ...

Page 4

Keep safety first in your circuit designs! Renesas Technology Corp. puts the maximum effort into making semiconductor products 1. better and more reliable, but there is always the possibility that trouble may occur with them. Trouble with semiconductors may lead ...

Page 5

General Precautions in the Handling of MPU/MCU Products The following usage notes are applicable to all MPU/MCU products from Renesas. For detailed usage notes on the products covered by this manual, refer to the relevant sections of the manual. If ...

Page 6

How to Use This Manual 1. Purpose and Target Readers This manual is designed to provide the user with an understanding of the hardware functions and electrical characteristics of the MCU intended for users designing application systems incorporating ...

Page 7

Notation of Numbers and Symbols The notation conventions for register names, bit names, numbers, and symbols used in this manual are described below. (1) Register Names, Bit Names, and Pin Names Registers, bits, and pins are referred to in ...

Page 8

Register Notation The symbols and terms used in register diagrams are described below. XXX Register Bit Symbol XXX0 XXX1 XXX4 XXX5 XXX6 XXX7 *1 Blank: Set ...

Page 9

List of Abbreviations and Acronyms Abbreviation ACIA bps CRC DMA DMAC GSM Hi-Z IEBus I/O IrDA LSB MSB NC PLL PWM SFR SIM UART VCO Asynchronous Communication Interface Adapter bits per second Cyclic Redundancy Check Direct Memory Access Direct ...

Page 10

SFR Page Reference 1. Overview 1.1 Applications .................................................................................................1 1.2 Performance Overview................................................................................2 1.3 Block Diagram .............................................................................................4 1.4 Product Information .....................................................................................5 1.5 Pin Assignments..........................................................................................7 1.6 Pin Functions.............................................................................................10 2. Central Processing Unit (CPU) 2.1 Data Registers (R0, R1, R2, and R3)........................................................14 2.2 Address ...

Page 11

Special Function Registers (SFRs) 5. Resets 5.1 Hardware Reset ........................................................................................24 5.1.1 When Power Supply is Stable ............................................................24 5.1.2 Power On............................................................................................24 5.2 Power-On Reset Function .........................................................................26 5.3 Voltage Monitor 1 Reset ...........................................................................27 5.4 Voltage Monitor 2 Reset............................................................................27 5.5 Watchdog Timer ...

Page 12

CPU Clock and Peripheral Function Clock................................................62 10.3.1 System Clock......................................................................................62 10.3.2 CPU Clock ..........................................................................................62 10.3.3 Peripheral Function Clock (f1, f2, f4, f8, and f32) ...............................62 10.3.4 fRING and fRING128..........................................................................62 10.3.5 fRING-fast...........................................................................................62 10.3.6 fRING-S ..............................................................................................62 10.4 Power Control............................................................................................63 10.4.1 Standard Operating ...

Page 13

Notes on Interrupts....................................................................................94 12.5.1 Reading Address 00000h ...................................................................94 12.5.2 SP Setting...........................................................................................94 12.5.3 External Interrupt and Key Input Interrupt ..........................................94 12.5.4 Watchdog Timer Interrupt...................................................................94 12.5.5 Changing Interrupt Sources................................................................95 12.5.6 Changing Interrupt Control Register Contents ...................................96 13. Watchdog Timer 13.1 Count ...

Page 14

Clock Asynchronous Serial I/O (UART) Mode ........................................157 15.2.1 CNTR0 Pin Select Function..............................................................160 15.2.2 Bit Rate.............................................................................................161 15.3 Notes on Serial Interface.........................................................................162 16. Comparator 16.1 One-Shot Mode .......................................................................................167 16.2 Repeat Mode...........................................................................................169 16.3 Notes on Comparator ..............................................................................171 17. Flash Memory Version 17.1 ...

Page 15

Notes on Interrupts..................................................................................218 19.2.1 Reading Address 00000h .................................................................218 19.2.2 SP Setting.........................................................................................218 19.2.3 External Interrupt and Key Input Interrupt ........................................218 19.2.4 Watchdog Timer Interrupt.................................................................218 19.2.5 Changing Interrupt Sources..............................................................219 19.2.6 Changing Interrupt Control Register Contents .................................220 19.3 Notes on Timers ......................................................................................221 ...

Page 16

SFR Page Reference Address Register 0000h 0001h 0002h 0003h 0004h Processor Mode Register 0 0005h Processor Mode Register 1 0006h System Clock Control Register 0 0007h System Clock Control Register 1 0008h 0009h Address Match Interrupt Enable Register 000Ah Protect ...

Page 17

Address Register 0080h Timer Z Mode Register 0081h 0082h 0083h 0084h Timer Z Waveform Output Control Register 0085h Prescaler Z Register 0086h Timer Z Secondary Register 0087h Timer Z Primary Register 0088h 0089h 008Ah Timer Z Output Control Register 008Bh ...

Page 18

R8C/18 Group, R8C/19 Group SINGLE-CHIP 16-BIT CMOS MCU 1. Overview These MCUs are fabricated using a high-performance silicon gate CMOS process, embedding the R8C/Tiny Series CPU core, and is packaged in a 20-pin molded-plastic LSSOP, SDIP or a 28-pin plastic ...

Page 19

R8C/18 Group, R8C/19 Group 1.2 Performance Overview Table 1.1 outlines the Functions and Specifications for R8C/18 Group and Table 1.2 outlines the Functions and Specifications for R8C/19 Group. Table 1.1 Functions and Specifications for R8C/18 Group Item CPU Number of ...

Page 20

R8C/18 Group, R8C/19 Group Table 1.2 Functions and Specifications for R8C/19 Group Item CPU Number of fundamental instructions Minimum instruction execution time Operation mode Address space Memory capacity Peripheral Ports Functions LED drive ports Timers Serial interfaces Comparator Watchdog timer ...

Page 21

R8C/18 Group, R8C/19 Group 1.3 Block Diagram Figure 1.1 shows a Block Diagram. I/O ports Peripheral Functions Timers Timer X (8 bits) Timer Z (8 bits) Timer C (16 bits) Watchdog timer (15 bits) Figure 1.1 Block Diagram Rev.1.30 Apr ...

Page 22

R8C/18 Group, R8C/19 Group 1.4 Product Information Table 1.3 lists Product Information for R8C/18 Group and Table 1.4 lists Product Information for R8C/19 Group. Table 1.3 Product Information for R8C/18 Group Type No. ROM Capacity RAM Capacity R5F21181SP 4 Kbytes ...

Page 23

R8C/18 Group, R8C/19 Group Table 1.4 Product Information for R8C/19 Group Type No. Program ROM R5F21191SP 4 Kbytes R5F21192SP 8 Kbytes R5F21193SP 12 Kbytes R5F21194SP 16 Kbytes R5F21191DSP (D) 4 Kbytes R5F21192DSP (D) 8 Kbytes R5F21193DSP (D) 12 Kbytes R5F21194DSP ...

Page 24

R8C/18 Group, R8C/19 Group 1.5 Pin Assignments Figure 1.4 shows Pin Assignments for PLSP0020JB-A Package (Top View), Figure 1.5 shows Pin Assignments for PRDP0020BA-A Package (Top View) and Figure 1.6 shows Pin Assignments for PWQN0028KA-B Package (Top View). PIN assignments ...

Page 25

R8C/18 Group, R8C/19 Group PIN assignments (top view) P3_5/CMP1_2 P3_7/CNTR0/TXD1 RESET (1) XOUT/P4_7 VSS/AVSS XIN/P4_6 VCC/AVCC MODE P4_5/INT0/RXD1 P1_7/CNTR00/INT10 Figure 1.5 Pin Assignments for PRDP0020BA-A Package (Top View) Rev.1.30 Apr 14, 2006 Page 8 of 233 REJ09B0222-0130 ...

Page 26

R8C/18 Group, R8C/19 Group PIN Assignment (top view) P1_1/AN9/KI1/CMP0_1 P1_0/AN8/KI0/CMP0_0 P3_3/TCIN/INT3/CMP1_0 P3_4/CMP1_1 P3_5/CMP1_2 P3_7/CNTR0/TXD1 RESET Figure 1.6 Pin Assignments for PWQN0028KA-B Package (Top View) Rev.1.30 Apr 14, 2006 Page 9 of 233 REJ09B0222-0130 ...

Page 27

R8C/18 Group, R8C/19 Group 1.6 Pin Functions Table 1.5 lists Pin Functions, Table 1.6 lists Pin Name Information by Pin Number of PLSP0020JB-A, PRDP0020BA-A packages, and Table 1.7 lists Pin Name Information by Pin Number of PWQN0028KA- B package. Table ...

Page 28

R8C/18 Group, R8C/19 Group Table 1.6 Pin Name Information by Pin Number of PLSP0020JB-A, PRDP0020BA-A packages Pin Control Port Number Pin 1 P3_5 2 P3_7 3 RESET 4 XOUT P4_7 5 VSS/AVSS 6 XIN P4_6 7 VCC/AVCC 8 MODE 9 ...

Page 29

R8C/18 Group, R8C/19 Group Table 1.7 Pin Name Information by Pin Number of PWQN0028KA-B package Pin Control Port Number Pin XOUT P4_7 3 VSS/AVSS XIN P4_6 VCC/AVCC 9 MODE ...

Page 30

R8C/18 Group, R8C/19 Group 2. Central Processing Unit (CPU) Figure 2.1 shows the CPU Registers. The CPU contains 13 registers. R0, R1, R2, R3, A0, A1, and FB configure a register bank. There are two sets of register bank. b31 ...

Page 31

R8C/18 Group, R8C/19 Group 2.1 Data Registers (R0, R1, R2, and R3 16-bit register for transfer, arithmetic, and logic operations. The same applies R3. R0 can be split into high-order bits (R0H) and low-order ...

Page 32

R8C/18 Group, R8C/19 Group 2.8.7 Interrupt Enable Flag (I) The I flag enables maskable interrupts. Interrupts are disabled when the I flag is set to 0, and are enabled when the I flag is set to 1. The I flag ...

Page 33

R8C/18 Group, R8C/19 Group 3. Memory 3.1 R8C/18 Group Figure 3 Memory Map of R8C/18 Group. The R8C/18 Group has 1 Mbyte of address space from addresses 00000h to FFFFFh. The internal ROM area is allocated lower addresses, ...

Page 34

R8C/18 Group, R8C/19 Group 3.2 R8C/19 Group Figure 3 Memory Map of R8C/19 Group. The R8C/19 group has 1 Mbyte of address space from addresses 00000h to FFFFFh. The internal ROM (program ROM) is allocated lower addresses, beginning ...

Page 35

R8C/18 Group, R8C/19 Group 4. Special Function Registers (SFRs) An SFR (special function register control register for a peripheral function. Tables 4.1 to 4.4 list the special function registers. Table 4.1 SFR Information (1) Address 0000h 0001h 0002h ...

Page 36

R8C/18 Group, R8C/19 Group Table 4.2 SFR Information (2) Address 0040h 0041h 0042h 0043h 0044h 0045h 0046h 0047h 0048h 0049h 004Ah 004Bh 004Ch 004Dh Key Input Interrupt Control Register 004Eh Comparator Conversion Interrupt Control Register 004Fh 0050h Compare 1 Interrupt ...

Page 37

R8C/18 Group, R8C/19 Group Table 4.3 SFR Information (3) Address 0080h Timer Z Mode Register 0081h 0082h 0083h 0084h Timer Z Waveform Output Control Register 0085h Prescaler Z Register 0086h Timer Z Secondary Register 0087h Timer Z Primary Register 0088h ...

Page 38

R8C/18 Group, R8C/19 Group Table 4.4 SFR Information (4) Address 00C0h A/D Register 00C1h 00C2h 00C3h 00C4h 00C5h 00C6h 00C7h 00C8h 00C9h 00CAh 00CBh 00CCh 00CDh 00CEh 00CFh 00D0h 00D1h 00D2h 00D3h 00D4h A/D Control Register 2 00D5h 00D6h A/D ...

Page 39

R8C/18 Group, R8C/19 Group 5. Resets The following resets are implemented: hardware reset, power-on reset, voltage monitor 1 reset, voltage monitor 2 reset, watchdog timer reset, and software reset. Table 5.1 lists the Reset Names and Sources. Table 5.1 Reset ...

Page 40

R8C/18 Group, R8C/19 Group Table 5.2 shows the Pin Functions after Reset, Figure 5.2 shows CPU Register Status after Reset and Figure 5.3 shows Reset Sequence. Table 5.2 Pin Functions after Reset Pin Name P1 P3_3 to P3_5, P3_7 P4_2, ...

Page 41

R8C/18 Group, R8C/19 Group 5.1 Hardware Reset A reset is applied using the RESET pin. When an “L” signal is applied to the RESET pin while the supply voltage meets the recommended operating conditions, pins, CPU, and SFRs are reset ...

Page 42

R8C/18 Group, R8C/19 Group VCC RESET Figure 5.4 Example of Hardware Reset Circuit and Operation RESET Figure 5.5 Example of Hardware Reset Circuit (Usage Example of External Supply Voltage Detection Circuit) and Operation Rev.1.30 Apr 14, 2006 Page 25 of ...

Page 43

R8C/18 Group, R8C/19 Group 5.2 Power-On Reset Function When the RESET pin is connected to the VCC pin via a pull-up resistor of about 5 kΩ, and the VCC pin voltage level rises, the power-on reset function is enabled and ...

Page 44

R8C/18 Group, R8C/19 Group 5.3 Voltage Monitor 1 Reset A reset is applied using the on-chip voltage detection 1 circuit. The voltage detection 1 circuit monitors the input voltage to the VCC pin. The voltage to monitor is Vdet1. When ...

Page 45

R8C/18 Group, R8C/19 Group 6. Programmable I/O Ports There are 13 programmable Input/Output ports (I/O ports) P1, P3_3 to P3_5, P3_7, and P4_5. P4_2 can be used as an input-only port. Also, P4_6 and P4_7 can be used as input-only ...

Page 46

R8C/18 Group, R8C/19 Group P1_0 to P1_3 Direction register Output from individual peripheral function Data bus Port latch Input to individual peripheral function P1_4 Direction register Output from individual peripheral function Data bus Port latch P1_5 Direction register Data bus ...

Page 47

R8C/18 Group, R8C/19 Group P1_6, P1_7 Output from individual peripheral function Data bus Port latch Input to individual peripheral function P3_3 Output from individual peripheral function Data bus Input to individual peripheral function P3_4, P3_5, P3_7 Output from individual peripheral ...

Page 48

R8C/18 Group, R8C/19 Group P4_2 P4_5 Data bus Input to individual peripheral function P4_6/XIN P4_7/XOUT NOTES: 1. When CM05 = 1, CM10 = 1, or CM13 = 0, the clocked inverter is cut off. 2. When CM10 = 1 or ...

Page 49

R8C/18 Group, R8C/19 Group MODE MODE signal input RESET RESET signal input NOTES : 1. Ensure the input voltage to each port does not exceed VCC. Figure 6.4 Configuration of I/O Pins Rev.1.30 Apr 14, 2006 Page 32 of 233 ...

Page 50

R8C/18 Group, R8C/19 Group Port Pi Direction Register ( Symbol PD1 PD3 PD4 Bit Symbol PDi_0 PDi_1 PDi_2 PDi_3 PDi_4 PDi_5 PDi_6 PDi_7 NOTES: 1. Bits PD3_0 to ...

Page 51

R8C/18 Group, R8C/19 Group Pull-Up Control Register Symbol PUR0 Bit Symbol (b1-b0) PU02 PU03 — (b5-b4) PU06 PU07 NOTE: 1. When this bit is set to 1 (pulled up), ...

Page 52

R8C/18 Group, R8C/19 Group 6.4 Port Settings Tables 6.4 to 6.17 list the port settings. Table 6.4 Port P1_0/KI0/AN8/CMP0_0 Register PD1 PUR0 DRR Bit PD1_0 PU02 DRR0 Setting ...

Page 53

R8C/18 Group, R8C/19 Group Table 6.7 Port P1_3/KI3/AN11/TZOUT Register PD1 PUR0 Bit PD1_3 PU02 Setting Value ...

Page 54

R8C/18 Group, R8C/19 Group Table 6.10 Port P1_6/CLK0 Register PD1 PUR0 Bit PD1_6 PU03 0 0 Setting 0 Value Table 6.11 Port P1_7/CNTR00/INT10 Register PD1 PUR0 Bit PD1_7 PU03 0 0 Setting 0 Value ...

Page 55

R8C/18 Group, R8C/19 Group Table 6.14 Port P3_5/CMP1_2 Register PD3 PUR0 Bit PD3_5 PU07 0 0 Setting Value Table 6.15 Port P3_7/CNTR0/TXD1 Register PD3 PUR0 Bit PD3_7 PU07 Setting Value X ...

Page 56

R8C/18 Group, R8C/19 Group 6.5 Unassigned Pin Handling Table 6.18 lists Unassigned Pin Handling. Figure 6.9 shows Unassigned Pin Handling. Table 6.18 Unassigned Pin Handling Pin Name Ports P1, P3_3 to P3_5, P3_7, P4_5 Ports P4_6, P4_7 Port P4_2/VREF (3) ...

Page 57

R8C/18 Group, R8C/19 Group 7. Voltage Detection Circuit The voltage detection circuit monitors the input voltage to the VCC pin. This circuit can be used to monitor the VCC input voltage by a program. Alternately, voltage monitor 1 reset, voltage ...

Page 58

R8C/18 Group, R8C/19 Group VCC Internal reference voltage Figure 7.1 Block Diagram of Voltage Detection Circuit Voltage detection 1 circuit VCA26 VCC + Internal - reference voltage Voltage detection 1 signal is held “H” when VCA26 bit is set to ...

Page 59

R8C/18 Group, R8C/19 Group Voltage detection 2 circuit fRING-S VCA27 VCA13 VCC + Noise filter Voltage Internal - detection reference 2 signal (Filter width: 200 ns) voltage Voltage detection 2 signal is held “H” when VCA27 bit is set to ...

Page 60

R8C/18 Group, R8C/19 Group Voltage Detection Register Symbol VCA1 Bit Symbol — (b2-b0) VCA13 — (b7-b4) NOTES: 1. The VCA13 bit is enabled w ...

Page 61

R8C/18 Group, R8C/19 Group Voltage Monitor 1 Circuit Control Register Symbol VW1C Bit Symbol VW1C0 VW1C1 VW1C2 — (b3) VW1F0 VW1F1 VW1C6 VW1C7 NOTES: 1. Set the PRC3 bit in the ...

Page 62

R8C/18 Group, R8C/19 Group Voltage Monitor 2 Circuit Control Register Symbol VW2C Bit Symbol VW2C0 VW2C1 VW2C2 VW2C3 VW2F0 VW2F1 VW2C6 VW2C7 NOTES: 1. Set the PRC3 bit in the PRCR register ...

Page 63

R8C/18 Group, R8C/19 Group 7.1 VCC Input Voltage 7.1.1 Monitoring Vdet1 Vdet1 cannot be monitored. 7.1.2 Monitoring Vdet2 Set the VCA27 bit in the VCA2 register to 1 (voltage detection 2 circuit enabled). After td(E-A) has elapsed (refer to 18. ...

Page 64

R8C/18 Group, R8C/19 Group Voltage monitor 1 reset VCC Vdet1 Sampling timing Internal reset signal Operation when the VW1C1 bit in the VW1C register is set to 0 (digital filter enabled). Voltage monitor 2 interrupt VCC Vdet2 Sampling timing Sampling ...

Page 65

R8C/18 Group, R8C/19 Group 7.2 Voltage Monitor 1 Reset Table 7.2 lists the Setting Procedure of Voltage Monitor 1 Reset Associated Bits and Figure 7.8 shows an Operating Example of Voltage Monitor 1 Reset. To use voltage monitor 1 reset ...

Page 66

R8C/18 Group, R8C/19 Group 7.3 Voltage Monitor 2 Interrupt and Voltage Monitor 2 Reset Table 7.3 lists the Setting Procedure of Voltage Monitor 2 Interrupt and Voltage Monitor 2 Reset Associated Bits. Figure 7.9 shows an Operating Example of Voltage ...

Page 67

R8C/18 Group, R8C/19 Group Vdet2 (Typ. 3.30 V) (1) 2.7 V VCA13 bit VW2C2 bit When the VW2C1 bit is set to 0 (digital filter enabled). Voltage monitor 2 interrupt request (VW2C6 = 0) Internal reset signal (VW2C6 = 1) ...

Page 68

R8C/18 Group, R8C/19 Group 8. Processor Mode 8.1 Processor Modes Single-chip mode can be selected as the processor mode. Table 8.1 lists Features of Processor Mode. Figure 8.1 shows the PM0 Register and Figure 8.2 shows the PM1 Register. Table ...

Page 69

R8C/18 Group, R8C/19 Group 9. Bus The bus cycles differ when accessing ROM/RAM, and when accessing SFR. Table 9.1 lists Bus Cycles by Access Space of the R8C/18 Group and Table 9.2 lists Bus Cycles by Access Space of the ...

Page 70

R8C/18 Group, R8C/19 Group 10. Clock Generation Circuit The clock generation circuit has: • Main clock oscillation circuit • On-chip oscillator (oscillation stop detection function) Table 10.1 lists Specifications of Clock Generation Circuit. Figure 10.1 shows a Clock Generation Circuit. ...

Page 71

R8C/18 Group, R8C/19 Group S Q CM10 = 1 (stop mode) RESET R Power-on reset Software reset Interrupt request S Q WAIT R instruction CM13 XIN XOUT CM13 CM05 CM02, CM05, CM06: Bits in CM0 register CM10, CM13, CM14, CM16, ...

Page 72

R8C/18 Group, R8C/19 Group System Clock Control Register Symbol CM0 Bit Symbol — (b1-b0) CM02 — (b3) — (b4) CM05 CM06 — (b7) NOTES: 1. Set ...

Page 73

R8C/18 Group, R8C/19 Group System Clock Control Register Symbol CM1 Bit Symbol CM10 — (b1) — (b2) CM13 CM14 CM15 CM16 CM17 NOTES: 1. Set the PRC0 bit in ...

Page 74

R8C/18 Group, R8C/19 Group Oscillation Stop Detection Register Symbol OCD Bit Symbol OCD0 OCD1 OCD2 OCD3 — (b7-b4) NOTES: 1. Set the PRC0 bit in the PRCR register ...

Page 75

R8C/18 Group, R8C/19 Group High-Speed On-Chip Oscillator Control Register Symbol HRA0 Bit Symbol HRA00 HRA01 — (b7-b2) NOTES: 1. Set the PRC0 bit in the ...

Page 76

R8C/18 Group, R8C/19 Group High-Speed On-Chip Oscillator Control Register Symbol HRA1 The frequency of the high-speed on-chip oscillator is adjusted w ith bits High-speed on-chip oscillator frequency = ...

Page 77

R8C/18 Group, R8C/19 Group The clocks generated by the clock generation circuits are described below. 10.1 Main Clock This clock is supplied by a main clock oscillation circuit. This clock is used as the clock source for the CPU and ...

Page 78

R8C/18 Group, R8C/19 Group 10.2 On-Chip Oscillator Clocks These clocks are supplied by the on-chip oscillators (high-speed on-chip oscillator and a low-speed on- chip oscillator). The on-chip oscillator clock is selected by the HRA01 bit in the HRA0 register. 10.2.1 ...

Page 79

R8C/18 Group, R8C/19 Group 10.3 CPU Clock and Peripheral Function Clock There are a CPU clock to operate the CPU and a peripheral function clock to operate the peripheral functions. Refer to Figure 10.1 Clock Generation Circuit. 10.3.1 System Clock ...

Page 80

R8C/18 Group, R8C/19 Group 10.4 Power Control There are three power control modes. All modes other than wait mode and stop mode are referred to as standard operating mode. 10.4.1 Standard Operating Mode Standard operating mode is further separated into ...

Page 81

R8C/18 Group, R8C/19 Group 10.4.1.1 High-Speed Mode The main clock divided by 1 (no division) provides the CPU clock. If the CM14 bit is set to 0 (low- speed on-chip oscillator on) or the HRA00 bit in the HRA0 register ...

Page 82

R8C/18 Group, R8C/19 Group 10.4.2.4 Exiting Wait Mode The MCU exits wait mode by a hardware reset or a peripheral function interrupt. To use a hardware reset to exit wait mode, set bits ILVL2 to ILVL0 for the peripheral function ...

Page 83

R8C/18 Group, R8C/19 Group 10.4.3 Stop Mode Since the oscillator circuits stop in stop mode, the CPU clock and peripheral function clock stop and the CPU and peripheral functions that use these clocks stop operating. The least power required to ...

Page 84

R8C/18 Group, R8C/19 Group Figure 10.8 shows the State Transitions in Power Control. Low-speed on-chip oscillator mode High-speed mode, medium-speed mode OCD2 = 0 CM05 = 0 CM13 = 1 High-speed on-chip oscillator mode WAIT Interrupt instruction Wait mode Figure ...

Page 85

R8C/18 Group, R8C/19 Group 10.5 Oscillation Stop Detection Function The oscillation stop detection function detects the stop of the main clock oscillation circuit. The oscillation stop detection function can be enabled and disabled by bits OCD1 to OCD0 in the ...

Page 86

R8C/18 Group, R8C/19 Group Table 10.6 Determining Interrupt Source for Oscillation Stop Detection, Watchdog Timer, and Voltage Monitor 2 Interrupts Generated Interrupt Source Oscillation stop detection ((a) or (b)) Watchdog timer Voltage monitor 2 Set bits OCD1 to OCD0 to ...

Page 87

R8C/18 Group, R8C/19 Group 10.6 Notes on Clock Generation Circuit 10.6.1 Stop Mode and Wait Mode When entering stop mode or wait mode, an instruction queue pre-reads 4 bytes from the WAIT instruction or an instruction that sets the CM10 ...

Page 88

R8C/18 Group, R8C/19 Group 11. Protection The protection function protects important registers from being easily overwritten when a program runs out of control. Figure 11.1 shows the PRCR Register. The registers protected by the PRCR register are listed below. • ...

Page 89

R8C/18 Group, R8C/19 Group 12. Interrupts 12.1 Interrupt Overview 12.1.1 Types of Interrupts Figure 12.1 shows the types of Interrupts. Software (non-maskable interrupts) Interrupt Hardware NOTES: 1. Peripheral function interrupts in the MCU are used to generate peripheral interrupts. 2. ...

Page 90

R8C/18 Group, R8C/19 Group 12.1.2 Software Interrupts A software interrupt is generated when an instruction is executed. Software interrupts are non- maskable. 12.1.2.1 Undefined Instruction Interrupt The undefined instruction interrupt is generated when the UND instruction is executed. 12.1.2.2 Overflow ...

Page 91

R8C/18 Group, R8C/19 Group 12.1.3 Special Interrupts Special interrupts are non-maskable. 12.1.3.1 Watchdog Timer Interrupt The watchdog timer interrupt is generated by the watchdog timer. Reset the watchdog timer after the watchdog timer interrupt is generated. For details, refer to ...

Page 92

R8C/18 Group, R8C/19 Group 12.1.5 Interrupts and Interrupt Vectors There are 4 bytes in each vector. Set the starting address of an interrupt routine in each interrupt vector. When an interrupt request is acknowledged, the CPU branches to the address ...

Page 93

R8C/18 Group, R8C/19 Group 12.1.5.2 Relocatable Vector Tables The relocatable vector tables occupy 256 bytes beginning from the starting address set in the INTB register. Table 12.2 lists the Relocatable Vector Tables. Table 12.2 Relocatable Vector Tables Interrupt Source +0 ...

Page 94

R8C/18 Group, R8C/19 Group 12.1.6 Interrupt Control The following describes enabling and disabling the maskable interrupts and setting the priority for acknowledgement. The explanation does not apply to nonmaskable interrupts. Use the I flag in the FLG register, IPL, and ...

Page 95

R8C/18 Group, R8C/19 Group INT0 Interrupt Control Register Symbol INT01C Bit Symbol ILVL0 ILVL1 ILVL2 IR POL — (b5) — (b7-b6) NOTES: 1. Only 0 can be w ritten to the ...

Page 96

R8C/18 Group, R8C/19 Group 12.1.6.1 I Flag The I flag enables or disables maskable interrupts. Setting the I flag to 1 (enabled) enables maskable interrupts. Setting the I flag to 0 (disabled) disables all maskable interrupts. 12.1.6.2 IR Bit The ...

Page 97

R8C/18 Group, R8C/19 Group 12.1.6.4 Interrupt Sequence An interrupt sequence is performed between an interrupt request acknowledgement and interrupt routine execution. When an interrupt request is generated while an instruction is being executed, the CPU determines its interrupt priority level ...

Page 98

R8C/18 Group, R8C/19 Group 12.1.6.5 Interrupt Response Time Figure 12.6 shows the Interrupt Response Time. The interrupt response time is the period between an interrupt request generation and the execution of the first instruction in the interrupt routine. The interrupt ...

Page 99

R8C/18 Group, R8C/19 Group 12.1.6.7 Saving a Register In the interrupt sequence, the FLG register and PC are saved to the stack. After an extended 16 bits, 4 high-order bits in the PC and 4 high-order (IPL) and 8 low-order ...

Page 100

R8C/18 Group, R8C/19 Group 12.1.6.8 Returning from an Interrupt Routine When the REIT instruction is executed at the end of an interrupt routine, the FLG register and PC, which have been saved to the stack, are automatically restored. The program, ...

Page 101

R8C/18 Group, R8C/19 Group 12.1.6.10 Interrupt Priority Judgement Circuit The interrupt priority judgement circuit selects the highest priority interrupt, as shown in Figure 12.10. Priority level of each interrupt Compare 0 INT3 Timer Z Timer X INT0 Timer C INT1 ...

Page 102

R8C/18 Group, R8C/19 Group 12.2 INT Interrupt 12.2.1 INT0 Interrupt The INT0 interrupt is generated by an INT0 input. When using the INT0 interrupt, the INT0EN bit in the INTEN register is set to 1 (enable). The edge polarity is ...

Page 103

R8C/18 Group, R8C/19 Group 12.2.2 INT0 Input Filter The INT0 input contains a digital filter. The sampling clock is selected by bits INT0F1 to INT0F0 in the INT0F register. The INT0 level is sampled every sampling clock cycle and if ...

Page 104

R8C/18 Group, R8C/19 Group 12.2.3 INT1 Interrupt The INT1 interrupt is generated by an INT1 input. The edge polarity is selected by the R0EDG bit in the TXMR register. When the CNTRSEL bit in the UCON register is set to ...

Page 105

R8C/18 Group, R8C/19 Group 12.2.4 INT3 Interrupt The INT3 interrupt is generated by an INT3 input. Set the TCC07 bit in the TCC0 register to 0 (INT3). When the TCC06 bit in the TCC0 register is set ...

Page 106

R8C/18 Group, R8C/19 Group Timer C Control Register Symbol TCC1 Bit Symbol TCC10 TCC11 TCC12 TCC13 TCC14 TCC15 TCC16 TCC17 NOTES: 1. When the same value from the INT3 2. When ...

Page 107

R8C/18 Group, R8C/19 Group 12.3 Key Input Interrupt A key input interrupt request is generated by one of the input edges of pins K10 to K13. The key input interrupt can be used as a key-on wake-up function to exit ...

Page 108

R8C/18 Group, R8C/19 Group (1) Key Input Enable Register Symbol KIEN Bit Symbol KI0EN KI0PL KI1EN KI1PL KI2EN KI2PL KI3EN KI3PL NOTE: 1. The IR bit in the KUPIC register may be ...

Page 109

R8C/18 Group, R8C/19 Group 12.4 Address Match Interrupt An address match interrupt request is generated immediately before execution of the instruction at the address indicated by the RMADi register ( 1). This interrupt is used as a break ...

Page 110

R8C/18 Group, R8C/19 Group Address Match Interrupt Enable Register Symbol AIER Bit Symbol AIER0 AIER1 — (b7-b2) Address Match Interrupt Register (b23) (b19) (b16) (b15 ...

Page 111

R8C/18 Group, R8C/19 Group 12.5 Notes on Interrupts 12.5.1 Reading Address 00000h Do not read address 00000h by a program. When a maskable interrupt request is acknowledged, the CPU reads interrupt information (interrupt number and interrupt request level) from 00000h ...

Page 112

R8C/18 Group, R8C/19 Group 12.5.5 Changing Interrupt Sources The IR bit in the interrupt control register may be set to 1 (interrupt requested) when the interrupt source changes. When using an interrupt, set the IR bit to 0 (no interrupt ...

Page 113

R8C/18 Group, R8C/19 Group 12.5.6 Changing Interrupt Control Register Contents (a) The contents of an interrupt control register can only be changed while no interrupt requests corresponding to that register are generated. If interrupt requests may be generated, disable interrupts ...

Page 114

R8C/18 Group, R8C/19 Group 13. Watchdog Timer The watchdog timer is a function that detects when a program is out of control. Use of the watchdog timer is recommended to improve the reliability of the system. The watchdog timer contains ...

Page 115

R8C/18 Group, R8C/19 Group Option Function Select Register Symbol OFS Bit Symbol WDTON — (b1) ROMCR ROMCP1 — (b6-b4) CSPROINI NOTES: 1. The OFS register is on the ...

Page 116

R8C/18 Group, R8C/19 Group Watchdog Timer Reset Register b7 b0 Symbol WDTR When 00h is w ritten before w riting FFh, the w atchdog timer is reset. The default value of the w atchdog timer is 7FFFh w hen count ...

Page 117

R8C/18 Group, R8C/19 Group 13.1 Count Source Protection Mode Disabled The count source of the watchdog timer is the CPU clock when count source protection mode is disabled. Table 13.2 lists the Watchdog Timer Specifications (with Count Source Protection Mode ...

Page 118

R8C/18 Group, R8C/19 Group 13.2 Count Source Protection Mode Enabled The count source of the watchdog timer is the low-speed on-chip oscillator clock when count source protection mode is enabled. If the CPU clock stops when a program is out ...

Page 119

R8C/18 Group, R8C/19 Group 14. Timers The MCU has two 8-bit timers with 8-bit prescalers, and a 16-bit timer. The two 8-bit timers with 8-bit prescalers are timer X and timer Z. These timers contain a reload register to store ...

Page 120

R8C/18 Group, R8C/19 Group 14.1 Timer X Timer 8-bit timer with an 8-bit prescaler. The prescaler and timer each consist of a reload register and counter. The reload register and counter are allocated at the same address, ...

Page 121

R8C/18 Group, R8C/19 Group Timer X Mode Register Symbol TXMR Bit Symbol TXMOD0 TXMOD1 R0EDG TXS TXOCNT TXMOD2 TXEDG TXUND NOTES: 1. The IR bit in the INT1IC register may be set ...

Page 122

R8C/18 Group, R8C/19 Group Prescaler X Register b7 b0 Symbol Timer mode Pulse output mode Event counter mode Pulse w idth measurement mode Pulse period measurement mode Timer X Register b7 b0 Symbol Counts underflow of prescaler X Timer Count ...

Page 123

R8C/18 Group, R8C/19 Group 14.1.1 Timer Mode Timer mode, the internally generated count source is counted (refer to Table 14.2 Timer Mode Specifications). Figure 14.4 shows the TXMR Register in Timer Mode. Table 14.2 Timer Mode Specifications Item Count sources ...

Page 124

R8C/18 Group, R8C/19 Group 14.1.2 Pulse Output Mode In pulse output mode, the internally generated count source is counted, and a pulse with inverted polarity is output from the CNTR0 pin each time the timer underflows (refer to Table 14.3 ...

Page 125

R8C/18 Group, R8C/19 Group Timer X Mode Register Symbol TXMR Bit Symbol TXMOD0 TXMOD1 R0EDG TXS TXOCNT TXMOD2 TXEDG TXUND NOTES: 1. The IR bit in the ...

Page 126

R8C/18 Group, R8C/19 Group 14.1.3 Event Counter Mode In event counter mode, external signal inputs to the INT1/CNTR0 pin are counted (refer to Table 14.4 Event Counter Mode Specifications). Figure 14.6 shows the TXMR Register in Event Counter Mode. Table ...

Page 127

R8C/18 Group, R8C/19 Group 14.1.4 Pulse Width Measurement Mode In pulse width measurement mode, the pulse width of an external signal input to the INT1/CNTR0 pin is measured (refer to Table 14.5 Pulse Width Measurement Mode Specifications). Figure 14.7 shows ...

Page 128

R8C/18 Group, R8C/19 Group Timer X Mode Register Symbol TXMR Bit Symbol TXMOD0 TXMOD1 R0EDG TXS TXOCNT TXMOD2 TXEDG TXUND NOTES: 1. The IR bit in ...

Page 129

R8C/18 Group, R8C/19 Group n = high level: the contents of TX register, low level: the contents of PREX register FFFFh Count start n 0000h Set program 1 TXS bit in TXMR register 0 Measured pulse 1 ...

Page 130

R8C/18 Group, R8C/19 Group 14.1.5 Pulse Period Measurement Mode In pulse period measurement mode, the pulse period of an external signal input to the INT1/CNTR0 pin is measured (refer to Table 14.6 Pulse Period Measurement Mode Specifications). Figure 14.9 shows ...

Page 131

R8C/18 Group, R8C/19 Group Timer X Mode Register Symbol TXMR Bit Symbol TXMOD0 TXMOD1 R0EDG TXS TXOCNT TXMOD2 (2) TXEDG (2) TXUND NOTES: 1. The IR bit in ...

Page 132

R8C/18 Group, R8C/19 Group Underflow signal of prescaler X Set program TXS bit in TXMR 1 register 0 Starts counting 1 CNTR0i pin input 0 Contents of timer X 0Fh Contents of read-out buffer1 TXEDG bit in ...

Page 133

R8C/18 Group, R8C/19 Group 14.1.6 Notes on Timer X • Timer X stops counting after a reset. Set the values in the timer and prescaler before the count starts. • Even if the prescaler and timer are read out in ...

Page 134

R8C/18 Group, R8C/19 Group 14.2 Timer Z Timer 8-bit timer with an 8-bit prescaler. The prescaler and timer each consist of a reload register and counter. The reload register and counter are allocated at the same address. ...

Page 135

R8C/18 Group, R8C/19 Group Timer Z Mode Register Symbol TZMR Bit Symbol — (b3-b0) TZMOD0 TZMOD1 TZWC TZS NOTE: 1. Refer to 14.2.5 Notes on Tim er Z ...

Page 136

R8C/18 Group, R8C/19 Group Prescaler Z Register b7 b0 Timer mode Programmable w aveform generation mode Programmable one-shot generation mode Programmable w ait one-shot generation mode Timer Z Secondary Register b7 b0 Timer mode Programmable w aveform generation mode Programmable ...

Page 137

R8C/18 Group, R8C/19 Group Timer Z Output Control Register Symbol TZOC Bit Symbol TZOS — (b1) TZOCNT — (b7-b3) NOTES: 1. This bit is set hen the output ...

Page 138

R8C/18 Group, R8C/19 Group Timer Count Source Setting Register Symbol TCSS Bit Symbol TXCK0 TXCK1 — (b3-b2) TZCK0 TZCK1 — (b7-b6) NOTE not sw itch count ...

Page 139

R8C/18 Group, R8C/19 Group 14.2.1 Timer Mode In timer mode, a count source which is internally generated or timer X underflow is counted (refer to Table 14.7 Timer Mode Specifications). The TZSC register is not used in timer mode. Figure ...

Page 140

R8C/18 Group, R8C/19 Group Timer Z Mode Register Symbol TZMR Bit Symbol — (b3-b0) TZMOD0 TZMOD1 TZWC TZS NOTES: 1. When the TZS bit is set ...

Page 141

R8C/18 Group, R8C/19 Group 14.2.2 Programmable Waveform Generation Mode In programmable waveform generation mode, the signal output from the TZOUT pin is inverted each time the counter underflows, while the values in registers TZPR and TZSC are counted alternately (refer ...

Page 142

R8C/18 Group, R8C/19 Group Timer Z Mode Register Symbol TZMR Bit Symbol — (b3-b0) TZMOD0 TZMOD1 TZWC TZS NOTES: 1. When the TZS bit is ...

Page 143

R8C/18 Group, R8C/19 Group 1 TZS bit in TZMR register 0 Count source Prescaler Z underflow signal Contents of timer bit in TZIC register 0 1 TZOPL bit in PUM register 0 “H” TZOUT pin output “L” ...

Page 144

R8C/18 Group, R8C/19 Group 14.2.3 Programmable One-shot Generation Mode In programmable one-shot generation mode, one-shot pulse is output from the TZOUT pin by a program or an external trigger input (input to the INT0 pin) (refer to Table 14.9 Programmable ...

Page 145

R8C/18 Group, R8C/19 Group Timer Z Mode Register Symbol TZMR Bit Symbol — (b3-b0) TZMOD0 TZMOD1 TZWC TZS NOTES: 1. When the TZS bit is ...

Page 146

R8C/18 Group, R8C/19 Group 1 TZS bit in TZMR register 0 1 TZOS bit in TZOC register 0 Count source Prescaler Z underflow signal 1 INT0 pin input 0 Contents of timer bit in TZIC register 0 ...

Page 147

R8C/18 Group, R8C/19 Group 14.2.4 Programmable Wait One-Shot Generation Mode In programmable wait one-shot generation mode, one-shot pulse is output from the TZOUT pin by a program or an external trigger input (input to the INT0 pin) (refer to Table ...

Page 148

R8C/18 Group, R8C/19 Group Table 14.10 Programmable Wait One-Shot Generation Mode Specifications Item Count sources Count operations Wait time One-shot pulse output time Count start conditions Count stop conditions Interrupt request generation timing TZOUT pin function INT0 pin function Read ...

Page 149

R8C/18 Group, R8C/19 Group Timer Z Mode Register Symbol TZMR Bit Symbol — (b3-b0) TZMOD0 TZMOD1 TZWC TZS NOTES: 1. When the TZS bit is ...

Page 150

R8C/18 Group, R8C/19 Group TZS bit in TZMR 1 register 0 TZOS bit in TZOC 1 register 0 Count source Prescaler Z underflow signal 1 INT0 pin input 0 Contents of timer bit in TZIC register 0 ...

Page 151

R8C/18 Group, R8C/19 Group 14.2.5 Notes on Timer Z • Timer Z stops counting after a reset. Set the values in the timer and prescaler before the count starts. • Even if the prescaler and timer are read out in ...

Page 152

R8C/18 Group, R8C/19 Group 14.3 Timer C Timer 16-bit timer. Figure 14.23 shows a Block Diagram of Timer C. Figure 14.24 shows a Block Diagram of CMP Waveform Generation Unit. Figure 14.25 shows a Block Diagram of ...

Page 153

R8C/18 Group, R8C/19 Group TCC14 TCC15 Compare 0 interrupt signal Compare 1 interrupt signal TCC16 TCC17 TCC17 to TCC16 “H” = 11b “L” = 10b Reverse = 01b TCC15 to TCC14 Reverse = 01b “L” = 10b “H” = 11b ...

Page 154

R8C/18 Group, R8C/19 Group Timer C Register (b15) (b8 Counts internal count source. 0000h can be read w hen the TCC00 bit is set to 0 (count stops). Count value can be read w hen the TCC00 ...

Page 155

R8C/18 Group, R8C/19 Group Timer C Control Register Symbol TCC0 Bit Symbol TCC00 TCC01 TCC02 TCC03 TCC04 — (b5) TCC06 TCC07 NOTES: 1. Change this bit w hen the TCC00 ...

Page 156

R8C/18 Group, R8C/19 Group Timer C Control Register Symbol TCC1 Bit Symbol TCC10 TCC11 TCC12 TCC13 TCC14 TCC15 TCC16 TCC17 NOTES: 1. When the same value is sampled from the INT3 ...

Page 157

R8C/18 Group, R8C/19 Group Timer C Output Control Register Symbol TCOUT Bit Symbol TCOUT0 TCOUT1 TCOUT2 TCOUT3 TCOUT4 TCOUT5 TCOUT6 TCOUT7 NOTE: 1. Set the bits w hich are not used for ...

Page 158

R8C/18 Group, R8C/19 Group 14.3.1 Input Capture Mode In input capture mode, the edge of the TCIN pin input signal or the fRING128 clock is used as a trigger to latch the timer value and generate an interrupt request. The ...

Page 159

R8C/18 Group, R8C/19 Group FFFFh Count starts 0000h Set program 1 TCC00 bit in TCC0 register 0 The delay caused by digital filter and one count source cycle delay (max.) Measured pulse 1 (TCIN pin input) 0 ...

Page 160

R8C/18 Group, R8C/19 Group 14.3.2 Output Compare Mode In output compare mode, an interrupt request is generated when the value of the TC register matches the value of the TM0 or TM1 register. Table 14.12 shows the Output Compare Mode ...

Page 161

R8C/18 Group, R8C/19 Group Value set in TM1 register Count starts Value set in TM0 register 0000h Set program 1 TCC00 bit in TCC0 register bit in CMP0IC register bit in ...

Page 162

R8C/18 Group, R8C/19 Group 14.3.3 Notes on Timer C Access registers TC, TM0, and TM1 in 16-bit units. The TC register can be read in 16-bit units. This prevents the timer value from being updated between when the low-order bytes ...

Page 163

R8C/18 Group, R8C/19 Group 15. Serial Interface The serial interface consists of two channels (UART0 and UART1). Each UARTi ( has an exclusive timer to generate the transfer clock and operates independently. Figure 15.1 shows a ...

Page 164

R8C/18 Group, R8C/19 Group 1SP SP PAR RXDi SP 2SP 0 2SP SP PAR SP 1SP Figure 15.2 UARTi Transmit/Receive Unit Rev.1.30 Apr 14, 2006 Page 147 of 233 REJ09B0222-0130 Clock synchronous type PRYE = 0 Clock PAR UART (7 ...

Page 165

R8C/18 Group, R8C/19 Group UARTi Transmit Buffer Register ( (b15) (b8 Bit Symbol — (b8-b0) — (b15-b9) NOTES: 1. When the transfer data length is 9 bits, w rite data to high byte ...

Page 166

R8C/18 Group, R8C/19 Group UARTi Transmit/Receive Mode Register ( Symbol U0MR U1MR Bit Symbol SMD0 SMD1 SMD2 CKDIR STPS PRY PRYE — (b7) NOTES: 1. Set the ...

Page 167

R8C/18 Group, R8C/19 Group UARTi Transmit/Receive Control Register Symbol U0C0 U1C0 Bit Symbol CLK0 CLK1 — (b2) TXEPT — (b4) NCH CKPOL UFORM NOTE: 1. ...

Page 168

R8C/18 Group, R8C/19 Group UARTi Transmit/Receive Control Register Symbol U0C1 U1C1 Bit Symbol — (b7-b4) NOTE: 1. The RI bit is set ...

Page 169

R8C/18 Group, R8C/19 Group 15.1 Clock Synchronous Serial I/O Mode In clock synchronous serial I/O mode, data is transmitted and received using a transfer clock. Table 15.1 lists the Clock Synchronous Serial I/O Mode Specifications. Table 15.2 lists the Registers ...

Page 170

R8C/18 Group, R8C/19 Group Table 15.2 Registers Used and Settings in Clock Synchronous Serial I/O Mode Register Bit U0TB U0RB OER U0BRG U0MR SMD2 to SMD0 CKDIR U0C0 CLK1 to CLK0 ...

Page 171

R8C/18 Group, R8C/19 Group • Example of transmit timing (when internal clock is selected) Transfer clock 1 TE bit in U0C1 register 0 Set data in U0TB register TI bit in U0C1 1 register 0 TCLK CLK0 TXD0 D0 D1 ...

Page 172

R8C/18 Group, R8C/19 Group 15.1.1 Polarity Select Function Figure 15.8 shows the Transfer Clock Polarity. Use the CKPOL bit in the U0C0 register to select the transfer clock polarity. • When the CKPOL bit in the U0C0 register = 0 ...

Page 173

R8C/18 Group, R8C/19 Group 15.1.3 Continuous Receive Mode Continuous receive mode is selected by setting the U0RRM bit in the UCON register to 1 (enables continuous receive mode). In this mode, reading the U0RB register sets the TI bit in ...

Page 174

R8C/18 Group, R8C/19 Group 15.2 Clock Asynchronous Serial I/O (UART) Mode The UART mode allows data transmission and reception after setting the desired bit rate and transfer data format. Table 15.4 lists the UART Mode Specifications. Table 15.5 lists the ...

Page 175

R8C/18 Group, R8C/19 Group Table 15.5 Registers Used and Settings for UART Mode Register Bit UiTB UiRB OER,FER,PER,SUM UiBRG UiMR SMD2 to SMD0 CKDIR STPS PRY, PRYE UiC0 CLK0, CLK1 TXEPT ...

Page 176

R8C/18 Group, R8C/19 Group • Transmit timing when transfer data is 8 bits long (parity enabled, 1 stop bit) Transfer clock TE bit in UiC1 1 register 0 Write data to UiTB register TI bit in UiC1 1 register 0 ...

Page 177

R8C/18 Group, R8C/19 Group • Example of receive timing when transfer data is 8 bits long (parity disabled, one stop bit) UiBRG output UiC1 register 1 RE bit 0 RXDi Transfer clock Reception triggered when transfer clock is generated by ...

Page 178

R8C/18 Group, R8C/19 Group 15.2.2 Bit Rate In UART mode, the bit rate is the frequency divided by the UiBRG ( register. UART Mode • Internal clock selected UiBRG register setting value = • External clock ...

Page 179

R8C/18 Group, R8C/19 Group 15.3 Notes on Serial Interface • When reading data from the U0RB register either in the clock asynchronous serial I/O mode or in the clock synchronous serial I/O mode. Ensure the data is read in 16-bit ...

Page 180

R8C/18 Group, R8C/19 Group 16. Comparator The comparator compares the electric potential input from the VREF pin with analog input. The analog input shares pins P1_0 to P1_3. Therefore, when using these pins, ensure the corresponding port direction bits are ...

Page 181

R8C/18 Group, R8C/19 Group VREF ADCAP = 0 Software trigger Timer Z interrupt request ADCAP = 1 P1_0/AN8 P1_1/AN9 P1_2/AN10 P1_3/AN11 CH0 to CH2, ADGSEL0, and CKS0: Bits in ADCON0 register CKS1, VCUT: Bits in ADCON1 register Figure 16.1 Comparator ...

Page 182

R8C/18 Group, R8C/19 Group (1) A/D Control Register Symbol ADCON0 Bit Symbol CH0 CH1 CH2 MD ADGSEL0 ADCAP ADST CKS0 NOTES the ADCON0 register is rew ritten ...

Page 183

R8C/18 Group, R8C/19 Group (1) A/D Control Register Symbol ADCON2 Bit Symbol — (b0) CMPSEL — (b3-b2) — (b7-b4) NOTE the ADCON2 register is rew ritten ...

Page 184

R8C/18 Group, R8C/19 Group 16.1 One-Shot Mode In one-shot mode, the input voltage on one selected pin is comparator converted once. Table 16.2 lists the One-Shot Mode Specifications. Figure 16.4 shows Registers ADCON0 and ADCON1 in One-Shot Mode. Table 16.2 ...

Page 185

R8C/18 Group, R8C/19 Group (1) A/D Control Register Symbol ADCON0 Bit Symbol CH0 CH1 CH2 MD ADGSEL0 ADCAP ADST CKS0 NOTES the ADCON0 register is rew ...

Page 186

R8C/18 Group, R8C/19 Group 16.2 Repeat Mode In repeat mode, the input voltage on one selected pin is comparator converted repeatedly. Table 16.3 lists the Repeat Mode Specifications. Figure 16.5 shows Registers ADCON0 and ADCON1 in Repeat Mode. Table 16.3 ...

Page 187

R8C/18 Group, R8C/19 Group (1) A/D Control Register Symbol ADCON0 Bit Symbol CH0 CH1 CH2 MD ADGSEL0 ADCAP ADST CKS0 NOTES the ADCON0 register is rew ...

Page 188

R8C/18 Group, R8C/19 Group 16.3 Notes on Comparator • Write to each bit (other than bit 6) in the ADCON0 register, each bit in the ADCON1 register, or the CMPSEL bit in the ADCON2 register when the comparator conversion stops ...

Page 189

R8C/18 Group, R8C/19 Group 17. Flash Memory Version 17.1 Overview In the flash memory version, rewrite operations to the flash memory can be performed in three modes; CPU rewrite, standard serial I/O, and parallel I/O. Table 17.1 lists the Flash ...

Page 190

R8C/18 Group, R8C/19 Group Table 17.2 Flash Memory Rewrite Modes Flash Memory CPU Rewrite Mode Rewrite Mode Function User ROM area is rewritten by executing software commands from the CPU. EW0 mode: Rewritable in any EW1 mode: Rewritable in flash ...

Page 191

R8C/18 Group, R8C/19 Group 17.2 Memory Map The flash memory contains a user ROM area and a boot ROM area (reserved area). Figure 17.1 shows a Flash Memory Block Diagram for R8C/18 Group. Figure 17.2 shows a Flash Memory Block ...

Page 192

R8C/18 Group, R8C/19 Group 8 Kbyte ROM product 02400h Block A: 1 Kbyte Block B: 1 Kbyte 02BFFh 0E000h Block 0: 8 Kbytes 0FFFFh User ROM area 16 Kbyte ROM product 02400h Block A: 1 Kbyte Block B: 1 Kbyte ...

Page 193

R8C/18 Group, R8C/19 Group 17.3 Functions to Prevent Rewriting of Flash Memory Standard serial I/O mode has an ID code check function, and parallel I/O mode has a ROM code protect function to prevent the flash memory from being read ...

Page 194

R8C/18 Group, R8C/19 Group 17.3.2 ROM Code Protect Function The ROM code protect function disables reading or changing the contents of the on-chip flash memory by the OFS register in parallel I/O mode. Figure 17.4 shows the OFS Register. The ...

Page 195

R8C/18 Group, R8C/19 Group 17.4 CPU Rewrite Mode In CPU rewrite mode, the user ROM area can be rewritten by executing software commands from the CPU. Therefore, the user ROM area can be rewritten directly while the MCU is mounted ...

Page 196

R8C/18 Group, R8C/19 Group 17.4.1 EW0 Mode The MCU enters CPU rewrite mode and software commands can be acknowledged by setting the FMR01 bit in the FMR0 register to 1 (CPU rewrite mode enabled). In this case, since the FMR11 ...

Page 197

R8C/18 Group, R8C/19 Group Figure 17.5 shows the FMR0 Register. Figure 17.7 shows the FMR4 Register. 17.4.2.1 FMR00 Bit This bit indicates the operating status of the flash memory. The bits value is 0 during programming, erasure, or erase-suspend mode; ...

Page 198

R8C/18 Group, R8C/19 Group 17.4.2.10 FMR40 Bit The suspend function is enabled by setting the FMR40 bit to 1 (enable). 17.4.2.11 FMR41 Bit In EW0 mode, the MCU enters erase-suspend mode when the FMR41 bit is set ...

Page 199

R8C/18 Group, R8C/19 Group Flash Memory Control Register Symbol FMR0 Bit Symbol FMR00 FMR01 FMR02 FMSTP — (b5-b4) FMR06 FMR07 NOTES set this bit to 1, set ...

Page 200

R8C/18 Group, R8C/19 Group Flash Memory Control Register Symbol FMR1 Bit Symbol — (b0) FMR11 — (b4-b2) FMR15 FMR16 — (b7) NOTES set this bit ...

Related keywords