Sensor / Measurement

SQ003116E001
ML610Q400 Series
Sample Program AP Notes
For
Sensor/Mesurement Application
3rd Edition
Issue Date: April 16, 2010
NOTICE
No copying or reproduction of this document, in part or in whole, is permitted without the consent of LAPIS
Semiconductor Co., Ltd.
The content specified herein is subject to change for improvement without notice.
The content specified herein is for the purpose of introducing LAPIS Semiconductor's products (hereinafter
"Products"). If you wish to use any such Product, please be sure to refer to the specifications, which can be obtained
from LAPIS Semiconductor upon request.
Examples of application circuits, circuit constants and any other information contained herein illustrate the standard
usage and operations of the Products. The peripheral conditions must be taken into account when designing circuits
for mass production.
Great care was taken in ensuring the accuracy of the information specified in this document. However, should you
incur any damage arising from any inaccuracy or misprint of such information, LAPIS Semiconductor shall bear no
responsibility for such damage.
The technical information specified herein is intended only to show the typical functions of and examples of
application circuits for the Products. LAPIS Semiconductor does not grant you, explicitly or implicitly, any license
to use or exercise intellectual property or other rights held by LAPIS Semiconductor and other parties. LAPIS
Semiconductor shall bear no responsibility whatsoever for any dispute arising from the use of such technical
information.
The Products specified in this document are intended to be used with general-use electronic equipment or devices
(such as audio visual equipment, office-automation equipment, communication devices, electronic appliances and
amusement devices).
The Products specified in this document are not designed to be radiation tolerant.
While LAPIS Semiconductor always makes efforts to enhance the quality and reliability of its Products, a Product
may fail or malfunction for a variety of reasons.
Please be sure to implement in your equipment using the Products safety measures to guard against the possibility of
physical injury, fire or any other damage caused in the event of the failure of any Product, such as derating,
redundancy, fire control and fail-safe designs. LAPIS Semiconductor shall bear no responsibility whatsoever for
your use of any Product outside of the prescribed scope or not in accordance with the instruction manual.
The Products are not designed or manufactured to be used with any equipment, device or system which requires an
extremely high level of reliability the failure or malfunction of which may result in a direct threat to human life or
create a risk of human injury (such as a medical instrument, transportation equipment, aerospace machinery,
nuclear-reactor controller, fuel-controller or other safety device). LAPIS Semiconductor shall bear no responsibility
in any way for use of any of the Products for the above special purposes. If a Product is intended to be used for any
such special purpose, please contact a ROHM sales representative before purchasing.
If you intend to export or ship overseas any Product or technology specified herein that may be controlled under the
Foreign Exchange and the Foreign Trade Law, you will be required to obtain a license or permit under the Law.
Copyright 2009 - 2011 LAPIS Semiconductor Co., Ltd.
ML610Q400 Series
Sample Program AP Notes
Table of Contents
1.
Overview.......................................................................................................................................1
1.1. Software Configuration ............................................................................................................2
1.2. List of Folders and Files...........................................................................................................3
1.3. Build Procedure ........................................................................................................................5
1.4. Restrictions ...............................................................................................................................7
1.4.1.
About Available Functional Modules................................................................................7
1.4.2.
About Functions of Sample Program................................................................................8
1.4.3.
About Display Area of LCD panel.....................................................................................9
2.
System Configuration ................................................................................................................10
2.1. Typical Peripheral Circuit Diagram ......................................................................................10
2.2. LCD Panel Specifications .......................................................................................................11
3.
Description of Functional Modules............................................................................................12
3.1. SA-ADC Control Module ........................................................................................................12
3.1.1.
Function Overview ..........................................................................................................13
3.1.2.
Operating Conditions ......................................................................................................13
3.1.3.
Sample of Use ..................................................................................................................14
3.1.3.1.
Conversion Procedure ..............................................................................................14
3.2. RC-ADC Control Module ........................................................................................................16
3.2.1.
Function Overview ..........................................................................................................25
3.2.2.
Operating Conditions ......................................................................................................26
3.2.3.
Sample of Use ..................................................................................................................27
3.2.3.1.
A/D Conversion Procedure .......................................................................................27
3.3. Temperature Calculation Module ..........................................................................................29
3.3.1.
Function Overview ..........................................................................................................32
3.3.2.
Operating Conditions ......................................................................................................32
3.3.3.
Sample of Use ..................................................................................................................33
3.4. UART Communication Control Module.................................................................................35
3.4.1.
Function Overview ..........................................................................................................36
3.4.2.
Operating Conditions ......................................................................................................36
3.4.3.
Sample of Use ..................................................................................................................37
3.4.3.1.
Transmission Procedure...........................................................................................37
3.4.3.2.
Reception Procedure.................................................................................................39
3.5. UART Baud Rate Correction Module ....................................................................................41
3.5.1.
Function Overview ..........................................................................................................41
3.5.2.
High-Speed Clock Frequency Measurement by Software .............................................41
3.5.3.
High-Speed Clock Frequency Measurement by Hardware ...........................................41
3.5.3.1.
Function Overview ...................................................................................................41
3.5.4.
Operating Conditions ......................................................................................................43
3.5.5.
Sample of Use ..................................................................................................................44
3.5.5.1.
Baud Rate Correction Procedure (when 16-bit frequency measurement mode not
used)
44
3.5.5.2.
Baud Rate Correction Procedure (when 16-bit frequency measurement mode used)
46
3.6. I2C Communication Control Module .....................................................................................48
3.6.1.
Function Overview ..........................................................................................................49
3.6.2.
Operating Conditions ......................................................................................................49
3.6.3.
Sample of Use ..................................................................................................................50
3.6.3.1.
Transmission Procedure...........................................................................................50
3.6.3.2.
Reception Procedure.................................................................................................52
3.7. EEPROM Control Module ......................................................................................................54
Contents − 1
ML610Q400 Series
Sample Program AP Notes
3.7.1.
Function Overview ..........................................................................................................54
3.7.2.
Operating Conditions ......................................................................................................54
3.7.3.
Sample of Use ..................................................................................................................55
3.7.3.1.
Write Procedure........................................................................................................55
3.7.3.2.
Read Procedure.........................................................................................................57
3.8. LCD Display Control Module.................................................................................................59
3.8.1.
Function Overview ..........................................................................................................60
3.8.2.
Operating Conditions ......................................................................................................60
3.8.3.
LCD Panel Specifications................................................................................................61
3.8.4.
LCD Setting .....................................................................................................................62
3.8.4.1.
Display Position ⇔ DSPR Address Correspondence Table (for the LCD driver with
the display allocation function) .................................................................................................62
3.8.4.2.
Segment Pattern Data Table for 8-Seg Display (for the LCD driver with the
display allocation function)........................................................................................................63
3.8.4.3.
Segment Pattern Data Table for 16-SEG Display (for the LCD driver with the
display allocation function)........................................................................................................64
3.8.4.4.
Display Position ⇔ DSPR Address Correspondence Table (for the LCD driver
without the display allocation function)....................................................................................66
3.8.4.5.
Segment Pattern Data Table for 8-Seg Display (for the LCD driver without the
display allocation function)........................................................................................................67
3.8.5.
Sample of Use ..................................................................................................................68
3.8.5.1.
Clock Time Display Procedure.................................................................................68
3.9. Key Input Control Module .....................................................................................................71
3.9.1.
Function Overview ..........................................................................................................71
3.9.2.
Operating Conditions ......................................................................................................72
3.9.3.
Key Read-In Timing Diagram.........................................................................................72
3.9.4.
Sample of Use ..................................................................................................................73
3.9.4.1.
Key Event Acquisition Procedure ............................................................................73
3.10.
Melody Control Module.......................................................................................................75
3.10.1.
Function Overview.......................................................................................................76
3.10.2.
Operating Conditions...................................................................................................76
3.10.3.
Sample of Use...............................................................................................................77
3.10.3.1. Melody Output Procedure ........................................................................................77
3.11.
Real-Time Clock Control Module .......................................................................................79
3.11.1.
Function Overview.......................................................................................................80
3.11.2.
Operating Conditions...................................................................................................80
3.11.3.
Sample of Use...............................................................................................................81
3.11.3.1. Date and Clock Time Setting Procedure .................................................................81
3.12.
Timer Control Module.........................................................................................................83
3.12.1.
Function Overview.......................................................................................................84
3.12.2.
Operating Conditions...................................................................................................84
3.12.3.
Sample of Use...............................................................................................................85
3.12.3.1. Procedure for Waiting for a Certain Period of Time ...............................................85
3.13.
Clock Control Module .........................................................................................................87
3.13.1.
Function Overview.......................................................................................................88
3.13.2.
Operating Conditions...................................................................................................88
3.14.
Time Base Counter Control Module...................................................................................89
3.14.1.
Function Overview.......................................................................................................90
3.14.2.
Operating Conditions...................................................................................................90
3.15.
1 kHz Timer Control Module ..............................................................................................91
3.15.1.
Function Overview.......................................................................................................91
3.15.2.
Operating Conditions...................................................................................................92
3.16.
Stopwatch Module...............................................................................................................93
3.16.1.
Function Overview.......................................................................................................93
Contents − 2
ML610Q400 Series
Sample Program AP Notes
3.16.2.
Operating Conditions...................................................................................................93
3.16.3.
Sample of Use...............................................................................................................94
3.17.
BLD Control Module ...........................................................................................................95
3.17.1.
Function Overview.......................................................................................................95
3.17.2.
Operating Conditions...................................................................................................96
3.17.3.
Sample of Use...............................................................................................................97
4.
Description of the Sample Program ..........................................................................................98
4.1. Common Specifications ..........................................................................................................98
4.2. Configuration of the LCD Panel ............................................................................................99
4.2.1.
LCD Display Image with Display Allocation Function..................................................99
4.2.2.
LCD Display Image with no Display Allocation Function...........................................100
4.3. Key Event..............................................................................................................................101
4.4. List of Melodies.....................................................................................................................101
4.5. About Compile Options ........................................................................................................102
4.6. Function Overview ...............................................................................................................103
4.6.1.
Functions of Sample Program.......................................................................................103
4.6.2.
State Transition Diagram .............................................................................................103
4.6.3.
State Transition Table...................................................................................................104
4.7. Operating Mode Select Mode ...............................................................................................105
4.7.1.
Description of Operation ...............................................................................................105
4.7.2.
Description of LCD Display ..........................................................................................105
4.7.3.
Description of UART Display........................................................................................105
4.7.4.
Explanation of Key Operation ......................................................................................105
4.8. SA-ADC Measurement Mode ...............................................................................................106
4.8.1.
State Transition.............................................................................................................106
4.8.2.
Description of LCD Display ..........................................................................................107
4.8.3.
Description of UART Display........................................................................................108
4.8.4.
Explanation of Key Operation ......................................................................................108
4.9. RC-ADC Measurement Mode...............................................................................................109
4.9.1.
State Transition.............................................................................................................109
4.9.2.
Description of LCD Display .......................................................................................... 111
4.9.3.
Description of UART Display........................................................................................112
4.9.4.
Explanation of Key Operation ......................................................................................112
4.10.
UART Communication Mode............................................................................................113
4.10.1.
State Transition .........................................................................................................113
4.10.2.
Description of LCD Display.......................................................................................114
4.10.3.
Description of UART Display ....................................................................................114
4.10.4.
Explanation of Key Operation...................................................................................114
4.11.
Stopwatch Mode ................................................................................................................115
4.11.1.
State Transition .........................................................................................................115
4.11.2.
Description of LCD Display.......................................................................................116
4.11.3.
Description of UART Display ....................................................................................116
4.11.4.
Explanation of Key Operation...................................................................................116
4.12.
UART Data Formats.........................................................................................................117
4.12.1.
SA-ADC Measurement Result Transmission Data Format .....................................117
4.12.2.
RC-ADC Measurement Result Transmission Data Format.....................................118
4.12.3.
Data Format in UART Communication Mode..........................................................119
4.13.
EEPROM Memory Map ....................................................................................................120
4.13.1.
Management Information Storage Area ...................................................................120
4.13.2.
SA-ADC Measurement Result Storage Area ............................................................121
4.13.3.
RC-ADC Measurement Result Storage Area ............................................................121
Contents − 3
ML610Q400 Series
Sample Program AP Notes
1.
Overview
This document describes the application programming notes (hereafter called the AP notes) arranged to help customers
develop software that, by using the SA-ADC, RC-ADC, UART, and 1 kHz timer, which are hardware that the
ML610Q400 Series MCU (hereafter called the MCU) has, performs sensor measurements, UART communication, and
clocking by stopwatch.
APIs are provided for each function module. The AP notes describe the functions and operating conditions of each API
and samples of use of those APIs.
In connection with the AP notes, a sample program is provided that actually operates using APIs on ML610Q400 Series
Demo Kit.
Related Documents
The following are the related documents. Read them as required.
ML610Q400 Series Sample Program API Manual
ML610Q431/ML610Q432 User’s Manual
ML610Q411/ML610Q412/ML610Q415 User’s Manual
ML610Q421/ML610Q422 User’s Manual
ML610Q482 User’s Manual
ML610Q435/ML610Q436 User’s Manual
ML610Q400 Series Demo Kit Hardware User’s Manual
nX-U8/100 Core Instruction Manual
MACU8 Assembler Package User’s Manual
CCU8 User’s Manual
CCU8 Programming Guide
CCU8 Language Reference
DTU8 User’s Manual
IDEU8 User’s Manual
uEASE User’s Manual
uEASE Connection Manual ML610Qxxx
FWuEASE Flash Writer Host Program User’s Manual
LCD Image Tool User’s Manual
1
ML610Q400 Series
Sample Program AP Notes
1.1.
Software Configuration
Figure 1-1 shows the software configuration.
Figure 1-1
Software Configuration
2
ML610Q400 Series
Sample Program AP Notes
1.2.
List of Folders and Files
The folders and the files are as listed below.
[measure]
├ [_output]
│ ├ [_hex]
│ ├ [_lst]
│ ├ [_obj]
│ └ [_prn]
├ [adjustBaudrate]
│ ├ adjustBaudrate.c
│ └ adjustBaudrate.h
├ [bld]
│ ├ bld.h
│ └ bld_chk.c
├ [chr]
│ ├ chr.c
│ └ chr.h
├ [chrkey]
│ ├ chrkey.c
│ └ chrkey.h
├ [clock]
│ ├ clock.c
│ ├ clock.h
│ ├ clock_sysFunc.c
│ └ clock_sysFunc.h
├ [common]
│ ├ common.c
│ └ common.h
├ [convert]
│ ├ converctof.asm
│ ├ convert.c
│ └ convert.h
├ [eeprom]
│ ├ eeprom.c
│ └ eeprom.h
├ [hum]
│ ├ hum.c
│ └ hum.h
├ [i2c]
│ ├ i2c.c
│ └ i2c.h
├ [irq]
│ ├ irq.c
│ └ irq.h
├ [key]
│ ├ key.c
│ └ key.h
├ [lcd]
│ ├ LCD.c
│ ├ LCD.h
│ ├ U8_Sample.tac
│ └ U8_Sample.tbc
… Build result output folder
… UART baud rate correction module folder
… BLD control module folder
… Stopwatch module folder
… Key input control module folder for the stopwatch function
… Clock control module folder
… General-purpose function module folder
… Celsius Fahrenheit conversion module folder
… EEPROM control module folder
… Humidity calculation module folder
… I2C communication control module folder
… Interrupt control module folder
… Key input control module folder
… LCD display control module folder
3
ML610Q400 Series
Sample Program AP Notes
[continued from the previous page]
├
│
│
│
│
│
│
│
│
│
│
│
├
│
│
├
│
│
│
│
│
│
│
│
├
│
│
├
│
│
├
│
│
├
│
│
├
│
│
├
│
│
├
│
│
├
│
│
├
├
├
└
[main]
… Sample program main folder
├ [mcu_large]
│ └ mcu.h
├ [mcu_small]
│ └ mcu.h
├ eepromMap.h
├ main.c
├ main.h
├ melodyTbl.c
├ melodyTbl.h
├ S610431SW.asm
└ S610435LW.asm
[melody]
… Melody control module folder
├ melody.c
└ melody.h
[mode]
… Sample program mode folder
├ chronoMode.c
├ chronoMode.h
├ rcadcmode.c
├ rcAdcMode.h
├ saAdcMode.c
├ saAdcMode.h
├ uartMode.c
└ uartMode.h
[rcAdc]
… RC-ADC control module folder
├ rcAdc.c
└ rcAdc.h
[rtc]
… Real-time clock control module folder
├ rtc.c
└ rtc.h
[saAdc]
… SA-ADC control module folder
├ saAdc.c
└ saAdc.h
[t1k]
… 1 kHz timer control module folder
├ t1k.c
└ t1k.h
[tbc]
… Time base counter control module folder
├ tbc.c
└ tbc.h
[temp]
… Temperature calculation module folder
├ temp.c
└ temp.h
[timer]
… Timer control module folder
├ timer.c
└ timer.h
[uart]
… UART communication control module folder
├ uart.c
└ uart.h
readme.txt
… Description of compile options
S16_div10_and_mod.asm
… Sample program assembler code (Div10)
U8_Measure_Sample_Large.PID
… Project file for large model MCU
U8_Measure_Sample_Small.PID
… Project file for small model MCU
4
ML610Q400 Series
Sample Program AP Notes
1.3.
Build Procedure
1 Start IDEU8, select the menu “Open” and open the project file (PID file). In the case that MCU
memory model is small model, the project file is “U8_Measure_Sample_Small.PID”. In the case of
large model, the project file is “U8_Measure_Sample_Large.PID”. Correspondence of MCU and PID
file is shown below.
Table 1-1 Correspondence of MCU and PID file
Supported MCU
U8_Measure_Sample_Small.PID
ML610Q431/432
ML610Q421/422
ML610Q411/412/415
ML610Q482
U8_Measure_Sample_Large.PID
ML610Q435/436
2 In the default setting, ML610Q431 is set as the target MCU.
If your target MCU is different, follow the procedure below to change the setting.
(1) Select the menu “Project” -> “Options” -> “Compiler/assembler”.
(2) In the displayed window, select the target MCU from the “Target microcontroller” list
in the “General” tab. Also, modify the following option in the “Additional options” field
in the “Assembler control” group.
/DEFTARGET=TYPE(M6104XX)
About the “XX” part, replace with the type number of MCU
For example, if ML610Q432 is used, input the following option.
/DEFTARGET=TYPE(M610432)
(3) Remove the startup file “S610431SW.asm“ registered in the file tree of IDEU8. Instead
of that, register your target MCU’s startup file. (In the case of ML610Q432, it is
S610432SW.asm.)
(4) Define the macro that represents the target MCU.
Select the menu “Project” -> “Options” -> “Compiler/assembler” -> ”Macro”tab. In the
displayed window, define the macro like following name.
_ML610Q4XX
About the “XX” part, replace with the type number of MCU
For example, if ML610Q432 is used, define the following macro.
_ML610Q432
In the case that the macro other than the type number in the above Table 1-1 is defined,
the case that macro such as above is not defined, or the case that the memory model
that is supported by PID file is different from the memory model of MCU that is
defined by the above macro, the compiler issues the following error at the beginning of
the output messages.
Error : E2000 : #error : “Unknown target MCU”
5
ML610Q400 Series
Sample Program AP Notes
(5) If necessary, modify other macro definitions.
About the available macro definitions, see the “readme.txt” in the sample program
folder.
- For ML610Q43X series MCU
LCD_TYPE = 1
FREQ_TIMER_MODE = 0
_RTC_TYPE
_MELODY_TYPE
_CHRONO_DSP_REG
_SAADC_REG
- For ML610Q42X series MCU
LCD_TYPE = 1
FREQ_TIMER_MODE = 0 or 1
_MELODY_TYPE
_CHRONO_DSP_REG
- For ML610Q41X series MCU
LCD_TYPE = 0
FREQ_TIMER_MODE = 0 or 1
(For ML610Q415, frequency measurement mode by hardware is not available on
ML610Q415 because it does not have low-speed crystal oscillation clock. Please define
FREQ_TIMER_MODE macro as 0.)
- For ML610Q41X series MCU
FREQ_TIMER_MODE = 0 or 1
3 Select the menu “Project” -> “Rebuild”. Then the build procssing for the sample program starts.
4 When the build processing is completed, .abs file is generated in the project folder and .hex file is
generated in _output\_hex folder.
6
ML610Q400 Series
Sample Program AP Notes
1.4.
Restrictions
1.4.1.
About Available Functional Modules
In the functional modules that are described in the section “3 Description of Functional Modules”, the available
functional modules are different by target MCU, due to the difference of MCU peripherals. In the case that these
functional modules are applied to user application, available functional modules on each MCU are shown below.
Table 1-2 List of available functional modules
SA-ADC Control Module
RC-ADC Control Module
Temperature Calculation Module
Celsius Fahrenheit conversion module *4
Humidity Calculation Module *4
UART Communication Control Module
UART Baud Rate Correction Module
Frequency measurement mode
I2C Communication Control Module
Functional
modules
EEPROM Control Module
LCD Display Control Module
Key Input Control Module
Melody Control Module
Real-Time Clock Control Module
Timer Control Module
Clock Control Module
Time Base Counter Control Module
1 kHz Timer Control Module
Stopwatch Module
BLD Control Module
Supported MCU
ML610Q43X ML610Q42X ML610Q41X
○
○ *2
○ *2
○
○
○
○
○
○
○
○
○
○
○
○
○
○
○
○
○
○
×
○
○ *1
○
○
○
○
○
○
○
○ *3
○ *3
○
○
○
○
○
×
○
×
×
○
○
○
○
○
○
○
○
○
○
○
○
○
○
○
○
○
○
ML610Q48X
×
○
○
○
○
○
○
○
○
○
×
○
×
×
○
○
○
×
×
○
○ : Available
× : Not available
*1: Frequency measurement mode by hardware is not available on ML610Q415 because it does not have low-speed crystal
oscillation clock.
*2: Function that uses the differential amplification input or the selection of amplifier gain and offset is not available.
*3: All display area of LCD panel can not be available, because the number of SEG pin that is connected to LCD panel
is not enough.
*4: For the details of these modules, please see the “ML610Q400 Series Sample Program AP Notes For Humidity
Calculation Module.”
7
ML610Q400 Series
Sample Program AP Notes
1.4.2.
About Functions of Sample Program
In the functions that are described in the section “4.6.1 Functions of Sample Program”, the available modes are different
by target MCU. The available modes in each MCU are shown below.
Table 1-3 List of available modes
SA-ADC measurement mode
RC-ADC measurement mode
UART communication mode
Stopwatch mode
○ : Available
× : Not available
ML610Q43X ML610Q42X ML610Q41X ML610Q48X
○
○
×
×
○
○
○ *1
○
○
○
○
○
○
○
×
×
*1: Only the tempareture measurement is available.
8
ML610Q400 Series
Sample Program AP Notes
1.4.3.
About Display Area of LCD panel
The display area of LCD panel is different by each MCU as follows, because of the specification difference of LCD
driver.
* It is requred for displaying all areas of LCD panel that LCD driver supports 64seg×4com pins at least. The number of
COM/SEG pin that LCD driver in each MCU supports is listed in parenthesis.
ML610Q43X: All area can be displayed.
(ML610Q431: 64seg×16com, ML610Q432: 64seg×24com)
ML610Q42X: Only the area of 1, 2 and 4 can be displayed.
(ML610Q421: 50seg×8com, ML610Q422: 50seg×16com)
ML610Q41X: Only the area of 1 and 2 can be displayed.
(ML610Q411: 36seg×4com, ML610Q412: 44seg×4com, ML610Q415: 36seg×4com)
ML610Q48X: All area can not be displayed, because ML610Q48X does not have LCD driver.
9
ML610Q400 Series
Sample Program AP Notes
2.
System Configuration
2.1.
Typical Peripheral Circuit Diagram
LCD
Coin Cell
NMI
VDD
COM0~3 (*)
SEG0~63 (*)
NMI
S1
S2
P00/CAP0
EXVDDV
P01/CAP1
EXGND
P02
S3
P03
S4
RESET_N
ML610Q4xx
P30/IN0
P31/CS0
CX
Cd
Cc
Cb
Ca
VDDX
P32/RS0
VL4
P33/RT0
VL3
P34/RCT0
VL2
P35/RCM
VL1
P44/IN1
C4
P45/CS1
C34
P46/RS1
C3
C2
1/4 Bias
P47/RT1
CS0
CVR0
RS0
RT0
CS1
CVR1
RS1
RT1
C12
C1
XT0
CGL
AVDD
AVref
XL
CDL
AVSS
XT1
32.768KHz
Xtal
P22
/MD0
P20 P41 P40
P42 P43
/RXD /TXD
AIN0
(Output) /SCL /SDA
Buzzer
ICL2332
GND R1In T1Out
4
3
V+
2
V-
WP SCL SDA
GND TXD RXD
9-pin D-SUB
A0 A1
CV
:1uF
:1uF
CL0
:0.1uF
CL1
:1uF
C1
CX
:0.1uF
Ca,Cb,Cc,Cd
:1uF
:1uF
C12,C34
: No ( 0 pF )
CGL
CDL
: No ( 0 pF )
Vcc
2
I C EEPROM
A2
Vss
RS0
CS0
CVR0
RT0
: 10 Kohm
: 560 pF
: 820 pF
: 103AT (Semitec) thermister
RS1
CS1
CVR1
RT1
: 150 Kohm
: 680 pF
: 820 pF
: C10-M53R (Shinyei) humidity sensor
Figure 2-1 Peripheral Circuit Diagram
(*) The number of COM/SEG pin that can be connected to LCD panel depends on the type of the LCD driver built into
the MCU. Please see the chapter “LCD Driver” of the User’s Manual for your target MCU.
For more detail about the peripheral curcuit, please see the “ML610Q400 Series Demo Kit Hardware User’s Manual”.
10
ML610Q400 Series
Sample Program AP Notes
2.2.
LCD Panel Specifications
16-segment characters:
7-segment characters:
8-segment characters:
Marks for hand-held calculator:
Other marks:
Figure 2-2
The 4 digits on the upper part of the panel
The 6 digits on the upper part of the panel
The 12 digits on the lower part of the panel
7
32
Layout of the LCD Panel
Table 2-1 Pin Assignments (COM/SEG)
Specifications of Operation
Clock for bias generation circuit voltage multiplication:
Bias of the bias generation circuit:
Duty:
Frame frequency:
11
1/16 LSCLK (2 kHz)
1/4
1/4 duty
73 Hz
ML610Q400 Series
Sample Program AP Notes
3.
Description of Functional Modules
3.1.
SA-ADC Control Module
This MCU has a 2-channel successive approximation type A/D converter (SA-ADC) with a built-in sample & hold.
This SA-ADC consists of two stages, the first one being the first amplifier that supports differential amplification input
and the second one being the second amplifier that allows gain and offset adjustment. By combining these two
amplifiers, various analog input values can be measured. In addition, by short-circuiting between input pins at the time
of differential amplification input, the offset value of the amplifiers can be measured.
AVDD
VREF
AVSS
AMPCON0
AIN0
AIN1
1st amplifier
(differential
input)
12-bit
successive
approximation
type A/D
converter
AMPGAIN
2nd amplifier
(inversion
amplifier)
SADRnL,
SADRnH
Analog
selector
AMPOFFS
HSCLK
(4.096MHz/500KHz)
SADCON0,SADCON1,
SADMOD0
SADINT
8
Data bus
SADR0L
SADR0H
SADR1L
SADR1H
SADCON0
SADCON1
SADMOD0
AMPOFFS
AMPGAIN
AMPCON0
: SA-ADC result register 0L
: SA-ADC result register 0H
: SA-ADC result register 1L
: SA-ADC result register 1H
: SA-ADC control register 0
: SA-ADC control register 1
: SA-ADC mode register 0
: Amplifier offset register
: Amplifier gain register
: Amplifier control register 0
Figure 3-1 Configuration of SA-ADC
Table 3-1 List of Pins
Pin name
AVDD
VREF
AVSS
AIN0
AIN1
I/O
⎯
⎯
⎯
I
I
Description
Positive power supply pin for successive approximation type A/D converter
Reference power supply pin for successive approximation type A/D converter
Negative power supply pin for successive approximation type A/D converter
Successive approximation type A/D converter input pin 0
Successive approximation type A/D converter input pin 1
* For details, refer to the chapter “Successive Approximation Type A/D Converter (SA-ADC)” of the User’s Manual
for your target MCU.
12
ML610Q400 Series
Sample Program AP Notes
3.1.1.
Function Overview
The SA-ADC control module sets the initial settings (such as conversion count, operating mode, 2nd amplifier setting),
starts/stops SA-ADC conversion, and acquires SA-ADC conversion results.
Table 3-2 lists the SA-ADC control module APIs.
Table 3-2 List of APIs
Function name
saAdc_init function
saAdc_execute function
saAdc_getResult function
Description
Specifies the number of times conversion is performed by the SA-ADC
(once/continuous), selects the clock frequency range of the HSCLK being
used, specifies the operating mode, and sets the offset and gain of the 2nd
amplifier.
Starts/stops SA-ADC conversion.
Acquires SA-ADC conversion results (12 bits).
* For details of APIs, refer to the “ML610Q400 Series Sample Program API Manual.”
3.1.2.
Operating Conditions
This section describes the operating conditions and valid range of this module. It also describes the restrictions on this
module.
Operating voltage:
VDD = 1.8 to 3.6 V
Operating CLK:
2 types (the module can be used only in the range of 375 kHz to 1.1 MHz or
1.99 MHz to 4.2 MHz)
Operating conditions
The module can be used only in cases where high-speed clock (HSCLK) oscillation
is enabled.
* Specified by the frequency control register (FCON0).
A/D conversion voltage range AVREF to AVSS
A/D conversion time
46 µs, when operating at 500 kHz in RC oscillation mode
A/D resolution
12 bits (0 to 0x0FFF)
Conversion method
2 types (convert only once/convert continuously)
Operating mode
4 types
¾ CH0 = direct input, CH1 = direct input
¾ CH0 = direct input, CH1 = amplification input
* Necessary to set the offset and gain of the 2nd amplifier
¾ CH0 = amplification input,
* Necessary to set the offset and gain of the 2nd amplifier
CH1 = amplification input
¾ Differential amplification input
* Necessary to set the offset and gain of the 2nd amplifier
Input offset of the 2nd amplifier
Gain (multiplication factor) of the 2nd amplifier
Setting of measurement mode
32 types (Offset adjustment: −9.5 to +6.0[%], in 0.5% increments)
16 types (AMP gain: 1x to 8.5x, in 0.5x increments)
2 types (normal measurement/amplifier offset measurement)
* Only differential amplification input is enabled.
Note:
For A/D conversion accuracy, refer to the chapter “Electrical Characteristics” of the User’s Manual for your target
MCU.
13
ML610Q400 Series
Sample Program AP Notes
3.1.3.
Sample of Use
The subsection below shows the conversion procedure that uses the SA-ADC control module.
3.1.3.1. Conversion Procedure
Shown below is the procedure from initialization to obtaining A/D conversion results using the SA-ADC control
module.
Main Routine
1)
Set HSCLK
2)
Initialize SA-ADC control module
saAdc_init function
SA-ADC Interrupt (SADINT)
3)
Start SA-ADC conversion
saAdc_execute function
4)
1)
5)
Stop SA-ADC conversion
saAdc_execute function
6)
Acquire SA-ADC conversion
results
saAdc_getResult function
Figure 3-2
SA-ADC conversion completion
processing
Conversion Procedure
14
ML610Q400 Series
Sample Program AP Notes
[Main Routine]
1) Set HSCLK.
¾ The SA-ADC counts HSCLK to set conversion time; therefore, it is necessary to set the settings for HSCLK
before conversion.
2) Initialize the SA-ADC control module.
¾ Set the following conversion conditions in the saAdc_init function and initialize the SA-ADC control module.
1 Specify the number of times conversion is performed.
2 Specify the range of clock frequency of HSCLK.
3 Specify the operating mode.
4 Set the input offset of the 2nd amplifier.
5 Set the gain (multiplication factor) of the 2nd amplifier.
3) Start SA-ADC conversion.
¾ Specify the channel on which conversion will be performed in the designated parameter of the saAdc_execute
function and start SA-ADC operation. Since channels are specified on a per-bit basis, multiple channels can be
specified at the same time.
4) Wait for SA-ADC conversion completion.
¾ Wait until SA-ADC interrupt occurs (conversion complete).
5) Stop SA-ADC conversion
¾ Specify stopping of conversion in the designated parameter of the saAdc_execute function and stop SA-ADC
operation.
6) Acquire SA-ADC conversion results.
¾ Specify the channel number of the channel the conversion results on which are to be acquired in the designated
parameter of the saAdc_getResult function and acquire the SA-ADC conversion results. Because of
specification of channel No., only the conversion results for one channel can be acquired.
[SA-ADC interrupt (SADINT)]
1) SA-ADC conversion completion processing
¾ The SA-ADC interrupt processing sets the flag that indicates conversion completion.
15
ML610Q400 Series
Sample Program AP Notes
3.2.
RC-ADC Control Module
This MCU has a 2-channel RC oscillator type A/D Converter (RC-ADC). This RC-ADC achieves A/D conversion by
digitizing the ratio of the oscillation frequency of the reference resistor (or capacitor) to that of the resistance sensor
such as thermistor (or capacitance sensor).
By making the RC-ADC perform RC oscillation both on the reference side and on the sensor side with the reference
resistor and the resistance sensor placed in pairs, the error cause that the RC oscillator circuit itself has will be negated.
As a result, the characteristics of the sensor itself can be A/D converted. By taking the ratio of the oscillation
frequency on the reference side to that on the sensor side and then calculating the correlation between that ratio and the
temperature characteristics (that the thermistor has) in advance, it is possible to calculate temperature from the
frequency rate obtained.
LSCLK
LSCLK×2
Clock control
circuit
24-bit
binary counter
BSCLK
OVFA
HSCLK
Counter A (RADCA0–2)
P35/RCM
RCCLK
RCT0
RT0
RT0
RS0
RS0
CS0
CS0
RI0
Cvr0
RT1
RS1
RS1
CS1
CS1
Cvr1
OVFB
Counter B (RADCB0 to 2)
IN0
RCOSC0
RT1
RI1
24-bit
binary counter
RC-ADC
control circuit
(RADCON)
(RADMOD)
IN1
RCOSC1
Data bus
RADMOD
RADCON
RADCA0 to 2
RADCB0 to 2
: RC-ADC mode register
: RC-ADC control register
: RC-ADC counter A register
: RC-ADC counter B register
Figure 3-3 Configuration of RC-ADC
16
Interrupt
control
RADINT
ML610Q400 Series
Sample Program AP Notes
Table 3-3 List of Pins
Pin name
P30/IN0
I/O
I
P31/CS0
O
P32/RS0
O
P33/RT0
O
P34/RCT0
O
P35/RCM
P44/IN1
O
I
P45/CS1
O
P46/RS1
O
P47/RT1
O
Description
Oscillation input pin on channel 0. Used as the secondary function of the P30 pin.
Reference capacitor connection pin on channel 0. Used as the secondary function of the
P31 pin.
Reference resistor connection pin on channel 0. Used as the secondary function of the
P32 pin.
Pin for connecting the resistance sensor for measurement on channel 0. Used as the
secondary function of the P33 pin.
Pin for connecting the resistance sensor or capacitance sensor for measurement on
channel 0. Used as the secondary function of the P34 pin.
RC oscillation monitoring pin. Used as the secondary function of the P35 pin.
Oscillation input pin on channel 1. Used as the secondary function of the P44 pin.
Reference capacitor connection pin on channel 1. Used as the secondary function of the
P45 pin.
Reference resistor connection pin on channel 1. Used as the secondary function of the
P46 pin.
Pin for connecting the resistance sensor for measurement on channel 1. Used as the
secondary function of the P47 pin.
* For details, refer to the chapter “RC Oscillation Type A/D Converter (RC-ADC)” of the User’s Manual for your
target MCU.
In Figure 3.3, Counter A is a binary counter, which allows selecting the clock from among the low-speed clock
(LSCLK), 2xlow-speed clock (LSCLKx2), and high-speed clock (HSCLK) and can perform counting from 0H to
FFFFFFH.
Counter B also is a binary counter, which can count the oscillation clocks between Rs–Cs or between Rt–Cs from 0H to
FFFFFFH.
The RC-ADC generates an interrupt request by overflow of either Counter A or B. When an interrupt request is
generated, Counter A and B automatically stop counting.
The operation to cause an interrupt request by overflow of Counter A is called “the counter A reference mode” and the
operation to cause an interrupt request by overflow of Counter B is called “the counter B reference mode”.
17
ML610Q400 Series
Sample Program AP Notes
In counter A reference mode, it is possible to count the number of oscillations for Rs–Cs or Rt–Cs until the
clock oscillates up to the number of times placed in Counter A. In counter B reference mode, it is possible to
count the number of oscillations for Rs–Cs or Rt–Cs until the clock oscillates up to the number of times placed
in Counter B.
Time flow
Counter A
FFFFFFH
Interrupt generated
1000000-Nas
0H
Counter B
FFFFFFH
Nar
0H
Ta
Count starts
Figure 3-4
Interrupt generated
Counter A Reference Mode Operation
Time flow
Counter A
FFFFFFH
Nbs
0H
Counter B
FFFFFFH
Interrupt generated
1000000H-Nbrrb
0H s
Tb
Interrupt generated
Count starts
Figure 3-5
Counter B Reference Mode Operation
18
ML610Q400 Series
Sample Program AP Notes
- Principle of Resistance Value Measurement The oscillation time, Ta and Tb, can be expressed from Figure 3.5 by the following formulas (when the 32768Hz
clock is selected):
Ta[second] = Nas/32768 = Nar/fas ...... (equation 3.6.1)
Tb[second] = Nbs/32768 = Nbr/fbs ...... (equation 3.6.2)
where “fas” and “fbs” are the clock oscillation frequencies input to Counter B in equations 3.6.1 and 3.6.2.
Using “frs” as the oscillation frequency for Rs–Cs and “frt” for Rt–Cs, the oscillation frequencies can be given by the
following formulas:
frs = 1/ (krs × Rs × Cs) ...... (equation 3.6.3)
frt = 1/ (krt × Rt × Cs) ...... (equation 3.6.4)
where “krs” and “krt” are constants determined from voltage, resistance, capacitance and ambient temperatures.
By setting fas = frs and fbs = frt, equations (3.6.1) and (3.6.2) can be modified as follows:
Rs = Nar/Nas × 32768/(krs × Cs) ...... (equation 3.6.5)
Rs = Nbr/Nbs × 32768/(krt × Cs) ...... (equation 3.6.6)
If “krs”, “krt” and “Cs” are known, the resistance value (analog value) can be obtained by the counter value (digital
value) from equations (3.6.5) and (3.6.6).
However, due to fluctuations of the capacitance of Cs, it is not possible to obtain Rt accurately for actual products.
Therefore it is necessary to remove the fluctuation of Cs in some way.
19
ML610Q400 Series
Sample Program AP Notes
- How to Measure Resistance Value The fluctuation of Cs can be removed by taking the ratio of the oscillation frequency of the reference resistor Rs to the
oscillation frequency of the measured resistor Rt. The following is the justification for this:
From equations (3.6.5) and (3.6.6), the oscillation frequency ratio of f rt/f rs is expressed as follows:
frt/frs = (krs × Rs)/(krt × Rt) ...... (equation 3.6.7)
Assuming k rs and k rt take the same value, this equation becomes
frt/frs ≅ Rs/Rt ...... (equation 3.6.8)
Equation (3.6.8) does not contain Cs, which means the fluctuation of Cs can be removed by taking the oscillation
frequency ratio.
In the following, a method to obtain oscillation frequencies is explained. First, notation for the count values are
defined as:
Nas :
Nbs :
Nars :
Nbrs :
Nart :
Nbrt :
Count value of Counter A in counter A reference mode.
Count value of Counter A in counter B reference mode.
Count value of Counter B due to Rs–Cs oscillation in counter A reference mode.
Count value of Counter B due to Rs–Cs oscillation in counter B reference mode.
Count value of Counter B due to Rt–Cs oscillation in counter A reference mode.
Count value of Counter B due to Rt–Cs oscillation in counter B reference mode.
The following four methods are available to obtain oscillation frequency ratios:
Resistance Mesurement Method 1: The numbers of Rs–Cs oscillation (Nars) and Rt–Cs oscillation (Nart) are
measured within a constant duration (Ta) in counter A reference mode, and the
ratio is calculated.
Resistance Mesurement Method 2: Time (Tbs) for Rs–Cs until there are the constant numbers of oscillation (Nbrs)
and time (Tbt) for Rt–Ct until there are the constant numbers of oscillation
(Nbrt) are measured in counter B reference mode, and the ratio is calculated.
Resistance Mesurement Method 3: The numbers of oscillation (Nars) within a constant time (Ta) for Rs–Cs in
counter A reference mode is measured. Next, oscillation time (Tb) until there
are Nars times oscillations for Rt–Cs in counter B reference mode is measured.
Resistance Mesurement Method 4: Time (Ta) until there are the constant numbers (Nars) of oscillation in counter
B reference mode is measured. Next, the number of oscillations (Nart) within a
constant time (Ta = Tb) for Rt–Cs is measured.
Explanation of the methods 1–4 will be found in the next sections.
20
ML610Q400 Series
Sample Program AP Notes
Resistance Mesurement Method 1:
The numbers of Rs–Cs oscillation (Nars) and Rt–Cs oscillation (Nart) are
measured within a constant duration (Ta) in counter A reference mode, and
the ratio is calculated.
1 Formulas
The oscillation frequency ratio, f rt / f rs, can be obtained by
frt / frs = (Nart / Ta) / (Nars / Tb)
Since Ta and Tb are equal, the above equation becomes
frt / frs = Nart / Nars ...... (equation 3.6.9)
Resistance Rt
Frequency
2 Necessary characteristic diagrams
It is necessary to measure resistance–frequency characteristics to calculate frequency ratio–resistance characteristics.
In the program, resistance is obtained from the frequency ratio–resistance characteristics.
Rt–Cs oscillation (frt)
Rs–Cs oscillation (frs)
The frequency ratio is
converted to the
horizontal axis and
resistance is converted
to the vertical axis.
frs=frt
frt/frs
Rs
1
Rt=Rs Resistance Rt
Figure 3-6
Measurement of Resistance–
Frequency Characteristics
Figure 3-7
Frequency ratio
Calculation of Frequency Ratio–
Resistance Characteristics
3 Advantages of this method
Designing of the method is implemented easily as resistance values can be measured by division and reference to
the table instruction only.
Resistance–reference capacitor oscillation time is constant.
4 Disadvantages of this method
As seen in Figure 3-7, the change rate of resistance is large in the range where the frequency ratio is small. This may
result in erroneous results because of round-off errors in the frequency ratios.
It is necessary to increase the number of operation places of the frequency ratio in order to improve accuracy. This
may result in increased usage of RAM and operation time.
21
ML610Q400 Series
Sample Program AP Notes
Resistance Mesurement Method 2:
Time (Tbs) for Rs–Cs until there are the constant number (Nbrs) of oscillations
and time (Tbt) for Rt-Ct there are a constant number (Nbrt) of oscillations are
measured in counter B reference mode and the ratio is calculated.
1 Formulas
The oscillation frequency ratio, frt/frs, can be obtained by
frt / frs = (Nart / Tbt) / (Nars / Tbs)
Substituting N art=Nars and equations (3.6.1) and (3.6.2) into the above formula
frt / frs = Nbrs / Nbrt ...... (equation 3.6.10)
Resistance Rt
Frequency
2 Necessary characteristic diagrams
It is necessary to measure resistance–frequency characteristics to calculate frequency ratio–resistance characteristics.
In the program, resistance is obtained from the frequency-ratio–resistance characteristics.
Rt−Cs oscillation (frt)
Rs−Cs oscillation (frs)
The frequency ratio is
converted to the
horizontal axis and
resistance is
converted to the
vertical axis.
frs=frt
Rt=Rs
Figure 3-8
frt/frs
Rs
1
Resistance Rt
Measurement of Resistance–
Frequency Characteristics
Figure 3-9
Frequency ratio
Calculation of Frequency Ratio–
Resistance Characteristics
3 Advantages of this method
Designing of the method is implemented easily as resistance values can be measured by division and reference to
the table instruction only.
4 Disadvantages of this method
As seen in Figure 3-9, the change rate of resistance is large in the range where the frequency ratio is small. This may
result in erroneous results because of round-off errors in the frequency ratios.
It is necessary to increase the number of operation places of the frequency ratio in order to improve accuracy. This
may result in increased usage of RAM and operation time.
Measured resistance (Rt)–Reference capacitor oscillation time is fluctuating.
22
ML610Q400 Series
Sample Program AP Notes
Resistance Mesurement Method 3:
The numbers of oscillation (Nars) within a constant time (Ta) for Rs–Cs in
counter A reference mode is measured. Next, oscillation time (Tb) until there
are Nars times oscillations for Rt-Ct in counter B reference mode is
measured.
1 Formulas
Nbs can be obtained as follows:
Count A reference mode
Ta = Nas / 32768 = Nars / frs ...... (from equation 3.6.1)
Counter B reference mode
Tb = Nbrt / frt = Nbs / 32768 ...... (from equation 3.6.2)
From the above equations, it follows
Nars = Nas / 32768 × frs ...... (equation 3.6.11)
Nbrt = Nbs / 32768 × frt ...... (equation 3.6.12)
Substituting Nars = Nbrt into equations (3.6.11) and (3.6.12)
Nars = Nbrt = Nas / 32768 × frs=Nbs / 32768 × frt ...... (equation 3.6.13)
Equation (3.6.13) can be changed as
Nbs = Nas × frs / frt ...... (equation 3.6.13)
where Nas which determines oscillation time Ta is a constant.
Resistance Rt
Frequency
2 Necessary characteristic diagrams
If is necessary to measure resistance–frequency characteristics to calculate Nbs–resistance characteristics.
In the program, resistance is obtained from the Nbs–resistance characteristics.
Rt−Cs oscillation (frt)
Rs−Cs oscillation (frs)
Nas×frs/frt
frs=frt
Rs
Rt=Rs
Nbs=Nas
Resistance Rt
Figure 3-10 Measurement of Resistance–
Frequency Characteristics
Nbs
Figure 3-11 Calculation of Nbs–
Resistance Characteristics
Equation (3.6.4) is substituted into equation (3.6.13) as
Nbs = Nas × frs / (1 / krt × Rt × Cs)
= K × krt × Rt ...... (Equation 3.6.14)
where K = Nas × frs × Cs
It is seen from equation (3.6.14) that the count value “Nbs” and the resistance value “Rt” are almost proportional each
other.
3 Advantages of this method
As the resistance value and the count value are almost proportional each other, it is easy to make a linear
approximation.
No division is necessary as the resistance is obtained from the count value “Nbs”.
4 Disadvantages of this method
The frequency time in counter B reference mode (Tb) is changeable according to the resistance value “Rt”. So
necessary oscillation time to measure fluctuating.
23
ML610Q400 Series
Sample Program AP Notes
Resistance Mesurement Method 4:
Time (Ta) until there are the constant number (Nars) of oscillation in counter B
reference mode is measured. Next, the number of oscillations (Nart) within a
constant time (Ta = Tb) for Rt–Cs is measured.
1 Formulas
N art can be obtained as follows:
Counter B reference mode
Tb = Nbrs / frs = Nbs / 32768 ...... (from equation 3.6.2)
Counter A reference mode
Ta = Nas / 32768 = Nart / frt ...... (from equation 3.6.1)
From the above equations, it follows
Nbs = Nbrs / frs × 32768 ...... (equation 3.6.15)
Nas = Nart / frt × 32768 ...... (equation 3.6.16)
Substituting Nas = Nbs into equations (3.6.15) and (3.6.16)
Nas = Nbs = Nbrs / frs × 32768 = Nart / frt × 32768 ...... (equation 3.6.17)
Equation (3.6.17) can be changed as
Nart = Nbrs × frt / frs ...... (equation 3.6.18)
where Nas which determines oscillation time Ta is a constant.
Resistance Rt
Frequency
2 Necessary characteristic diagrams
If is necessary to measure resistance–frequency characteristics) to calculate N art–resistance characteristics .
In the program, resistance is obtained from the Nart–resistance characteristics.
Rt−Cs oscillation (frt)
Rs−Cs oscillation (frs)
frs=frt
Nbrs×frt/frs
Rs
Rt=Rs
Nart=Nbrs
Resistance Rt
Figure 3-12 Measurement of Resistance–
Frequency Characteristics
Nart
Figure 3-13 Calculation of Nart–
Resistance Characteristics
Equation (3.6.4) is substituted in equation (3.6.18) as
Nart = Nbrs × (1 / krt × Rt × Cs) / frs
= K / (krt × Rt) ...... (Equation 3.6.19)
where K = Nbrs / (frs × Cs)
It is seen from equation (3.6.19) that count value Nart and the resistance value Rt are almost inversely proportional to
each other.
3 Advantages of this method
As resistance is obtained from the count value Nart, division is not necessary.
As reference resistance Rs is constant, oscillation frequency frs becomes almost constant.
Consequently, as Ta and Tb are not so changeable, oscillation time necessary for the measurement is close to a
constant.
4 Disadvantages of this method
The resistance value and the count value are inversely proportional to each other, making a linear approximation more
complex.
24
ML610Q400 Series
Sample Program AP Notes
3.2.1.
Function Overview
The RC-ADC control module performs initialization, RC-ADC counter setting, starting/stopping of RC-ADC
conversion, and acquisition of conversion results.
Tables 3-4 and 3-5 list the RC-ADC control module APIs and temperature calculation module APIs, respectively.
Table 3-4 List of RC-ADC Control Module APIs
Function name
rcAdc_init function
rcAdc_setCounter function
rcAdc_execute function
rcAdc_getResult function
Description
Specifies the oscillation mode of the RC-ADC and set the reference clock.
Sets the count value in the counter of the RC-ADC.
Start/stop RC-ADC conversion.
Acquires the RC-ADC conversion results (24 bits) from the specified counter.
Table 3-5 Temperature Calculation Module APIs
Function name
temp_calc function
Description
Calculates temperature based on the RC-ADC count value.
* For details of the APIs, see the “ML610Q400 Series Sample Program API Manual.”
25
ML610Q400 Series
Sample Program AP Notes
3.2.2.
Operating Conditions
This section describes the operating conditions and valid range of this module. It also describes the restrictions on this
module.
RC-ADC control module
¾ Oscillation mode
8 types
— IN0 pin external clock input / RS0-CS0 oscillation / RT0-CS0 oscillation / RT0-1-CS0 oscillation / RS0-CT0
oscillation
— RS1-CS1 oscillation / RT1-CS1 oscillation / IN1 pin external clock
¾ Counter A reference clock
6 types
— LSCLK / LSCLK × 2 / HSCLK / 1/2 HSCLK / 1/4 HSCLK / 1/8 HSCLK
¾ A/D conversion time
Depends on the oscillation frequency at the time of measurement by counter A +
counter B and the values measured
¾ A/D resolution 24 bits (0x00000000 to 0x00FFFFFF)
¾ Conversion method
2 types
— Counter A reference mode: Digital values are proportional to the RC oscillation frequency.
— Counter B reference mode: Digital values are inversely proportional to the RC oscillation frequency.
¾ Counter A (RADCA0–2) is a 24-bit binary counter for counting the reference clock (BSCLK) used to generate the
time reference. It allows counting up to a maximum of 0FFFFFFH.
¾ Counter B (RADCB0–2) is a 24-bit binary counter for counting the oscillator clock (RCCLK) of the RC
oscillation circuit. It allows counting up to a maximum of 0FFFFFFH.
Notes:
It is recommended to put the MCU into a HALT state during RC-ADC conversion.
For A/D conversion accuracy and AC characteristics, refer to the chapter “Electrical Characteristics” of the User’s
Manual for your target MCU.
26
ML610Q400 Series
Sample Program AP Notes
3.2.3.
Sample of Use
The subsection below shows the A/D conversion procedure that uses the RC-ADC control module.
3.2.3.1. A/D Conversion Procedure
Shown below is the procedure from initialization to obtaining A/D conversion results using the RC-ADC control
module.
Main Routine
1)
Initialize RC-ADC control module
rcAdc_init function
2)
Set RC-ADC counter
rcAdc_setCounter function
3)
Start RC-ADC conversion
rcAdc_execute function
RC-ADC Interrupt (RADINT)
4)
HALT
1)
5)
RC-ADC conversion completion
processing
Obtain RC-ADC conversion
results
rcAdc_getResult function
Figure 3-14 RC-ADC Control Module Conversion Procedure
27
ML610Q400 Series
Sample Program AP Notes
[Main Routine]
1) Initialize the RC-ADC control module.
¾ Set the following conversion conditions in the rcAdc_init function and initialize the RC-ADC control module.
1 Set the oscillation mode of the RC oscillation circuit.
2 Set the reference clock (BSCLK) for counter A
2) Set the RC-ADC counter.
¾ Specify counter No. of the counter in which a count value is to be set in the designated parameter of the
rcAdc_setCounter function and set a count value.
3) Start RC-ADC conversion.
¾ Specify conversion start in the designated parameter of the rcAdc_execute function and start the operation of
the RC-ADC.
4) HALT [Wait for RC-ADC conversion completion.]
5) Acquire RC-ADC conversion results.
¾ Specify the counter No. of the counter whose count value is to be acquired in the designated parameter of the
rcAdc_getResult function and acquire the RC-ADC conversion results. Because of specification of counter No.,
only the conversion results for one counter can be acquired.
[RC-ADC Interrupt (RADINT)]
1) RC-ADC conversion completion processing
¾ The RC-ADC interrupt sets the flag that indicates conversion completion.
28
ML610Q400 Series
Sample Program AP Notes
3.3.
Temperature Calculation Module
A thermistor is used as a temperature sensor and temperatures are measured from the resistance value of the thermistor.
Resistance Mesurement Method 3 is used to measure the resistance values. However, resistance values are not
obtained from the count values but they are converted to ambient temperatures.
First, the measured temperature range, the desired resolution, and the measured state need to be determined. They
must be determined by taking the functions and specification of the product that uses the MCU into account. When
there are determined, the value of thermistor Rt, connected to the microcomputer, the reference resistor Rs, the
reference capacitor Cs, and the input protection resistor Ri, must be determined. Select a thermistor by taking its
characteristics and the used environments into account. Choose a resistor of 10 kΩ as Ri.
Use the resistance value of Rt as Rs at the temperature where the most accuracy is needed.
A capacitance of 700 pF or more is recommended as Cs.
Select Rt, Rs and Cs so that the oscillation frequencies within the measured temperature range can be measured within
the specification of the A/D converter of the MCU. For instance, the following setting is acceptable:
If VDD = 3 V and Cs = 820 pF, Rt must be 1 kΩ or more.
If VDD = 1.5 V and Cs = 820 pF, Rt must be 2 kΩ or more.
Next, the counted value first (Nbrs) must be determined.
Nbrs depends on the temperature measure time Ta and Tb and the minimum resolution of temperature measurement.
The larger Nbrs, the finer the temperature resolution. The smaller Nbrs, the shorter the oscillation time (= measured
time).
The resolution is equivalent to the temperature change per 1 count. Consequently, the longer the oscillation time, the
better the resolution. However, make sure that the B counter in A counter reference mode or the A counter in B
counter reference mode does not overflow by excessively long oscillation time.
The above items need to be modified when making a temperature conversion table which will be discussed next.
29
ML610Q400 Series
Sample Program AP Notes
A table for count value–temperature conversion needs to be made now.
Let the thermistor resistance be Rt and thermistor temperature be T. The characteristics of T and Rt are determined by
the thermistor.
Measure the “resistance Rt–count value Nart” characteristics under the same environments where a product of the MCU
is used since the oscillation frequency varies depending on IC’s ambient temperatures and wiring capacitance of the
oscillation elements.
The “temperature T–count value Nart” characteristics can be obtained from the above characteristics and the T–Rt
characteristics of the thermistor.
Resistance Rt
Resistance Rt
Rt−Nart characteristics
r1
Rt−T characteristics
(Thermistor characteristics)
r1
r2
r2
r3
r3
n1 n2
n3
t1
Nart
t2
t3
Temperature T
Temperature T
T−Nart characteristics
t3
t2
t1
n1 n2
n3
Nart
Figure 3-15 How to Make T–Nart Characteristics
From the T–Rt characteristics, r1 for temperature t1 is obtained. Next, from the Rt–Nart characteristics, the count
value n1 for r1 is obtained. Similarly, n2 and n3 for t2 and t3, respectively, can be obtained.
The temperature (T)–Count value (Nart) characteristics can be then obtained using the above information.
30
ML610Q400 Series
Sample Program AP Notes
The T–N art characteristics are converted to multiple linear approximation formulas and are stored in the program.
The approximation formula can be made by considering the following:
1
The maximum error between the linear approximation and the actual characteristics must be smaller than the
desired accuracy.
2
The slope of the linear approximation must be less than the desired maximum resolution of temperatures.
3
The linear approximation must be stored within the program area.
The following are examples of linear approximation.
T−N2 characteristics
Temperature T
Temperature T
T−Nart characteristics
t5
t4
t3
t5
t4
t3
t2
t2
t1
t1
T=a45×Nart+b45
T=a34×Nart+b34
n1 n2
n3
n4
n5
T=a23×Nart+b23
This portion
magnified.
n1 n2
n3
n4 e
T=a12×Nart+b12
n5
Nart
Nart
The T–N art characteristics are divided into several intervals (4 portions in this example).
Draw a straight line in each interval as a linear approximation. Linear approximations can be expressed by the
following:
Here, the maximum error between the linear approximation and actual characteristics is “e”.
If “e” is larger than the maximum error for measuring temperatures, it is necessary to make a finer portion and redo the
approximation procedure.
When the value “a” in the approximate formula is large than the desired resolution, change the partition interval
because “a” is the temperature change for 1 count change of Nart. If the value, “a”, is still larger than the desired
resolution even after this change of partition, raise the oscillation temperature to increase Nart or change the parameters
to lengthen the oscillation time.
When all the program ROM areas are exhausted because there are too many approximate formulas, reduce the number
of approximate formulas by sacrificing accuracy.
The approximate formulas can be input as the ROM table data. The ROM table data are composed of the following
two items:
Range of count number Nart
Constants a and b
Determine data length (= number of places) for the desired operation accuracy.
31
ML610Q400 Series
Sample Program AP Notes
3.3.1.
Function Overview
The temperature calculation module calculates temperatures from the RC-ADC conversion results based on the
frequency ratio–temperature conversion table for thermistor 103AT. Temperature errors caused by voltage fluctuation
in LSI can be reduced by obtaining the battery level (Vdd) by the BLD control module and then by using the
temperature calculation table applicable to that voltage(*). When changing the thermistor, tailor the temperature
calculation table to the thermistor to be used.
(*)In the sample program, only the table that supports the case that the battery level (Vdd) is more than or equal to 2.9
V is implemented.
Table 3-6 Temperature Calculation Module APIs
Function name
temp_calc function
Description
Calculates temperature from the RC-ADC count value.
* For details of the APIs, see the “ML610Q400 Series Sample Program API Manual.”
3.3.2.
Operating Conditions
This section describes the operating conditions and valid range of this module. It also describes the restrictions on this
module.
¾
Temperature measurement range and accuracy: −30 to +65°C (±1°C)
−50 to -31°C and +66 to +105°C (±2°C)
The temperature calculation table is shown below.
Table 3-7 Setting Values for Temperature Calculation Table
Offset of BaseCnt = 600000
2.9V ≤ Vdd
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Member variable setting value
BaseCnt
divStep
offset
222857
384000
472228
521977
550891
568251
578902
585611
589928
592769
594674
595977
596882
597522
597981
598316
598562
163
297
527
907
1510
2461
3908
6073
9227
13760
20121
28962
40960
57059
78312
106439
−
-504
-404
-304
-203
-103
-3
97
197
297
398
498
598
698
798
898
998
−
Temperature range
−50.0 ≤ x < −40.0
−40.0 ≤ x < −30.0
−30.0 ≤ x < −20.0
−20.0 ≤ x < −10.0
−10.0 ≤ x < 0.0
0.0 ≤ x < 10.0
10.0 ≤ x < 20.0
20.0 ≤ x < 30.0
30.0 ≤ x < 40.0
40.0 ≤ x < 50.0
50.0 ≤ x < 60.0
60.0 ≤ x < 70.0
70.0 ≤ x < 80.0
80.0 ≤ x < 90.0
90.0 ≤ x < 100.0
100.0 ≤ x < 105.0
X=<105.0
* The means of the member variable of the table is as follows.
BaseCnt:
Divided point for the apporoximate fomula of T-Nart characteristic
divStep:
Slope of the apporoximate fomula
offset:
Offset of the apporoximate fomula
In Figure 3-15, the horizontal axis means Nart.
But the value of Nart is too small to keep the precision of calcuration.
Therefore, Nart is converted as BaseCnt by the following expression.
BaseCnt = (Offset of BaseCnt) - (1 / Nart)
32
ML610Q400 Series
Sample Program AP Notes
3.3.3.
Sample of Use
The figure below shows the temperature obtaining procedure that uses the temperature calculation module.
Main Routine
1)
Obtain the oscillation count value of the reference
resistor RS0-CS0
(For the procedure see 3.2.3.1, “A/D Conversion
Procedure”)
2)
Obtain the oscillation count value of the reference
sensor RT0-CS0
(For the procedure see 3.2.3.1, “A/D Conversion
Procedure”)
3)
Obtain the difference from the reference value
Calculate temperature
temp_calc function
4)
Figure 3-16 Temperature Obtaining Procedure
33
ML610Q400 Series
Sample Program AP Notes
[Main Routine]
1) Obtain the oscillation count value of the reference resistor RS0-CS0
¾ Obtain the oscillation count value (count value of counter B) of the reference resistor RS-CS according to the
procedure shown in Section 3.2.3.1, “A/D Conversion Procedure”.
1 Oscillation mode of the RC oscillator circuit: RS–CS oscillation mode
2 Reference clock of counter A (BSCLK): LSCLK
3 Counter A setting value: Oscillation count value of the reference resistor RS-CS
4 Counter B setting value: 0
2) Obtain the oscillation count value of the reference sensor RT0-CS0
¾ Obtain the oscillation count value (count value of counter A) of the reference resistor RT-CS according to the
procedure shown in Section 3.2.3.1, “A/D Conversion Procedure”.
1 Oscillation mode of the RC oscillator circuit: RT–CS oscillation mode
2 Reference clock of counter A (BSCLK): LSCLK
3 Counter A setting value: 0
4 Counter B setting value: Value obtained in step 1) “Obtain the oscillation count value of the reference resistor
RS0-CS0” above
3) Obtain the difference from the reference value
¾ Using the following equation, calculate the count value that is to be the object of calculation.
1 Count value = (sensor RT–CS oscillation count reference value) − (sensor RT–CS oscillation count value)
4) Calculate temperature
¾ Using the temp_cal function, calculate a temperature value by use of the obtained count value and the
temperature calculation table.
34
ML610Q400 Series
Sample Program AP Notes
3.4.
UART Communication Control Module
This MCU has a 1-channel universal asynchronous receiver transmitter (UART). The UART communication control
module can be used for half-duplexed communication with external equipment.
P02/RXD0
P42/RXD0
P43/TXD0
Shift Register
LSCLK
LSCLK×2
HSCLK
UART
Controller
Baud Rate
Generator
UA0BRTH, L
UA0CON
UA0MOD0, 1
UA0BUF
UA0INT
UA0STAT
Data bus
UA0BUF
UA0BRTH, L
UA0CON
UA0MOD0, 1
UA0STAT
: UART0 transmit/receive buffer
: UART0 baud rate registers H and L
: UART0 control register
: UART0 mode registers 0 and 1
: UART0 status register
Figure 3-17 Configuration of UART
Table 3-8 List of Pins
Pin name
P02/RXD0
P42/RXD0
P43/TXD0
I/O
I
I
O
Description
UART0 data input pin. Used as the secondary function of the P02 pin.
UART0 data input pin. Used as the secondary function of the P42 pin.
UART0 data output pin. Used as the secondary function of the P43 pin.
* For details, refer to the chapter “UART” of the User’s Manual for your target MCU.
35
ML610Q400 Series
Sample Program AP Notes
3.4.1.
Function Overview
The UART communication control module controls the universal asynchronous receiver transmitter (UART) of the
MCU.
Table 3-9 lists the UART communication control module APIs used in the sample program.
Table 3-9 List of APIs
Function name
uart_init function
uart_startSend function
uart_startReceive function
uart_continue function
uart_stop function
uart_getTransSize function
Description
Selects the clock to be input to the baud rate generator. Also sets the
communication mode and baud rate.
Executes data transmission start processing.
Executes data reception start processing.
Executes data transmission/reception continuation processing.
Executes data transmission/reception stop processing.
Confirms the size of transmitted/received data.
* For details of the APIs, see the “ML610Q400 Series Sample Program API Manual.”
3.4.2.
Operating Conditions
This section describes the operating conditions and valid range of this module. It also describes the restrictions on this
module.
Baud rate clock
3 types (HS/LS/2× LS)
Input port (RXD)
2 types (P02/P42)
Baud rate
Communication data length
Parity bit
Stop bit
Signal logic
Bit output direction
Error flag
Status flag
7 types (2400 to 115200 bps)
4 types (5/6/7/8)
3 types (even/odd/no parity)
2 types (1/2)
2 types (positive logic/negative logic)
2 types (LSB/MSB first)
3 types (parity error, overrun error, framing error)
1 type (transmit/receive buffer status)
Notes:
The sample program has the following default settings: Data length = 8 bits, no parity bit, 1 stop bit, positive logic,
LSB first
HS can be selected for the baud rate clock only in cases where high-speed clock oscillation is enabled.
The respective secondary functions of TXD and RXD must be set.
Full-duplex communication (receiving during transmission or vice versa) is not available. Only half-duplex
communication is possible.
For AC characteristics, refer to the chapter “Electrical Characteristics” of the User’s Manual for your target MCU.
36
ML610Q400 Series
Sample Program AP Notes
3.4.3.
Sample of Use
The following subsections describe the procedure for performing data transmission/reception using the UART
communication control module.
3.4.3.1. Transmission Procedure
Shown below is the procedure for performing data transmission using the UART communication control module.
Figure 3-18 UART Communication Control Module Transmission Procedure
37
ML610Q400 Series
Sample Program AP Notes
[Main Routine]
1) Set HSCLK.
¾ If HSCLK is selected as the clock to be input to the baud rate generator, it is necessary to set the settings for
HSCLK before UART communication control module initialization.
2) Initialize the UART communication control module.
¾ Set the following communication conditions in the uart_init function and initialize the UART communication
control module:
1
Select the clock to be input to the baud rate
generator.
3 types (HS/LS/LS×2)
2
Select the communication data bit length.
4 types (5/6/7/8 bits)
3
Select parity bit. 3 types (Even/Odd/No
parity)
4
Select the stop bit length.
2 types (1 or 2
stop bits)
5
Select the signal negative logic.
2
types (Positive logic/Negative logic)
6
Select the bit output direction.
2
types (LSB first/MSB first)
3) Start N-byte transmission.
¾ Specify the following transmit data information in the designated parameters of the uart_startSend function and
start transmission .
1
Initial address of the area that contains
transmit data
2
Transmit data size (in bytes)
3
Processing to be executed upon completion
of transmission of N bytes of data (callback function specified)
4) Terminate transmission.
¾ Terminate transmission using the uart_stop function. Transmission can be terminated whether in the middle of
N-byte transmission or after N-byte transmission completion.
5) Acquire the size of transmitted data.
¾ Using the uart_getTransSize function, obtain the size of the data that has been transmitted since the
transmission started by the uart_startSend function. Use this function even when obtaining the size of
transmitted data in cases where transmission was terminated in the middle of N-byte transmission.
[UART Interrupt (UA0INT)]
1)
Continue N-byte data transmission
¾ Transmits data byte by byte each time the uart_continue function is executed based on the communication data
information specified in step 3) above, “Start N-byte transmission,” by the uart_startSend function. When 1 byte
of data is transmitted, the UART interrupt occurs again at the time of transmission termination of that 1-byte
data. This will continue N-byte data transmission.
¾ When N-byte data transmission is completed, the “Processing to be executed upon completion of transmission of
N bytes of data (callback function)” specified in “Start N-byte transmission” (uart_startSend function) above, is
executed.
38
ML610Q400 Series
Sample Program AP Notes
3.4.3.2. Reception Procedure
Shown below is the procedure for performing data reception using the UART communication control module.
Main Routine
When HSCLK is selected as the clock to be
input to the baud rate generator
1)
Set HSCLK
2)
Initialize UART control module
uart_init function
3)
Start N-byte reception
uart_startReceive function
UART Interrupt (UA0INT)
Continue N-byte reception
uart_continue function
Upon completion of N-byte reception
1)
4)
Terminate reception
uart_stop function
5)
Acquire the size of received data
uart_getTransSize function
Processing upon
completion of N-byte
reception
(callback function)
Figure 3-19 UART Communication Control Module Reception Procedure
39
ML610Q400 Series
Sample Program AP Notes
[Main Routine]
1) Set HSCLK.
¾ If HSCLK is selected as the clock to be input to the baud rate generator, it is necessary to set the settings for
HSCLK before UART communication control module initialization.
2) Initialize the UART communication control module.
¾ Set the following communication conditions in the uart_init function and initialize the UART communication
control module:
1
Select the clock to be input to the baud rate
generator.
3 types (HS/LS/LS×2)
2
Select the communication data bit length.
4 types (5/6/7/8 bits)
3
Select parity bit. 3 types (Even/Odd/No
parity)
4
Select the stop bit length.
2 types (1 or 2
stop bits)
5
Select the signal negative logic.
2
types (Positive logic/Negative logic)
6
Select the bit output direction.
2
types (LSB first/MSB first)
3) Start N-byte reception.
¾ Specify the following receive data information in the uart_startSend function and start reception.
1
Initial address of the area that contains
receive data
2
Receive data size (in bytes)
3
Processing to be executed upon completion
of reception of N bytes of data (callback function specified)
4) Terminate reception.
¾ Terminate reception using the uart_stop function. Reception can be terminated whether in the middle of N-byte
reception or after N-byte reception completion.
5) Acquire the size of received data.
¾ Using the uart_getTransSize function, obtain the size of the data that has been received since the reception
started by the uart_startReceive function. Use this function even when obtaining the size of received data in
cases where reception was terminated in the middle of N-byte reception.
[UART Interrupt (UA0INT)]
1) Continue N-byte data reception
¾ Receives data byte by byte each time the uart_continue function is executed based on the communication data
information specified in step 3) above, “Start N-byte reception,” by the uart_startReceive function.
¾ When N-byte data reception is completed, the “Processing to be executed upon completion of reception of N
bytes of data (callback function)” specified in “Start N-byte reception” (uart_startReceive function)above, is
executed.
40
ML610Q400 Series
Sample Program AP Notes
3.5.
UART Baud Rate Correction Module
When A high-speed clock frequency is known to fluctuate at about ±25% depending on the temperature change in cases
where the high-speed clock of the ML610Q431 is operating in RC oscillation mode. Also note that for the baud rate of
UART, a communication error occurs if the baud rate clock frequency fluctuates exceeding ±2%. In other words,
UART communication is expected to stop if there is a change in the ambient temperature.
This module, which uses 128 Hz based on the low-speed 32 kHz crystal oscillation clock as the reference, is designed
to measure a high-speed clock frequency and then corrects the UART baud rate timer value based on that measured
clock frequency so as to continue making UART communication.
3.5.1.
Function Overview
This module is designed to measure a high-speed clock frequency and then corrects the UART baud rate timer value
based on the measurement result so as to continue making UART communication. Depending on the type of the timer
built into the MCU, the module has two measurement methods: high-speed clock frequency measurement by software
and high-speed clock frequency measurement by hardware.
3.5.2.
High-Speed Clock Frequency Measurement by Software
If “0000” is read from T2FMA[7:4], the module performs high-speed clock frequency measurement by software.
Using 128 Hz based on the low-speed 32 kHz crystal oscillation clock as the reference, the module measures a
high-speed clock frequency and then corrects the UART baud rate timer value based on that measured clock frequency.
128Hz
128Hz
Timers 2 & 3
Operates by
high-speed clock
Value A
Value B
Measures a high-speed clock frequency using the timers for the period between the set 128Hz interrupts.
High-speed clock frequency (Hz) = Value of timers 2 and 3 (value B − value A) × 128
Obtains the frequency ratio of the high-speed clock frequency to 9600bps (Hz).
(Uses the relationship that 437 times 32768Hz is equivalent to the time period for 128 bits at 9600bps.)
Frequency ratio = high-speed clock frequency × 437 ÷ 32768 ÷ 128 (Rount the least significant digit of the
obtained frequency ratio)
Set the baud rate timer so that it will overflowby the value of the frequency ratio, and the processing by the
module will complete.
Baud rate timer = frequency ratio − 1
3.5.3.
High-Speed Clock Frequency Measurement by Hardware
If “1010” is read from T2FMA[7:4], the module performs high-speed clock frequency measurement by hardware.
It corrects UART baud rate time values by measuring a high-speed clock frequency using the frequency measurement
function of timer 2 and by setting a UART baud rate timer value from the obtained clock frequency.
Baud rate timer = frequency ratio − 1
3.5.3.1. Function Overview
Activates timer 2 in frequency measurement mode and then measures a high-speed clock frequency.
41
ML610Q400 Series
Sample Program AP Notes
The detailed procedure follows the procedure described in the User’s Manual for your target MCU, Section
“Frequency Measurement Mode” in Chapter “Timer.”
42
ML610Q400 Series
Sample Program AP Notes
Table 3-10 lists the UART baud rate correction module APIs.
Table 3-10 List of APIs
Function name
adjustBaudrate_startCount function
adjustBaudrate_checkFin function
adjustBaudrate_getCount function
adjustBaudrate_setBRT function
adjustBaudrate_intCount function
adjustBaudrate_intCountTM3 function
Description
Starts baud rate correction counter operation.
Checks whether the baud rate correction counter operation is complete.
Obtains the count value of the baud rate correction counter.
Sets the baud rate register.
Performs 128Hz interrupt processing for baud rate correction. Used in
cases where the timer has no frequency measurement function and
measurement with a high-speed clock is performed by software. (For
ML610Q431/Q432)
Performs timer 3 interrupt processing for baud rate correction. Used in
cases where the timer has a frequency measurement function and
measurement with a high-speed clock is performed by hardware. (For
ML610Q411/Q412/Q415)
* For details of the APIs, see the “ML610Q400 Series Sample Program API Manual.”
3.5.4.
Operating Conditions
The operating conditions and restrictions of the baud rate correction module are as follows:
Timers 2 and 3 are used as 16-bit timer counters.
Since HTBCLK divided by 1 is used as the operating clock for Timers 2 and 3, the high-speed side time-base counter
divide register (HTBDR) must be set to 0x0F before using the module.
Since 128Hz is used for 16-bit timer count value read timing, the interrupt vector setting must be so configured that
the specified function (adjustBaudrate_intCount function) will be executed upon execution of a 128Hz interrupt
before using the module.
Note:
In the case of high-speed clock frequency measurement by hardware, frequency is measured not using the 128Hz
interrupt, but using the frequency measurement mode for Timers 2 and 3.
43
ML610Q400 Series
Sample Program AP Notes
3.5.5.
Sample of Use
The subsection below gives an example of a procedure for setting baud rate settings for the UART by use of the baud
rate correction module.
3.5.5.1. Baud Rate Correction Procedure (when 16-bit frequency measurement mode not used)
Shown below is the procedure for setting baud rate settings for the UART by use of the UART baud rate correction
module.
Main Routine
1)
Set divide ratio of HTBCLK to 1/1
128Hz Interrupt (T128HINT) Handler
_intT128HINT function
2)
Start baud rate correction counter operation
adjustBaudrate_startCount function
1)
Baud rate correction counter interrupt
processing
adjustBaudrate_intCount function
Being corrected
Check baud rate correction counter operation
adjustBaudrate_checkCountFin function
3)
Correction finished
4)
Obtain count value of baud rate correction
counter
adjustBaudrate_getCount function
5)
Set baud rate register
adjustBaudrate_setBRT function
Figure 3-20 Baud Rate Correction Procedure (when 16-bit frequency measurement mode not used)
44
ML610Q400 Series
Sample Program AP Notes
[Main Routine]
1) Set the divide ratio of HTBCLK to 1/1.
2) Start the operation of the baud rate correction counter
¾ Start the operation of the baud rate correction counter using the adjustBaudrate_startCount function. Set
settings for Timers 2 and 3 and enable the 128Hz interrupt within this function.
3) Check the operation of the baud rate correction counter
¾ Check whether the baud rate correction counter operation has been terminated using the
adjustBaudrate_checkCountFin function. If it has not been terminated yet, call the
adjustBaudrate_checkCountFin function periodically.
4) Obtain the count value of the baud rate correction counter
¾ Obtain the count value of the baud rate correction counter using the adjustBaudrate_getCount function.
5) Set the baud rate register
¾ Using the adjustBaudrate_setBRT function, set the specified baud rate value. Also calculate the setting values
of the baud rate registers UA0BRTL,H from the count values obtained in step 4) and set them.
[128Hz interrupt (T128HINT) handler]
Periodic interrupt processing for baud rate correction
¾ Within the 128Hz interrupt handler, or the _intT128INT function, the 128Hz interrupt handler executes the
adjustBaudrate_intCount function to obtain the count value of timers 2 and 3. It obtains the difference
between the count values from the 128Hz interrupt occurred two times. Then, it calculates a count value tailored
to the 437C timer count value and retains it.
45
ML610Q400 Series
Sample Program AP Notes
3.5.5.2. Baud Rate Correction Procedure (when 16-bit frequency measurement mode used)
Shown below is the procedure for setting baud rate settings for the UART by use of the UART baud rate correction
module.
Main Routine
1)
Set divide ratio of HTBCLK to 1/1
Timer 3 Interrupt (TM3INT) Handler
_intTM3INT function
2)
Start baud rate correction counter operation
adjustBaudrate_startCount function
1)
Baud rate correction counter interrupt
processing
adjustBaudrate_intCountTM3 function
Being corrected
Check baud rate correction counter operation
adjustBaudrate_checkCountFin function
3)
Correction finished
4)
Obtain count value of baud rate correction
counter
adjustBaudrate_getCount function
5)
Set baud rate register
adjustBaudrate_setBRT function
Figure 3-21 Baud Rate Correction Procedure (when 16-bit frequency measurement mode used)
46
ML610Q400 Series
Sample Program AP Notes
[Main Routine]
1) Set the divide ratio of HTBCLK to 1/1.
2) Start the operation of the baud rate correction counter
¾ Start the operation of the baud rate correction counter using the adjustBaudrate_startCount function. Set
settings for Timers 2 and 3 and enable the timer3 interrupt within this function.
3) Check the operation of the baud rate correction counter
¾ Check whether the baud rate correction counter operation has been terminated using the
adjustBaudrate_checkCountFin function. If it has not been terminated yet, call the
adjustBaudrate_checkCountFin function periodically.
4) Obtain the count value of the baud rate correction counter
¾ Obtain the count value of the baud rate correction counter using the adjustBaudrate_getCount function.
5) Set the baud rate register
¾ Using the adjustBaudrate_setBRT function, set the specified baud rate value. Also calculate the setting values
of the baud rate registers UA0BRTL,H from the count values obtained in step 4) and set them.
[Timer3 interrupt (TM3INT) handler]
1) Baud rate correction complete interrupt processing
¾ Within the timer3 interrupt handler, or the _intT3INT function, this handler executes the
adjustBaudrate_intCountTM3 function to obtain the count value of timers 2 and 3. It retains the values as the
437C timer count values.
47
ML610Q400 Series
Sample Program AP Notes
3.6.
I2C Communication Control Module
This MCU incorporates a 1-channel I2C bus interface (master).
I2C0RD, I2C0STAT
Clock
Generator
HSCLK
I2C0MOD
Shift Register
I2C0SA
I2C0TD
SCL
SDA
Controller
P41/SCL
I2C
Controller
I2C0INT
P40/SD
I2C0CON
Data bus
I2C0RD
I2C0SA
I2C0TD
I2C0CON
I2C0MOD
I2C0STAT
: I2C bus 0 receive register
: I2C bus 0 slave address register
: I2C bus 0 transmit data register
: I2C bus 0 control register
: I2C bus 0 mode register
: I2C bus 0 status register
Figure 3-22 I2C Bus Interface Configuration
Table 3-11 List of Pins
Pin name
P40/SDA
P41/SCL
I/O
I/O
I/O
Description
I2C bus interface data input/output pin. Used as the secondary function of the P40 pin.
I2C bus interface clock input/output pin. Used as the secondary function of the P41 pin.
* For details, refer to the chapter “I2C Bus Interface” of the User’s Manual for your target MCU.
48
ML610Q400 Series
Sample Program AP Notes
3.6.1.
Function Overview
The I2C communication control module controls the I2C bus interface (master) of the MCU.
Table 3-12 lists the I2C communication control module APIs that the sample program uses.
Table 3-12 List of APIs
Function name
i2c_init function
i2c_startSend function
i2c_startReceive function
i2c_continue function
i2c_stop function
i2c_getTransSize function
Description
Selects the communication speed and clock synchronization function.
Executes address and data transmission start processing.
Executes address and data reception start processing.
Executes address and data transmission/reception continuation processing.
Executes data transmission/reception stop processing.
Checks the size of the data transmitted/received.
* For details of the APIs, see the “ML610Q400 Series Sample Program API Manual.”
3.6.2.
Operating Conditions
This section describes the operating conditions and valid range of this module. It also describes the restrictions on this
module.
Communication speed
: 2 types (standard mode [100 kHz] / fast mode 1 [400 kHz])
Note:
The I2C bus interface can be used only when high-speed clock oscillation is enabled.
49
ML610Q400 Series
Sample Program AP Notes
3.6.3.
Sample of Use
The following subsections describe the transmission and reception procedures using the I2C communication control
module.
3.6.3.1. Transmission Procedure
Shown below is the procedure for performing data transmission using the I2C communication control module.
Figure 3-23 I2C Data Transmission Procedure
50
ML610Q400 Series
Sample Program AP Notes
[Main Routine]
1) Set HSCLK
¾ Since I2C uses HSCLK as a clock, it is necessary to set the settings for HSCLK before initializing the I2C
communication control module.
2) Initialize I2C communication control module
¾ Set the following communication conditions in the i2c_init function and initialize the I2C communication
control module:
1
Select standard mode or fast mode.
2
Set the clock frequency of HSCLK.
3
Select use or non-use of the clock
synchronization function.
3) Start N-byte transmission
¾ Specify the following transmit data information in the i2c_startSend function and start transmission.
1
Address of the transmission destination
slave device
2
Initial address of the area that contains the
write address of the device
3
Address size of the device (in bytes)
4
Initial address of the area that contains
transmit data
5
transmit data size (in bytes)
6
Processing to be executed upon completion
of transmission of N bytes of data (callback function specified)
4) Terminate transmission
¾ Terminate transmission using the i2c_stop function. Transmission can be terminated whether in the middle of
N-byte transmission or after N-byte transmission completion.
5) Acquire the size of transmitted data
¾ Using the i2c_getTransSize function, obtain the size of the data that has been transmitted since the transmission
started by the i2c_startSend function. Use this function even when obtaining the size of transmitted data in cases
where transmission was terminated in the middle of N-byte transmission.
[I2C Bus 0 Interrupt (I2C0INT)]
¾ Continue N-byte data transmission
The i2c_continue function transmits address byte by byte each time the i2c_continue function is executed,
based on the communication data information specified by “Start N-byte transmission” (i2c_startSend function)
in step 3 above. After the write address is transmitted, it transmits data. When 1 byte of data is transmitted, the
I2C interrupt occurs again at the time of transmission termination. This way, N-byte data transmission will
continue.
¾ When N-byte data transmission is completed (STOP condition transmitted), the “Processing to be executed upon
completion of transmission of N bytes of data (callback function)” specified by “Start N-byte transmission”
(i2c_startSend function) in step 3 above, is executed.
51
ML610Q400 Series
Sample Program AP Notes
3.6.3.2. Reception Procedure
Shown below is the procedure for performing data reception using the I2C communication control module.
Figure 3-24 I2C Data Reception Procedure
52
ML610Q400 Series
Sample Program AP Notes
[Main Routine]
1) Set HSCLK
¾ Since I2C uses HSCLK as a clock, it is necessary to set the settings for HSCLK before initializing the I2C
communication control module.
2) Initialize I2C communication control module
¾ Set the following communication conditions in the i2c_init function and initialize the I2C communication
control module:
1
Select standard mode or fast mode.
2
Set the clock frequency of HSCLK.
3
Select use or non-use of the clock
synchronization function.
3) Start N-byte reception
¾ Specify the following receive data information in the i2c_startReceive function and start reception.
1
Address of the transmission destination
slave device
2
Initial address of the area that contains the
read address of the device
3
Address size of the device (in bytes)
4
Initial address of the area that contains
receive data
5
Receive data size (in bytes)
6
Processing to be executed upon completion
of reception of N bytes of data (callback function specified)
4) Terminate reception
¾ Terminate reception using the i2c_stop function. Reception can be terminated whether in the middle of N-byte
reception or after N-byte reception completion.
5) Acquire the size of received data
¾ Using the i2c_getTransSize function, obtain the size of the data that has been received since the reception
started by the i2c_startReceive function. Use this function even when obtaining the size of received data in cases
where reception was terminated in the middle of N-byte reception.
[I2C Bus 0 Interrupt (I2C0INT)]
¾ Continue N-byte data transmission
Transmits address byte by byte each time the i2c_continue function is executed based on the communication
data information specified by “Start N-byte reception” (i2c_startReceive function) in step 3 above. After the read
address is transmitted, a RESTART condition is entered and data reception is performed.
¾ When N-byte data reception is completed, the “Processing to be executed upon completion of reception of N
bytes of data (callback function)” specified by “Start N-byte reception” (i2c_startReceive function) in step 3
above, is executed.
53
ML610Q400 Series
Sample Program AP Notes
3.7.
EEPROM Control Module
3.7.1.
Function Overview
The EEPROM control module writes/reads data to/from EEPROM using the I2C of the MCU. Using the module,
N-byte write, N-byte read, and write protection can be controlled.
Table 3-13 lists the EEPROM control module APIs.
Table 3-13 List of APIs
Function name
eeprom_init function
eeprom_read function
eeprom_write function
eeprom_continue function
eeprom_stop function
eeprom_getStatus function
eeprom_writeProtect function
Description
Enables EEPROM write-protect.
Starts reading data from EEPROM.
Starts writing data to EEPROM.
Continues data write or read processing.
Stops data write or read processing.
Acquires the EEPROM control module status.
Enables or disables EEPROM write-protect.
* For details of the APIs, see the “ML610Q400 Series Sample Program API Manual.”
3.7.2.
Operating Conditions
This section describes the operating conditions and valid range of this module. It also describes the restrictions on this
module.
This module performs read/write operations on EEPROM via I2C. For this reason, it is necessary to set the settings
for HSCLK (will be used by the clock of I2C) and I2C interrupt processing in advance.
The following EEPROM is supported by this module: BR24S256FJ-W manufactured by Rohm. One EEPROM
device can be connected.
At initialization, set the Port2 settings as shown in the table below.
Table 3-14 Port 2 Settings
Port
P20
Input/output mode
Output mode
Input/output status
CMOS output
54
Description
EEPROM write protect pin
ML610Q400 Series
Sample Program AP Notes
3.7.3.
Sample of Use
3.7.3.1. Write Procedure
The EEPROM write procedure is shown below.
Figure 3-25 EEPROM Write Procedure
55
ML610Q400 Series
Sample Program AP Notes
[Main Routine]
1) Set HSCLK
¾ Since I2C uses HSCLK as a clock, it is necessary to set the settings for HSCLK before initializing the EEPROM
control module.
2) Set I2C interrupt
¾ Set I2C interrupt processing in the interrupt vector of I2C. The i2c_continue function is called from there.
3) Initialize EEPROM control module
Perform the following initialization using the eeprom_init function:
¾ Set the settings for the P20 pin and enable write-protect.
¾ Initialize the control parameters of the EEPROM control module (put the module into an EEPROM read/write
stop state).
¾ Set the following communication conditions and initialize the I2C communication control module:
1
Select fast mode.
2
Set the clock frequency of HSCLK (=500
kHz).
3
Select non-use of the clock synchronization
function.
4) Release EEPROM write protect
¾ Using the eeprom_writeProtect function, release the write protect on EEPROM.
5) Start writing N-byte data
¾ Specify the following transmit data information in the eeprom_write function and start transmission.
1
Address at which EEPROM write is started
2
Initial address of the area that contains
transmit data
3
Transmit data size (in bytes)
6) Continue writing and judge the completion of writing
¾ The eeprom_continue function performs processing according to the current processing status:
1
Specify the callback function to be executed
upon completion of I2C transmission at the start of data writing, then start data transmission. If there is no data
remaining or an I2C error has occurred, the function completes the write processing.
2
While data is being written to EEPROM, the
function transmits the slave address in read mode in order to judge the completion of EEPROM write.
3
A returning of a normal end or abnormal end
for the execution results indicates completion of write processing.
[I2C Bus 0 Interrupt (I2C0INT)]
1) Continue transmission of I2C’s N-byte data
¾ The i2c_continue function continues transmission of I2C data. It calls the pre-registered callback function when
the transmission of all data is completed. It passes the size of the data already transmitted and error information
to the arguments of the callback function.
2) I2C callback processing by EEPROM control module
¾ Performs processing according to the current processing status:
If data is being transmitted, updates the control parameters (such as the size of remaining data and the pointer to
the data buffer) and starts EEPROM write. If an I2C error has occurred, stops the operation and sets the
execution results to Abnormal End.
¾ If data is being written to EEPROM and there is no I2C error occurred, starts data transmission. If an I2C error
has occurred, starts EEPROM write.
56
ML610Q400 Series
Sample Program AP Notes
3.7.3.2. Read Procedure
The EEPROM read procedure is shown below.
Main Routine
1)
Set HSCLK
2)
Set I2C interrupt
3)
Initialize EEPROM control
module
eeprom_init function
4)
Start reading N-byte data
eeprom_read function
I2C Bus 0 Interrupt (I2C0INT)
Continue N-byte reception
i2c_continue function
1)
Wait for completion of reading
5)
Upon completion of N-byte reception
Call pre-registered callback
function
I2C callback processing by EEPROM
control module
Continue reading and judge the
completion of reading
eeprom_continue function
2)
Upon completion of N-byte reception
EEPROM control module status
transition
Wait for completion of reading
Figure 3-26 EEPROM Read Procedure
57
ML610Q400 Series
Sample Program AP Notes
[Main Routine]
1) Set HSCLK
¾ Since I2C uses HSCLK as a clock, it is necessary to set the settings for HSCLK before initializing the I2C
communication control module.
2) Set I2C interrupt
¾ Set I2C interrupt processing in the interrupt vector of I2C. The i2c_continue function is called from there.
3) Initialize EEPROM control module
Perform the following initialization using the eeprom_init function:
¾ Set the settings for the P20 pin and enable write-protect.
¾ Initialize the control parameters of the EEPROM control module (put the module into an EEPROM read/write
stop state).
¾ Set the following communication conditions to initialize the I2C communication control module:
1
Select fast mode.
2
Set the clock frequency of HSCLK (=500
kHz).
3
Select non-use of the clock synchronization
function.
4) Start reading N-byte data
¾ Specify the following receive data information in the eeprom_read function and start reception.
1
Address at which EEPROM read is started
2
Initial address of the area that contains
receive data
3
Receive data size (in bytes)
5) Continue reading and judge the completion of reading
¾ The eeprom_continue function performs processing according to the current processing status:
1
The function starts data reception by data
read start (specify also the callback function to be executed upon completion of I2C reception).
2
A returning of a normal end or abnormal end
for the execution results indicates completion of read processing.
[I2C Bus 0 Interrupt (I2C0INT)]
1) Continue reception of I2C’s N-byte data
¾ The i2c_continue function continues reception of I2C data. It calls the pre-registered callback function when the
reception of all data is completed. It passes the size of the data already received and error information to the
arguments of the callback function.
2) I2C callback processing by EEPROM control module
Performs processing according to the current processing status:
¾ If data is being received, updates the control parameters (such as the size of remaining data and the pointer to the
data buffer) and stops operation and sets the execution results to Normal End. If an I2C error has occurred, stops
operation and sets the execution results to Abnormal End.
58
ML610Q400 Series
Sample Program AP Notes
3.8.
LCD Display Control Module
The MCU incorporates an LCD driver that displays the contents set in the display registers as images on the LCD.
COM0
COM15/23
SEG0
Common
drivers
VDD Bias generation circuit
SEG63
Segment
drivers
Regulated
power
supply
Cd
VL4
Cc
VL3
Cb
VL2
Ca
VL1
C34
C4
Display allocation
Voltage
multiplier
control circuit
C3
C2
C12
BIASCON
DSPCNT
C1
DSPMOD0
DSPMOD1
DSPCON
DSPR00 –
DSPRFE
DSmCnA
DSmCnB
VSS
Data bus
BIASCON
DSPCNT
DSPMOD0
DSPMOD1
DSPCON
DSmCnA
DSmCnB
DSPR00–DSPRFE
: Bias circuit control register
: Display contrast register
: Display mode register 0
: Display mode register 1
: Display control register
: Allocation registers A (m = 0 to 63, n = 0 to 7)
: Allocation registers B (m = 0 to 63, n = 0 to 7)
: Display registers
Figure 3-27 Configuration of LCD Drivers and Bias Generation Circuit
Table 3-15 List of Pins
Pin name
VL1–4
C1–4
COM0–23
SEG0–63
I/O
⎯
⎯
O
O
Description
Power supply pins for LCD bias (internally generated)
Capacitor connection pin for LCD bias generation
LCD common pins
LCD segment pins
* For details, refer to the chapter “LCD Driver” of the User’s Manual for your target MCU.
59
ML610Q400 Series
Sample Program AP Notes
3.8.1.
Function Overview
The LCD display control module allows the following to be controlled: Initialization (such settings as bias, duty, and
frame frequency), contrast setting, display mode setting, 7- or 16-seg display, and mark display.
Table 3-16 lists the LCD display control module APIs.
Table 3-16 List of APIs
Function name
lcd_init function
lcd_setContrast function
lcd_setLCDMode function
lcd_dispHour function
lcd_dispMin function
lcd_dispSec function
lcd_dispMain function
lcd_dispTemp function
lcd_dispMode function
lcd_clear function
Description
Initialization
Contrast value setting
LCD display mode setting
Displays hours
Displays minutes
Displays seconds
Displays the 12 digits on the lower part of the panel
Displays temperature
Displays mode
Clears the display on the LCD panel
* For details of the APIs, see the “ML610Q400 Series Sample Program API Manual.”
3.8.2.
Operating Conditions
This section describes the operating conditions and valid range of this module. It also describes the restrictions on this
module.
1/1 to 1/24 duty
1/3 and 1/4 bias (with the built-in bias generation circuit)
* Fixed to 1/3 bias for the ML610Q411/ML610Q412/ML610Q415
Frame frequency selectable (4 types)
Bias voltage multiplying clock selectable (8 types)
Contrast adjustment (32 steps)
Programmable display allocation function is only available at 1/1 to 1/8 duty
Notes:
The display processing of the LCD display control module is performed according to the LCD panel specifications
described in Section 3.8.4, “LCD Setting.” If the LCD panel has been changed, it is necessary to first modify the
initialization processing section and display processing section according to the LCD panel to be used and then
configure the initial settings tailored to the LCD panel to be used by using the lcd_init function first.
This sample program configures bias settings tailored to the specifications of the reference board used. For this
reason, 1/4 bias is used for the ML610Q431/ML610Q432 and 1/3 for the ML610Q411/ML610Q412/ML610Q415.
60
ML610Q400 Series
Sample Program AP Notes
3.8.3.
LCD Panel Specifications
The following LCD panel specifications are assumed to be used in this LCD display control module:
¾ 16-segment characters:
The 4 digits on the upper part of the panel
¾ 7-segment characters:
The 6 digits on the upper part of the panel
¾ 8-segment characters:
The 12 digits on the lower part of the panel
¾ Marks for hand-held calculator: 7.
Other marks: 32
[Operating Conditions]
¾ Clock for bias generation circuit voltage multiplication:
¾ Bias of the bias generation circuit:
¾ Duty:
¾ Frame frequency:
61
1/16 LSCLK (2 kHz)
1/4 (ML610Q431/Q432)
1/3 (ML610Q411/Q412/Q415)
1/4 duty
73 Hz
ML610Q400 Series
Sample Program AP Notes
3.8.4.
LCD Setting
3.8.4.1. Display Position ⇔ DSPR Address Correspondence Table (for the LCD driver with the display
allocation function)
The table below shows the correspondence between the display positions of the LCD panel and the display registers
(DSPR) of the MCU.
Display
1st digit of Mode (right)
2nd digit of Mode
3rd digit of Mode
4th digit of Mode (left)
Display
register
bit7
bit6
bit5
bit4
bit3
bit2
bit1
bit0
DSPR00
h
g
f
e
d
c
b
a
DSPR01
p
o
n
m
l
k
j
i
DSPR02
h
g
f
e
d
c
b
a
DSPR03
p
o
n
m
l
k
j
i
DSPR04
h
g
f
e
d
c
b
a
DSPR05
p
o
n
m
l
k
j
i
DSPR06
h
g
f
e
d
c
b
a
DSPR07
p
o
n
m
l
k
j
i
Ones digit of hours
DSPR08
g
f
e
d
c
b
a
Tens digit of hours
DSPR09
g
f
e
d
c
b
a
Ones digit of minutes
DSPR0A
g
f
e
d
c
b
a
Tens digit of minutes
DSPR0B
g
f
e
d
c
b
a
Ones digit of seconds
DSPR0C
g
f
e
d
c
b
a
Tens digit of seconds
DSPR0D
g
f
e
d
c
b
a
8-seg (1st digit on the lower part)
[Right]
DSPR0E
g
f
e
d
c
b
a
8-seg (2nd digit on the lower part)
DSPR0F
g
f
e
d
c
b
a
8-seg (3rd digit on the lower part)
DSPR10
g
f
e
d
c
b
a
8-seg (4th digit on the lower part)
DSPR11
g
f
e
d
c
b
a
8-seg (5th digit on the lower part)
DSPR12
g
f
e
d
c
b
a
8-seg (6th digit on the lower part)
DSPR13
g
f
e
d
c
b
a
8-seg (7th digit on the lower part)
DSPR14
g
f
e
d
c
b
a
8-seg (8th digit on the lower part)
DSPR15
g
f
e
d
c
b
a
8-seg (9th digit on the lower part)
DSPR16
g
f
e
d
c
b
a
8-seg (10th digit on the lower part)
DSPR17
g
f
e
d
c
b
a
8-seg (11th digit on the lower part)
DSPR18
g
f
e
d
c
b
a
8-seg (12th digit on the lower part)
[Left]
DSPR19
g
f
e
d
c
b
a
doF2
doC2
hpa
doF1
doC1
am
pm
c1
c2
col2
col1
Year
month
date
DSPR1A
%
DSPR1B
Mark
Dot
Mark
DSPR1C
DSPR1D
b4
b3
b2
b1
DSPR1E
÷
×
−
+
DSPR1F
18H
17H
16H
15H
DSPR20
T2
T1
M
K
E
14H
13H
12H
11H
22H
21H
20H
19H
DSPR21
Y9
Y10
Y11
Y12
Y13
Y14
Y15
Y16
DSPR22
Y1
Y2
Y3
Y4
Y5
Y6
Y7
Y8
62
ML610Q400 Series
Sample Program AP Notes
3.8.4.2. Segment Pattern Data Table for 8-Seg Display (for the LCD driver with the display allocation
function)
The figure below shows the 8-seg segment pattern used in the LCD display control module.
a
b
f
g
e
c h
d
Description
76543210
Character
Value
‘0’
0x3F
Segment pattern data for displaying an 8-seg “0”
0 0 1 1 1 1 1 1
‘1’
0x06
Segment pattern data for displaying an 8-seg “1”
0 0 0 0 0 1 1 0
‘2’
0x5B
Segment pattern data for displaying an 8-seg “2”
0 1 0 1 1 0 1 1
‘3’
0x4F
Segment pattern data for displaying an 8-seg “3”
0 1 0 0 1 1 1 1
‘4’
0x66
Segment pattern data for displaying an 8-seg “4”
0 1 1 0 0 1 1 0
‘5’
0x6D
Segment pattern data for displaying an 8-seg “5”
0 1 1 0 1 1 0 1
‘6’
0x7D
Segment pattern data for displaying an 8-seg “6”
0 1 1 1 1 1 0 1
‘7’
0x27
Segment pattern data for displaying an 8-seg “7”
0 0 1 0 0 1 1 1
‘8’
0x7F
Segment pattern data for displaying an 8-seg “8”
0 1 1 1 1 1 1 1
‘9’
0x6F
Segment pattern data for displaying an 8-seg “9”
0 1 1 0 1 1 1 1
Blank
0x00
Segment pattern data for displaying an 8-seg “blank”
0 0 0 0 0 0 0 0
‘-’
0x40
Segment pattern data for displaying an 8-seg “−“
0 1 0 0 0 0 0 0
A
0x77
Segment pattern data for displaying an 8-seg “A”
0 1 1 1 0 1 1 1
b
0x7c
Segment pattern data for displaying an 8-seg “b”
0 1 1 1 1 1 0 0
c
0x58
Segment pattern data for displaying an 8-seg “c”
0 1 0 1 1 0 0 0
d
0x5e
Segment pattern data for displaying an 8-seg “d”
0 1 0 1 1 1 1 0
E
0x79
Segment pattern data for displaying an 8-seg “E”
0 1 1 1 1 0 0 1
F
0x71
Segment pattern data for displaying an 8-seg “F”
0 1 1 1 0 0 0 1
63
hg f edcba
ML610Q400 Series
Sample Program AP Notes
3.8.4.3. Segment Pattern Data Table for 16-SEG Display (for the LCD driver with the display allocation
function)
The figure below shows the 16-seg segment pattern used in the LCD display control module.
a
h
j k l
i
g
b
c
m
p o n
f
Character
‘0’
‘1’
‘2’
‘3’
‘4’
‘5’
‘6’
‘7’
‘8’
‘9’
Blank
‘-’
A
B
C
D
d
e
Value
0xff
0x00
0x00
0x44
0x77
0x11
0x3f
0x11
0x8c
0x11
0xbb
0x11
0xfb
0x11
0x8f
0x00
0xff
0x11
0xbf
0x11
0x00
0x00
0x00
0x11
0xcf
0x11
0x3f
0x54
0xf3
0x00
0x3f
0x44
Description
Segment pattern data for displaying a 16-seg “0”
Segment pattern data for displaying a 16-seg “1”
Segment pattern data for displaying a 16-seg “2”
Segment pattern data for displaying a 16-seg “3”
Segment pattern data for displaying a 16-seg “4”
Segment pattern data for displaying a 16-seg “5”
Segment pattern data for displaying a 16-seg “6”
Segment pattern data for displaying a 16-seg “7”
Segment pattern data for displaying a 16-seg “8”
Segment pattern data for displaying a 16-seg “9”
Segment pattern data for displaying a 16-seg “blank”
Segment pattern data for displaying a 16-seg “−“
Segment pattern data for displaying a 16-seg “A”
Segment pattern data for displaying a 16-seg “b”
Segment pattern data for displaying a 16-seg “c”
Segment pattern data for displaying a 16-seg “d”
64
7 6 5
4
3
2 1 0
h g
e
d
c
f
b a
p o n m
l
k
j
i
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
1
1
1
0
1
1
1
0
0
0
1
0
0
0
1
0
0
1
1
1
1
1
1
0
0
0
1
0
0
0
1
1
0
0
0
1
1
0
0
0
0
0
1
0
0
0
1
1
0
1
1
1
0
1
1
0
0
0
1
0
0
0
1
1
1
1
1
1
0
1
1
0
0
0
1
0
0
0
1
1
0
0
0
1
1
1
1
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
0
0
0
1
0
0
0
1
1
0
1
1
1
1
1
1
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
1
1
0
0
1
1
1
1
0
0
0
1
0
0
0
1
0
0
1
1
1
1
1
1
0
1
0
1
0
1
0
0
1
1
1
1
0
0
1
1
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
0
1
0
0
0
1
0
0
ML610Q400 Series
Sample Program AP Notes
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
0xf3
0x11
0xc3
0x11
0xfb
0x10
0xcc
0x11
0x00
0x44
0x7c
0x00
0xc0
0x29
0xf0
0x00
0xcc
0x0a
0xcc
0x22
0xff
0x00
0xc7
0x11
0xff
0x20
0xc7
0x31
0xbb
0x11
0x03
0x44
0xfc
0x00
0xc0
0x88
0xcc
0xa0
0x00
0xaa
0x00
0x4a
0x33
0x88
Segment pattern data for displaying a 16-seg “E”
Segment pattern data for displaying a 16-seg “F”
Segment pattern data for displaying a 16-seg “G”
Segment pattern data for displaying a 16-seg “H”
Segment pattern data for displaying a 16-seg “I”
Segment pattern data for displaying a 16-seg “J”
Segment pattern data for displaying a 16-seg “K”
Segment pattern data for displaying a 16-seg “L”
Segment pattern data for displaying a 16-seg “M”
Segment pattern data for displaying a 16-seg “N”
Segment pattern data for displaying a 16-seg “O”
Segment pattern data for displaying a 16-seg “P”
Segment pattern data for displaying a 16-seg “Q”
Segment pattern data for displaying a 16-seg “R”
Segment pattern data for displaying a 16-seg “S”
Segment pattern data for displaying a 16-seg “T”
Segment pattern data for displaying a 16-seg “U”
Segment pattern data for displaying a 16-seg “V”
Segment pattern data for displaying a 16-seg “W”
Segment pattern data for displaying a 16-seg “X”
Segment pattern data for displaying a 16-seg “Y”
Segment pattern data for displaying a 16-seg “Z”
65
1
1
1
1
0
0
1
1
0
0
0
1
0
0
0
1
1
1
0
0
0
0
1
1
0
0
0
1
0
0
0
1
1
1
1
1
1
0
1
1
0
0
0
1
0
0
0
0
1
1
0
0
1
1
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
1
0
1
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
1
0
0
0
1
1
0
0
1
1
0
0
0
0
0
0
1
0
1
0
1
1
0
0
1
1
0
0
0
0
1
0
0
0
1
0
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
1
1
0
0
0
1
1
1
0
0
0
1
0
0
0
1
1
1
1
1
1
1
1
1
0
0
1
0
0
0
0
0
1
1
0
0
0
1
1
1
0
0
1
1
0
0
0
1
1
0
1
1
1
0
1
1
0
0
0
1
0
0
0
1
0
0
0
0
0
0
1
1
0
1
0
0
0
1
0
0
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
1
0
0
0
1
0
0
0
1
1
0
0
1
1
0
0
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
1
0
0
0
1
1
0
0
1
1
1
0
0
0
1
0
0
0
ML610Q400 Series
Sample Program AP Notes
3.8.4.4. Display Position ⇔ DSPR Address Correspondence Table (for the LCD driver without the display
allocation function)
The table below shows the correspondence between the display positions of the LCD panel and the display registers
(DSPR) of the MCU.
Display
4th digit of Mode (left)
Display
register
bit7
bit6
bit5
bit4
bit3
bit2
bit1
bit0
DSPR00
Y4
Y3
Y2
Y1
DSPR01
g
p
i
h
DSPR02
f
o
j
a
DSPR03
e
n
k
b
DSPR04
d
m
l
c
date
month
DSPR05
3rd digit of Mode
2nd digit of Mode
1st digit of Mode
DSPR06
g
p
i
h
DSPR07
f
o
j
a
DSPR08
e
n
k
b
DSPR09
d
m
l
c
DSPR0A
g
p
i
h
DSPR0B
f
o
j
a
DSPR0C
e
n
k
b
DSPR0D
d
m
l
c
DSPR0E
g
p
i
h
DSPR0F
f
o
j
a
DSPR10
e
n
k
b
DSPR11
d
DSPR12
7-seg (6th digit on the upper part)
DSPR13
d
DSPR14
m
l
c
year
pm
am
e
g
f
c
b
a
e
g
f
7-seg (5th digit on the upper part)
DSPR15
d
DSPR16
COL1
c
b
a
7-seg (4th digit on the upper part)
DSPR17
d
e
g
f
DSPR18
C1
c
b
a
DSPR19
d
e
g
f
DSPR1A
COL2
c
b
a
7-seg (3rd digit on the upper part)
7-seg (2nd digit on the upper part)
DSPR1B
d
e
g
f
DSPR1C
C2
c
b
a
7-seg (1st digit on the upper part)
DSPR1D
d
e
g
f
4th digit of Mode (left)
DSPR1E
T1
c
b
a
DSPR1F
B1
B2
B4
B3
DSPR20
-
-
-
-
DSPR21
Y12
Y11
Y10
Y9
DSPR22
Y16
Y15
Y14
Y13
66
ML610Q400 Series
Sample Program AP Notes
3.8.4.5. Segment Pattern Data Table for 8-Seg Display (for the LCD driver without the display allocation
function)
The figure below shows the 8-seg segment pattern used in the LCD display control module.
a
f
g
e
b
c h
d
DSPR+1
Character
Value
Description
DSPR
3 2 1 0 3 2 1 0
h c b a d e g f
‘0’
0x7d
Segment pattern data for displaying an 8-seg “0”
0 1 1 1 1 1 0 1
‘1’
0x60
Segment pattern data for displaying an 8-seg “1”
0 1 1 0 0 0 0 0
‘2’
0x3e
Segment pattern data for displaying an 8-seg “2”
0 0 1 1 1 1 1 0
‘3’
0x7a
Segment pattern data for displaying an 8-seg “3”
0 1 1 1 1 0 1 0
‘4’
0x63
Segment pattern data for displaying an 8-seg “4”
0 1 1 0 0 0 1 1
‘5’
0x5b
Segment pattern data for displaying an 8-seg “5”
0 1 0 1 1 0 1 1
‘6’
0x5f
Segment pattern data for displaying an 8-seg “6”
0 1 0 1 1 1 1 1
‘7’
0x71
Segment pattern data for displaying an 8-seg “7”
0 1 1 1 0 0 0 1
‘8’
0x7F
Segment pattern data for displaying an 8-seg “8”
0 1 1 1 1 1 1 1
‘9’
0x7b
Segment pattern data for displaying an 8-seg “9”
0 1 1 1 1 0 1 1
Blank
0x00
Segment pattern data for displaying an 8-seg “blank”
0 0 0 0 0 0 0 0
‘-’
0x20
Segment pattern data for displaying an 8-seg “−“
0 0 0 0 0 0 1 0
A
0x77
Segment pattern data for displaying an 8-seg “A”
0 1 1 1 0 1 1 1
b
0x4f
Segment pattern data for displaying an 8-seg “b”
0 1 0 0 1 1 1 1
c
0x0e
Segment pattern data for displaying an 8-seg “c”
0 0 0 0 1 1 1 0
d
0x6e
Segment pattern data for displaying an 8-seg “d”
0 1 1 0 1 1 1 0
E
0x1f
Segment pattern data for displaying an 8-seg “E”
0 0 0 1 1 1 1 1
67
ML610Q400 Series
Sample Program AP Notes
F
0x17
Segment pattern data for displaying an 8-seg “F”
0 0 0 1 0 1 1 1
3.8.5.
Sample of Use
The figure below shows a sample flow from initialization to clock time display by use of the LCD display control
module.
3.8.5.1. Clock Time Display Procedure
Figure 3-28 shows the procedure from initialization to clock time display by use of the LCD display control module.
Figure 3-28 Clock Time Display Procedure
68
ML610Q400 Series
Sample Program AP Notes
69
ML610Q400 Series
Sample Program AP Notes
1) Initialize the LCD display control module
¾ Specify the conditions tailored to the LCD panel to be used by use of the lcd_init function and initialize the
LCD driver of the MCU.
1
Set LCD assignment table data
2
Select the clock for bias generation circuit
voltage multiplication
3
Select the bias of the bias generation circuit
4
Select duty
5
Select a frame frequency
* At initialization, the mode of LCD display is set to LCD stop mode.
2) Set the contrast value
¾ Set the contrast value from within 32 levels by use of the lcd_setContrast function.
3) Set the mode of LCD display
¾ Specify the mode of LCD display by use of the lcd_setLCDMode function and allow the content of the display
registers to be displayed.
4) Clock time display
¾ Display the hour digits by specifying the two digits of hour by use of the lcd_dispHour function.
¾ Display the minute digits by specifying the two digits of minute by use of the lcd_dispMin function.
¾ Display the second digits by specifying the two digits of second by use of the lcd_dispSec function.
70
ML610Q400 Series
Sample Program AP Notes
3.9.
Key Input Control Module
3.9.1.
Function Overview
The key input control module performs initialization (input mode), key read-in start/stop, and key event acquisition.
Table 3-17 lists the key input control module APIs.
Table 3-17 List of APIs
Function name
key_init function
key_start function
key_stop function
key_getEvent function
Description
Sets the key input port settings (pull-up input, interrupt at the falling edge, no
sampling).
Starts key read-in processing.
Stops key read-in processing.
Acquires a key event.
* For details of the APIs, see the “ML610Q400 Series Sample Program API Manual.”
71
ML610Q400 Series
Sample Program AP Notes
3.9.2.
Operating Conditions
This section describes the operating conditions and valid range of this module. It also describes the restrictions on this
module.
The module reads in keys connected to P00–P03.
The module creates the following key information for the key pressed first: A short press (when the key is released in
less then 2 seconds) or a long press (when a key is held down for two seconds). It does not support a simultaneous
press of multiple keys. Note that, once a long key press is confirmed by holding a key down for 2 seconds, further
holding that key in succession takes no effect.
The module uses the 128Hz interrupt in order to detect chattering.
3.9.3.
Key Read-In Timing Diagram
P00-P03 Key pressed
interrupt (P0x interrupt)
enable
128Hz
Key 1
interrupt
(P00 pin)
P00-P03
interrupt
enable
128Hz
interrupt
Key
released
128Hz
interrupt
128Hz
interrupt
128Hz
interrupt
Key pressed
128Hz
128Hz
interrupt
(P0x interrupt) interrupt
P00-P03
interrupt
enable
/ /
Key 2
(P01 pin)
[Matched 4 times]
A short-key-press
“push” event
confirmed
[Matched 4 times or more but less
than 256 times]
A short-key-press “release” event
confirmed
[Matched 256
times]
A long-key-press
“push” event
confirmed
Key 3
(P02 pin)
Key 4
(P03 pin)
Figure 3-29 Key Read-In Timing Diagram
1 Enable interrupts to port P00–P03 pins.
Specify falling edge interrupt for these ports as the interrupt generation condition.
2 Interrupt occurs (P0xINT: x=0-3):
P0xINT occurs when a key is pressed. Disables interrupts to other ports.
Chattering absorption timer 128Hz interrupt starts (approx. 7.8 ms).
This 128Hz interrupt is generated by the time base counter. Note that the interval of this interrupt is not synchronous
with P0xINT.
3 Absorb chattering (INT128Hz: approx. 7.8 ms):
Key read-in is input to the port until a match of the same key is detected four times or more in a row.
When a match of the same key is detected four times in a row (a short-key-press “push” event is confirmed):
Generates a key status of a short-key-press “push” and continues the processing of 4.
If, after a match of the same key is found less than four times, the key is released, processing returns to 1.
4 Establish key input.
If, during a match of the same key occurring four times or more but less than 256 times, the key is released (a
short-key-press “release” event is confirmed): Generates a key status of a short-key-press “release” and returns to
the processing of 1.
When a match of the same key is detected 256 times (when holding it down for approx. 2 seconds) (a long-key-press
event is confirmed): Generates a key status of a long key press and continues processing until the key is released.
Processing returns to 1 when the key is released.
72
ML610Q400 Series
Sample Program AP Notes
3.9.4.
Sample of Use
The subsection below describes the procedure for acquiring a key event using the key input control module.
3.9.4.1. Key Event Acquisition Procedure
The figure below shows the procedure for acquiring a key event using the key input control module.
Main Routine
1)
Initialize key input control module
key_init function
2)
Start key read-in
key_start function
Input port P00 pin interrupt (P00INT)
Input port P01 pin interrupt (P01INT)
Input port P02 pin interrupt (P02INT)
Input port P03 pin interrupt (P03INT)
1)
Key read-in start processing
_intP00 function, _intP01
function,
_intP02 function, _intP03 function
128Hz interrupt (T128HINT)
1)
3)
Processing of the periodic
interrupt for key read-in
_int_key_Timer function
Acquire key event
Key_getEvent function
Figure 3-30 Key Event Acquisition Procedure
73
ML610Q400 Series
Sample Program AP Notes
[Main Routine]
1) Initialize the key input control module
¾ The key_init function initializes the key input control module. This function sets the settings for input ports
P00–P03.
2) Start key read-in
¾ The key_start function starts key read-in operation. This function sets settings for the input port P00–P03 pin
interrupt processing and 128Hz interrupt processing and then enables interrupts to input ports P00–P03.
3) Acquire a key event
¾ The key_getEvent function acquires a key event.
[Input port P00 pin interrupt (P00INT)]
1) Input port P00 push detect processing
¾ Executes the _intP00 function by the input port P00 pin interrupt to acquire the key number and make a key
status transition.
[Input port P01 pin interrupt (P01INT)]
1) Input port P01 push detect processing
¾ Executes the _intP01 function by the input port P01 pin interrupt to acquire the key number and make a key
status transition.
[Input port P02 pin interrupt (P02INT)]
1) Input port P02 push detect processing
¾ Executes the _intP02 function by the input port P02 pin interrupt to acquire the key number and make a key
status transition.
[Input port P03 pin interrupt (P03INT)]
1) Input port P03 push detect processing
¾ Executes the _intP03 function by the input port P03 pin interrupt to acquire the key number and make a key
status transition.
[128Hz interrupt (T128HINT)]
1) Processing of periodic interrupt for key read-in
¾ Executes the _int_key_Timer function by the 128Hz interrupt to make a key status transition.
74
ML610Q400 Series
Sample Program AP Notes
3.10.
Melody Control Module
The MCU incorporates a 1-channel melody driver (excluding the ML610Q411/Q412/Q415).
LSCLK×2
MD0INT
Melody interrupt
Tempo
generation circuit/
Buzzer mode
select circuit
Control circuit
MD0CON
Tempo code
MD0TMP
Tone length
generation circuit/
Duty select circuit
Tone
generation circuit/
Buzzer output
circuit
Tone length buffer
Tone buffer
Tone length code
MD0LEN
Scale code
MD0TON
P22/MD0
Data bus
MD0CON
MD0TMP
MD0TON
MD0LEN
: Melody 0 control register
: Melody 0 tempo code register
: Melody 0 scale code register
: Melody 0 tone length code register
Figure 3-31 Configuration of Melody Driver
Table 3-18 List of Pins
Pin name
P22/MD0
I/O
O
Description
Melody 0 signal output pin. Used as the secondary function of the P22 pin.
* For details, refer to the chapter “Melody Driver” of the User’s Manual for your target MCU.
75
ML610Q400 Series
Sample Program AP Notes
3.10.1. Function Overview
The melody control module controls the melody driver of the MCU.
Table 3-19 lists the melody control module APIs that the sample program uses.
Table 3-19 List of APIs
Function name
melody_init function
melody_start function
melody_stop function
melody_continue function
Description
Initializes the melody control module (stops melody/buzzer output; port
secondary function setting).
Starts melody output.
Stops melody output.
Performs melody output continuation processing.
* For details of the APIs, see the “ML610Q400 Series Sample Program API Manual.”
3.10.2. Operating Conditions
This section describes the operating conditions and valid range of this module. It also describes the restrictions on
this module.
¾ Melody output mode setting
¾ 29 scales (melody audio frequency: 508 Hz to 32.768 kHz)
¾ 63 tone lengths
¾ 15 tempos
Notes:
For melody output, the 2×low-speed clock (LSCLK×2) is used for the purpose of frequency generation. Therefore,
set bit 2 (ENMLT) of the frequency control register 1(FCON1) to “1” to enable the 2×low-speed clock before using
this module.
Concurrent output of melody and buzzer is not supported.
This module does not allow changing tempo in the middle of melody playback.
76
ML610Q400 Series
Sample Program AP Notes
3.10.3. Sample of Use
The subsection below describes the procedure for outputting a melody using the melody control module. (Output the
first melody data from the Main Routine and then outputs the remaining data by a melody output interrupt.)
3.10.3.1. Melody Output Procedure
The figure below shows the procedure for outputting a melody using the melody control module.
Figure 3-32 Melody Output Procedure
77
ML610Q400 Series
Sample Program AP Notes
[Main Routine]
1) Set 2xlow-speed clock (LSCLKx2)
¾ Set LSCLKx2 before initializing the melody control module.
2) Initialize the melody control module
1
the melody_init function.
Initialize the melody control module using
3) Start melody output
¾ Specify the following melody data information in the melody_start function and start melody output.
1
Tempo of the melody
2
Initial address of the area that contains
melody data
3
Size of the melody data (the number of note
data items)
4) Terminate melody output
¾ Terminate melody output using the melody_stop function.
¾ If the melody has been output to the end, there is no need to call this function, because the melody output
continuation processing (melody_continue function) will stop melody output in that case. Call this function if
melody output needs to be stopped in the middle of output.
[Melody0 Interrupt (MD0INT)]
1) Continue melody output
¾ When executed, the melody_continue function outputs data items one by one based on the data information
specified at the time of melody output start, then exits the interrupt. When melody output is completed, the
function outputs rest data and exits the interrupt. It stops melody output by the interrupt after the output of the
rest data.
78
ML610Q400 Series
Sample Program AP Notes
3.11.
Real-Time Clock Control Module
This MCU incorporates a real-time clock (RTC) (excluding the ML610Q411/Q412/Q415).
Data bus
Control circuit
RTCCON
Alarm 0/1
Control circuit
RTCINT
(Periodic interrupt)
Periodic interrupt control
0.5 sec
T2HZ
T1HZ
Operation
control
1 sec
AL0INT, AL1INT
(Alarm interrupt)
1 min.
Time counter
SEC, MIN, HOUR
Day counter
WEEK,
DAY, MON, YAER
Data bus
RTCCON: Real-time clock control register
Figure 3-33 Configuration of Real-Time Clock Control Module
* For details, refer to the chapter “Real Time Clock” of the User’s Manual for your target MCU.
79
ML610Q400 Series
Sample Program AP Notes
3.11.1. Function Overview
The real-time clock control module mainly sets the settings for the counting functions of the real-time clock of the
MCU.
Table 3-20 lists the real-time clock control module APIs that the sample program uses.
Table 3-20 List of APIs
Function name
rtc_setTime function
rtc_getTime function
rtc_start function
rtc_stop function
rtc_setRegularInt function
Description
Sets date (year, month, day, day of the week) and clock time (hour, minute, second).
Obtains date (year, month, day, day of the week) and clock time (hour, minute, second).
Starts RTC operation.
Stops RTC operation.
Selects the interval between periodic interrupts.
* For details of the APIs, see the “ML610Q400 Series Sample Program API Manual.”
3.11.2. Operating Conditions
This section describes the operating conditions and valid range of this module. It also describes the restrictions on this
module.
The RTC is stopped immediately after an MCU reset.
Year values settable with the date counting function
Month values settable with the date counting function
Day values settable with the date counting function
Day of the week values settable with the date counting function
Hour values settable with the clock time counting function
Minute values settable with the clock time counting function
Second values settable with the clock time counting function
00–99
01–12
01–31
1–7 (Each value can be freely associated with
any day of the week.)
00–23
00–59
00–59
Note:
The parameters used in each of the APIs above must be specified by binary-code decimal (BCD) values .
80
ML610Q400 Series
Sample Program AP Notes
3.11.3. Sample of Use
The subsection below describes the procedure for setting date and clock time using the real-time clock control module.
3.11.3.1. Date and Clock Time Setting Procedure
The figure below shows the procedure for setting date (year, month, day, day of the week) and clock time (hour, minute,
second) using the real-time clock control module.
Main Routine
1)
Stop RTC operation
rtc_stop function
2)
Set date and clock time in RTC
rtc_setTime function
3)
Reset low-speed time base counter
4)
Start RTC operation
rtc_start function
5)
Obtain date and clock time of RTC
rtc_getTime function
Figure 3-34 Date and Clock Time Setting Procedure
81
ML610Q400 Series
Sample Program AP Notes
[Main Routine]
1) Stop RTC operation (because date and clock time have to be set with the RTC stopped)
2) Set date and clock time
¾ Stop RTC operation using the rtc_stop function.
¾ Set date and clock time using the rtc_setTime function.
1
2
3
4
5
6
7
Second data (0–59)
Minute data (0–59)
Hour data (0–23)
Day-of-the-week data (1–7)
Day data (1–31)
Month data (1–12)
Year data (0–99)
3) Reset the low-speed time base counter
¾ By resetting the low-speed time base counter, clear the internal counter used to count for less than one second
and secure a count of 1 second after the start of RTC operation.
4) Start RTC operation
¾ Start RTC operation using the rtc_start function.
5) Obtain the date and clock time of the RTC
¾ Obtain the current date (year, month, day, day of the week) and clock time (hour, minute, second) using the
rtc_getTime function.
82
ML610Q400 Series
Sample Program AP Notes
3.12.
Timer Control Module
This MCU incorporates 4 channels of 8-bit timers.
TMnINT
Match
Write TMnC
Comparator
LSCLK
HTBCLK
TMnCON0 TnCK
TMnCON1
External clock
P44/T02P0CK
P45/T13P1CK
8
R
8
TMnC
TMnD
8
8
n = 0 to 3
Data bus
(a) 8-bit Timer Mode (Timers 0 to 3)
TMmINT
Match
Write TMnC
Write TMmC
n = 0, 2 m = 1, 3
Comparator
16
16
8
LSCLK
HTBCLK
External clock
P44/T02P0CK
P45/T13P1CK
Read TMnC
TMnCON0 TnCK
TMnCON1
R
TMnC
8
R
TMmC
8
TMnD
TMmD
8
8
8
TMmC latch
8
Data bus
(b) 16-bit Timer Mode (Timers 0 to 3)
TMnCON0:
TMnCON1:
TMmD, TMnD:
TMmC, TMnC:
8
Timer control register 0
Timer control register 1
Timer data registers
Timer counter registers
Figure 3-35 Timer Control Module
83
ML610Q400 Series
Sample Program AP Notes
3.12.1. Function Overview
The timer control module controls the timer operation of the MCU.
Table 3-21 lists the timer control module APIs that the sample program uses.
Table 3-21 List of APIs
Function name
tm_init function
tm_start function
tm_stop function
tm_checkOvf function
tm_checkFmFunc function
Description
Executes operating clock setting, 8-bit or 16-bit mode setting, and overflow interval
setting.
Starts timer operation. Operation setting is performed with tm_init function.
Stops timer operation.
Checks the timer overflow flag status.
Checks whether the 16-bit frequency measurement function can be used or not.
* For details of the APIs, see the “ML610Q400 Series Sample Program API Manual.”
3.12.2. Operating Conditions
This section describes the operating conditions and valid range of this module. It also describes the restrictions on this
module.
Because it is possible that the timer counter (TMnC register) will be incremented after the tm_stop function is
executed, the use of interrupt may cause generation of an interrupt after the timer is stopped.
84
ML610Q400 Series
Sample Program AP Notes
3.12.3. Sample of Use
The subsection below describes the procedure for waiting for a certain period of time using the timer control module.
3.12.3.1. Procedure for Waiting for a Certain Period of Time
The figure below shows the procedure for waiting for a certain period of time using the timer control module.
Figure 3-36 Procedure for Waiting for a Certain Period of Time
85
ML610Q400 Series
Sample Program AP Notes
[Main Routine]
1) Initialize the timer control module
¾ Set the following in the designated parameters of the tm_init function and initialize the timer control module:
1 Channel number (0 to 3) of the timer
2 Operating mode
3 Operating clock
4 Overflow interval
2) Start timer operation
¾ Specify the channel number of the timer in the designated parameter of the tm_start function and start timer
operation.
3) Check the timer overflow status
¾ Specify the channel number of the timer in the designated parameter of the tm_checkOvf function and check
the timer overflow status. If no overflow has occurred, call the tm_checkOvf function periodically.
4) Perform appropriate processing
¾ Perform processing you want to execute upon the occurrence of a timer overflow.
5) Stop timer operation
¾ Specify the channel number of the timer in the designated parameter of the tm_stop function and stop the timer
operation.
86
ML610Q400 Series
Sample Program AP Notes
3.13.
Clock Control Module
This MCU has both a low-speed clock generation circuit and a high-speed clock generation circuit and allows the
low-speed clock (LSCLK) or high-speed clock (HSCLK: Four types) to be applied to the system clock (SYSCLK). In
addition, LSCLK, LSCLK×2, and HSCLK can be selected as the time base clocks for peripheral circuits.
2×low-speed clock
(LSCLK×2)
XT0
Low-speed clock
(LSCLK)
MPX
XT1
Low-speed
clock generation
circuit
P10/OSC0
P11/OSC1
High-speed
clock generation
circuit
OSCLK
Divide ratio select
1/1, 1/2, 1/4, 1/8
Divide ratio select
1/1, 1/2, 1/4, 1/8
System clock
(SYSCLK)
High-speed clock
(HSCLK)
High-speed output clock
(OUTCLK)
FCON0, FCON1
Data bus
FCON0
FCON1
: Frequency control register 0
: Frequency control register 1
Figure 3-37 Clock Control Module
* For details, refer to the chapter “Clock Generation Circuit” of the User’s Manual for your target MCU.
87
ML610Q400 Series
Sample Program AP Notes
3.13.1. Function Overview
The clock control module exercises clock control such as system clock setting.
Table 3-22 lists the clock control module APIs that the sample program uses and Table 3-23 the system definition
functions.
Table 3-22 List of APIs
Function name
clk_setSysclk function
clk_enaLsclk2 function
Description
Selects low-speed clock or high-speed clock as the system clock; selects the divide ratio
of high-speed clock; selects the operating mode of the high-speed clock generation
circuit; sets the clock frequency to be used.
Starts the operation of the 2xlow-speed clock.
Table 3-23 List of System Definition Functions
Function name
clk_wait500us function
Description
Waits for 500 µs.
* Used to wait for the system clock to be switched.
* When using a system definition function, it is necessary to create internal processing according to the system used.
* For the details of the APIs and system definition functions, see the “ML610Q400 Series Sample Program API
Manual”.
3.13.2. Operating Conditions
This section describes the operating conditions and valid range of this module. It also describes the restrictions on this
module.
Low-speed clock: 32.768 kHz crystal oscillation mode
¾ Capable of generating LSCLK × 2 (64 kHz), a clock having a frequency of 2 × 32.768 kHz
High-speed clock: Selectable by software
¾ 500 kHz RC oscillation mode
¾ Crystal/ceramic oscillation mode
¾ Built-in PLL oscillation mode
¾ External clock input mode
System clock : Selectable by software
¾ Low-speed clock
¾ High-speed clock: 4 types
Notes:
This MCU starts operation with the clock generated by dividing the 500 kHz RC oscillation frequency by 8 after
power-on or a system reset.
For the details of clock oscillation accuracy, refer to the chapter “Electrical Characteristics” of the User’s Manual for
your target MCU.
88
ML610Q400 Series
Sample Program AP Notes
3.14.
Time Base Counter Control Module
This MCU incorporates a low-speed time base counter (LTBC) and a high-speed time base counter (HTBC) that
generate base clocks for peripheral circuits. By using these time base counters, it is possible to generate events
periodically.
T32KHZ
T16KHZ
T8KHZ
T4KHZ
T2KHZ
T1KHZ
T512HZ
T256HZ
T128HZ
T64HZ
T32HZ
T16HZ
T8HZ
T4HZ
T2HZ
T1HZ
7-bit Counter
LSCLK
(32.768 kHz)
R
LTBR
8-bit Counter
R
LTBADJL
LTBDJH
RESET
(internal signal)
LTBR Write
8
8
Data bus
LTBR
LTBADJL
LTBADJH
: Low-speed time base counter register
: Low-speed time base counter frequency adjust register
: Low-speed time base counter frequency adjust register
HSCLK
RESET
(internal signal)
Data bus
HTBDR:
HTBDR
1/n-Counter
R
HTBCLK
4.096 MHz to 256 Hz
8
High-speed time base counter frequency divide register
Figure 3-38 Time Base Counter Control Module
* For the details of clock oscillation accuracy, refer to the chapter “Time Base Counter” of the User’s Manual for your
target MCU.
89
ML610Q400 Series
Sample Program AP Notes
3.14.1. Function Overview
The time-base counter module controls the high-speed side time-base counter of the MCU.
Table 3-24 lists the time base counter control module APIs that the sample program uses.
Table 3-24 List of APIs
Function name
tb_setHtbdiv function
Description
Sets the divide ratio of the time-base counter on the high-speed side.
* For details of the APIs, see the “ML610Q400 Series Sample Program API Manual.”
3.14.2. Operating Conditions
This section describes the operating conditions and valid range of this module. It also describes the restrictions on this
module.
Frequency divide ratio of the high-speed time base counter
¾ 1/16 to 1/1 (16 levels)
90
ML610Q400 Series
Sample Program AP Notes
3.15.
1 kHz Timer Control Module
This MCU incorporates a 1 kHz timer to measure a 1/1000th of a second.
Interrupt control
T1KINT
1 kHz signal
10 Hz
Binary/ternary
counter
T2KHZ
(2.048 kHz)
T1KCRL
Decimal × 1 digit
R
1 Hz
T1KCRH
Decimal ×2 digits
R
R
Write T1KCRH
Write T1KCRL
T1KCON
Data bus
T1KCON
T1KCRL
T1KCRH
: 1 kHz timer control register
: 1 kHz timer count register L
: 1 kHz timer count register H
Figure 3-39 1 kHz Timer Control Module
* For details, refer to the chapter “1kHz Timer” of the User’s Manual for your target MCU.
3.15.1. Function Overview
The 1 kHz timer control module measures time in 1/000 second increments by use of the 1kHz timer of the MCU.
Table 3-25 lists the 1 kHz timer control module APIs that the sample program uses.
Table 3-25 List of APIs
Function name
t1k_init function
t1k_start function
t1k_stop function
t1k_getT1KCR function
t1k_clrT1KCR function
t1km_checkOvf function
Description
Sets the 1Hz/10Hz interrupts, stops the timer, and clears T1KCR.
Starts timer operation.
Stops timer operation.
Reads the T1KCR register.
Clears the contents of the T1KCR register.
Checks the status of the timer overflow flag.
* For details of the APIs, see the “ML610Q400 Series Sample Program API Manual.”
91
ML610Q400 Series
Sample Program AP Notes
3.15.2. Operating Conditions
This section describes the operating conditions and valid range of this module. It also describes the restrictions on this
module.
Clocking range with 1/10, 1/100, and 1/1000 second measurement: 000 to 999
Note:
When reading the value of the 1/10, 1/100, or 1/1000 registers, use the following procedure taking an overflow from
low-order digits into account.
92
ML610Q400 Series
Sample Program AP Notes
3.16.
Stopwatch Module
The stopwatch module allows executing a stopwatch function, which can perform clocking in centiseconds.
3.16.1. Function Overview
The stopwatch module initializes the stopwatch, starts/stops the stopwatch, and controls data read.
Table 3-26 lists stopwatch module APIs that the sample program uses.
Table 3-26 List of APIs
Function name
Description
chrono_init function
chrono_start function
chrono_stop function
chrono_getHz100 function
chrono_getHz1000 function
chrono_getTime function
chrono_checkOvf function
chrono_clrOvf function
Initializes the stopwatch.
Starts the stopwatch.
Stops the stopwatch.
Reads the value of 1/10 and 1/100.
Reads the value of 1/10, 1/100, and 1/1000.
Reads the value of minute, second, 1/10, 1/100, and 1/1000.
Checks the stopwatch’s 60-minute overflow flag.
Clears the stopwatch’s 60-minute overflow flag.
Chrono_int1kHz function
Updates the clock time of the stopwatch.
* For details of the APIs, see the “ML610Q400 Series Sample Program API Manual.”
3.16.2. Operating Conditions
This section describes the operating conditions and valid range of this module. It also describes the restrictions on this
module.
Range in which the stopwatch can perform clocking: 0:00:00 to 59:59:99
* The overflow flag is set to “1” if measured beyond one hour.
93
ML610Q400 Series
Sample Program AP Notes
3.16.3. Sample of Use
The following shows the procedure for obtaining measured elapsed time using the stopwatch module.
Main Routine
1)
Initialize stopwatch
chrono_init function
1kHz Timer Interrupt (T1KINT) Handler
_intT1KINT function
2)
Start stopwatch
chrono_start function
1)
3)
Obtain minute, second, and the value of 1/10,
1/100, 1/1000
chrono_getTime function
4)
Stop stopwatch
chrono_stop function
Processing of the 1kHz timer interrupt
that is active
Chrono_int1kHz_Run function
[Main Routine]
1) Initialize stopwatch
¾ Perform stopwatch initialization processing using the chrono_init function. Within this function, clear the clock
time and initialize the 1kHz timer interrupt.
2) Start stopwatch
¾ Enable the 1kHz timer interrupt using the chrono_start function.
3) Obtain minute, second, and the value of 1/10, 1/100, and 1/1000.
¾ Obtain the elapsed time that has been measured using the chrono_getTime function. Obtain the value of minute,
second, 1/10, 1/100, and 1/1000.
4) Stop stopwatch
¾ Stop the 1kHz timer using the chrono_stop function.
[1kHz Timer Interrupt (T1KINT) Handler]
1) 1kHz timer interrupt processing
¾ Execute the Chrono_int1kHz_Run function within the 1kHz interrupt handler, or the _intT1KINT function,
and update the clock time.
94
ML610Q400 Series
Sample Program AP Notes
3.17.
BLD Control Module
This MCU incorporates a battery level detector (BLD).
Comparator
VDD
BLDF
Threshold voltage
select circuit
BLDCON0
ENBL
BLDCON1
Data bus
BLDCON0
BLDCON1
: BLD control register 0
: BLD control register 1
Figure 3-40 BLD Control Module
* For details, refer to the chapter “Battery Level Detector” of the ML610Q431/ML610Q432 User’s Manual and
ML610Q411/ML610Q412/ML610Q415 User’s Manual.
3.17.1. Function Overview
The BLD control module measures the power supply voltage of the MCU using the battery level detection function of
the MCU.
Table 3-27 List of APIs
Function name
bld_start_levelChek function
bld_getLevel function
bld_check function
bld_on function
bld_off function
Description
Starts battery level detection.
Obtains the battery level (17 levels in all).
Checks whether the battery voltage is lower or higher than the threshold voltage.
Turns on the battery level detector.
Turns off the battery level detector.
* For details of the APIs, see the “ML610Q400 Series Sample Program API Manual.”
95
ML610Q400 Series
Sample Program AP Notes
3.17.2. Operating Conditions
This section describes the operating conditions and valid range of this module. It also describes the restrictions on this
module.
Table 3-28 Correspondence between vol_level and Power Supply Voltage Range
vol_level
(HEX)
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
10
Power supply voltage range (V)
1.35 or less
1.35 to 1.40
1.40 to 1.45
1.45 to 1.50
1.50 to 1.60
1.60 to 1.70
1.70 to 1.80
1.80 to 1.90
1.90 to 2.00
2.00 to 2.10
2.10 to 2.20
2.20 to 2.30
2.30 to 2.40
2.40 to 2.50
2.50 to 2.70
2.70 to 2.90
2.90 or more
Note:
Be careful because processing time changes depending on battery levels.
This module first checks whether the battery voltage is higher than the upper limit (0x0F) or lower than or equal to the
lower limit (0x00) and then checks the intermediate range (0x01 to 0x0F).
96
ML610Q400 Series
Sample Program AP Notes
3.17.3. Sample of Use
The following shows the procedure for obtaining the vol_level using the BLD control module.
[Main Routine]
1) Initialize the BLD control module
¾ Initialize the battery level obtaining processing using the bld_start_levelCheck function.
2) Perform battery level obtaining processing by the BLD control module
¾
Execute the bld_get_level function at intervals of at least 1 ms. When the bld_get_level function has
returned a “0”, vol_level is confirmed.
97
ML610Q400 Series
Sample Program AP Notes
4.
Description of the Sample Program
Chapter 4 describes the functional specifications of the sample program.
4.1.
Common Specifications
1) System clock
• SYSCLK=HSCLK (RC oscillation mode 500 kHz)
2) UART
• 9600 bps, 8-bit, no parity, 1 Stop bit, positive logic, LSB first
* To use RS232C interface mounted on ML610Q400 Series Demo Kit, it is necessary to set P42 and P43 as a
secondary function by selection of a port function jumper switch (short-circuit between 2-1 pins) on
ML610Q400 Series Demo Kit.
3) Timer
• Channels 0/1, 16-bit mode, operating clock LSCLK, overflow interval 10 ms
4) LCD driver
• Bias voltage multiplying clock: 2 kHz
• Bias
: 1/4 bias for the ML610Q431/Q432
: 1/3 bias for the ML610Q411/Q412/Q415 (fixed by hardware)
• Duty
: 1/4 duty
• Frame frequency
: 73 Hz
98
ML610Q400 Series
Sample Program AP Notes
4.2.
Configuration of the LCD Panel
The following subsections describe the LCD panel configuration and types of display.
The LCD panel has two types of display patterns depending on the type of the LCD driver built into the MCU: one with
the display allocation function and the other without it. Section 4.6, “Function Overview,” onwards assume that the
LCD panel is equipped with the display allocation function.
4.2.1.
LCD Display Image with Display Allocation Function
The display allocation function is available if DSPMOD1’s DASN (bit 2) can be set to “1”.
The display image in this case shown below.
Clock time
display
Mode display
R
C
1
1
0
2
3 : 5
5 . 0
F
F
9 : 5
F
F
9
F
F
°C
Temperature
symbol display
Name
Mode display
Clock time display
Text display
Temperature symbol display
Text display
Content to be displayed
Displays the mode in which the sample program is operating (operating mode
select/SA-ADC measurement/RC-ADC measurement/UART
communication/stopwatch).
Displays either the version information of the firmware or the time elapsed after startup.
Displays an operational message, ADC measurement results, or baud rate count value.
The temperature symbol “°C” is steadily lit while a temperature is being displayed.
99
ML610Q400 Series
Sample Program AP Notes
4.2.2.
LCD Display Image with no Display Allocation Function
The display allocation function is not available unless DSPMOD1’s DASN (bit 2) can be set to “1” (the ML610Q411,
for example).
The display image in this case is shown below.
Mode display
R
C
(1)
1
.
Name
Mode display
Display for (1)
Content to be displayed
Displays the mode in which the sample program is operating (operating mode
select/SA-ADC measurement/RC-ADC measurement/UART communication).
In mode select mode, displays the version No.
In RC-ADC mode, displays blanks.
In UART mode, displays the baud rate timer value.
100
ML610Q400 Series
Sample Program AP Notes
4.3.
Key Event
The key events that the sample program handles are shown below.
Short-press push:
Short-press release:
Long press:
Priority:
Polling is performed at 128-Hz intervals from the time a key was pressed, and a short-press
push is confirmed if a match occurs four times. A short-press melody is output if it is a
valid event.
Polling is performed at 128-Hz intervals from the time a key was pressed, and a short-press
release is confirmed if a match occurs four times but the key is released in less than 2
seconds. A short-press release melody is output if it is a valid event.
A long press is confirmed if a key is held down for 2 seconds or more. Once a long press is
confirmed, no further long press event occurs even if the key is held down continuously. A
melody for a long press is output in the case of a valid event.
Key S1 > Key S2 > Key S3 > Key S4
4.4.
List of Melodies
Table 4-1 lists the melodies that the sample program uses.
Table 4-1
Melody List
Operation
Short key press
Long key press
When memory is full
Upon completion of UART transmission by
EEPROM control module
Melody
Short beep (once)
Short beep (twice)
Short beep (four times)
Music
* The melody output upon a short or long key press is output only when that key operation is valid.
101
ML610Q400 Series
Sample Program AP Notes
4.5.
About Compile Options
The sample program is provided with the following compile options.
Switch them according to the use.
LCD_TYPE = 0 or 1
0: Disables the mapping function
1: Enables the mapping function
FREQ_TIMER_MODE = 0 or 1
0: Disables the frequency measurement mode
1: Enables the frequency measurement mode
_RTC_TYPE
Without macro definition: Disables the RTC function
With macro definition: Enables the RTC function
_MELODY_TYPE
Without macro definition: Disables the melody function
With macro definition: Enables melody function
_CHRONO_DSP_REG
Without macro definition: Does not display the value of the 1/1000 register of the 1kHz timer
With macro definition: Displays the value of the 1/1000 register of the 1kHz timer
_SAADC_REG
Without macro definition: Disables the amplifier function
With macro definition: Enables the amplifier function
102
ML610Q400 Series
Sample Program AP Notes
4.6.
Function Overview
This section describes the functions that the sample program has.
4.6.1.
Functions of Sample Program
The sample program has the following four functions:
1
SA-ADC measurement mode (displays A/D value)
2
RC-ADC measurement mode (displays temperature and A/D value)
3
UART communication mode (loops back receive data)
4
Stopwatch mode (stopwatch function)
* A/D conversion results are stored in EEPROM and data stored in EEPROM can be transmitted to PC via UART.
Count values for UART baud rate can be corrected.
4.6.2.
State Transition Diagram
Power-on
Reset by RESET_N pin
or
reset by WDT overflow
Initialization
Operating mode select
Short S4 press
Short S1 press
Long S4 press Long S4
press
SA-ADC
measurement mode
Short S2 press
Short S3 press
RC-ADC
measurement mode
Figure 4-1
Long S4
press
Long S4 press
UART
communication mode
State Transition Diagram (Overall)
103
Stopwatch mode
ML610Q400 Series
Sample Program AP Notes
Mode
Operating mode
select
SA-ADC
measurement
RC-ADC
measurement
UART
communication
Stopwatch
4.6.3.
Description
Transition is made to SA-ADC measurement/RC-ADC measurement/UART communication/
stopwatch mode by a key operation.
Performs SA-ADC measurement at 1-sec intervals, corrects the baud rate, and displays the A/D
value of SA-ADC as a hexadecimal number on the LCD. Also, stores the time of measurement,
A/D value of SA-ADC, and the corrected baud rate count value in EEPROM. A memory-full sound
is output if the EEPROM has no free space.
Performs RC-ADC measurement at 1-sec intervals and corrects the baud rate. Then, displays on
the LCD a) the temperature calculated from the RC-ADC measurement results as a decimal
number and b) the A/D value of the RC-ADC measurement as a hexadecimal number. Also,
stores the time of measurement, temperature, A/D value of RC-ADC, and the corrected baud rate
count value in EEPROM. A memory-full sound is output if the EEPROM has no free space.
Performs UART reception until a terminating character (\r) is received. After receiving a
terminating character (\r), transmits the received data as is via UART. However, if 128 bytes of
data is received before receiving a terminating character (\r), starts UART transmission at that
point of time. After receiving 128 bytes, enters a UART transmitting state and discards 129 bytes
onward even if received until UART reception becomes enabled.
Carries out a stopwatch function.
Allows clocking in 1/100 second increments and performs functions such as RUN, STOP, clearing
measured time, and SPLIT.
In stopwatch mode, the system clock operates using the low-speed clock. The high-speed clock is
stopped.
State Transition Table
Key
S1
Mode
S2
S3
S4
Long
press
Short press
Long press
⎯
Short press
Long
press
Operating
mode select
Shifts to
SA-ADC
measurement
mode
⎯
Shifts to RC-ADC
measurement
mode
⎯
Shifts to UART
communication
mode
SA-ADC
measurement
Changes Ch
(Ch1⇔2)
⎯
Starts/stops
measurement
⎯
Starts/stops
EEPROM data
transmission
Clears
EEPROM
data
⎯
RC-ADC
measurement
Changes Ch
(Ch1⇔2)
⎯
Starts/stops
measurement
⎯
Starts/stops
EEPROM data
transmission
Clears
EEPROM
data
⎯
UART
communication
Stopwatch
⎯
RUN/STOP
Short press
Short press
Shifts to
stopwatch
mode
⎯
Corrects bps
⎯
⎯
⎯
⎯
⎯
At RUN: SPLIT
At STOP:
Clears measured
time
At SPLIT:
SPLIT again
⎯
⎯
⎯
⎯
104
Long press
⎯
Shifts to
operating
mode select
mode
ML610Q400 Series
Sample Program AP Notes
4.7.
Operating Mode Select Mode
Select the mode of operation.
4.7.1.
Description of Operation
¾ After the LCD display is cleared, displays the version of the firmware on the “clock time display” area.
¾ A key input makes a transition to the mode corresponding to the key.
4.7.2.
Description of LCD Display
Name
Mode display
Clock time display
Text display
Temperature symbol display
4.7.3.
Content to be displayed
Displays “VER ”.
Displays “ 1 70
” (version info of the firmware).
Displays “S E L - 1
2
3
4
”.
The “°C” symbol goes off.
Description of UART Display
No UART display is performed.
4.7.4.
S1
S2
S3
S4
Explanation of Key Operation
Key
Short
press
Long
press
Short
press
Long
press
Short
press
Long
press
Short
press
Long
press
Operation
Makes the transition to SA-ADC measurement mode.
No effect.
Makes the transition to RC-ADC measurement mode.
No effect.
Makes the transition to UART communication mode.
No effect.
Makes the transition to stopwatch mode.
No effect.
105
ML610Q400 Series
Sample Program AP Notes
4.8.
SA-ADC Measurement Mode
Performs SA-ADC measurement at 1-sec intervals, corrects the baud rate, and displays the A/D value of SA-ADC as a
hexadecimal number on the LCD. Also, stores the measured clock time, A/D value of SA-ADC, and corrected baud rate
count value in EEPROM.
4.8.1.
State Transition
Figure 4-2
State
SA-ADC conversion
that is performed at
1-sec intervals is being
stopped
SA-ADC conversion
that is performed at
1-sec intervals is being
activated
SA-ADC conversion
results in EEPROM are
being transmitted
SA-ADC conversion
results in EEPROM are
being cleared
State Transition Diagram (SA-ADC Measurement)
Description
Enters this mode immediately after mode transition.
A short S1 key press changes the channel.
A short S2 key press starts SA-ADC conversion.
A short S3 key press transmits the SA-ADC conversion results stored in EEPROM.
A long S3 key press clears the SA-ADC conversion results stored in EEPROM.
A long S4 key press makes a transition to operating mode select mode.
Performs SA-ADC measurement of the selected channel at 1-sec intervals and corrects
baud rate.
Displays the conversion results in the “text display” area of the LCD as a hexadecimal
number.
Stores the elapsed time, conversion results, and corrected baud rate in EEPROM. If
EEPROM is full (100 data items), a melody is output.
A short S2 key press stops SA-ADC conversion.
When transmission of all data has been completed, a music tune is output and a transition
is made to the “SA-ADC conversion performed at 1-sec intervals is being stopped” state.
A short S3 key press stops transmission and makes a transition to the “SA-ADC conversion
performed at 1-sec intervals is being stopped” state.
Upon completion of clearing of all data, a transition is made to the “SA-ADC conversion
performed at 1-sec intervals is being stopped” state.
Any key operation is ignored during clearing.
106
ML610Q400 Series
Sample Program AP Notes
4.8.2.
Description of LCD Display
S
A
1
0 : 0
0 : 0
0
0
Figure 4-3
S
A
2
When Channel 1 Selected
2
3 : 5
9 : 5
F
Figure 4-4
Name
Mode display
Clock time display
Text display
Temperature symbol display
9
F
F
When Channel 2 Selected
Content to be displayed
Displays “SA1 ” or “SA2 ” depending on the selected channel.
Displays the time elapsed after activation in the range of “ 0:00:00” to “23:59:59”. Only
the digits of hours are zero-suppressed.
Displays the SA-ADC conversion results as a hexadecimal number and performs
zero-suppression. Displays in the range of “
0” to
“
FFF”.
The “°C” symbol goes off.
107
ML610Q400 Series
Sample Program AP Notes
4.8.3.
Description of UART Display
SA1 00:00:01 SADR=123 UABRT= 33
SA1 00:00:02 SADR=122 UABRT= 32
SA2 00:00:11 SADR= 11 UABRT= 33
SA2 00:00:12 SADR= 12 UABRT= 34
...
Content to be displayed
Display data
Displays the type of ADC and a channel No. (SA1 or SA2).
Measured clock time
Displays in the range of 00:00:00 to 23:59:59
Measurement results (A/D value)
Displays in the range of 000 to FFF (as a hexadecimal number), after “SADR=”.
Baud rate count value
Displays in the range of 000 to FFF (as a hexadecimal number), after “UABRT=”.
4.8.4.
Explanation of Key Operation
Key
S1
S2
S3
S4
Short
press
Operation
Switches between the SA-ADC measuring channels.
When channel 1 being selected ⇒ Switches to channel 2
When channel 2 being selected ⇒ Switches to channel 1
Long
press
Short
press
Long
press
Starts/stops SA-ADC measurement.
Short
press
Starts/stops transmission of the SA-ADC measurement result data stored in EEPROM.
- Other than during data transmission ⇒ Starts data transmission.
- During data transmission ⇒ Stops data transmission.
Long
press
Short
press
Long
press
No effect.
No effect.
Clears all the SA-ADC measurement result data stored in EEPROM.
No effect.
Makes a transition to operating mode select mode.
108
ML610Q400 Series
Sample Program AP Notes
4.9.
RC-ADC Measurement Mode
Performs RC-ADC measurement at 1-sec intervals(*) and then displays on the LCD a) the temperature and humidity
calculated from the RC-ADC measurement results as a decimal number and b) the A/D value of the RC-ADC
measurement as a hexadecimal number. Also, stores the measured clock time, temperature, humidity, A/D value of
RC-ADC, and corrected baud rate count value in EEPROM.
(*) ”1-sec intervals” here means that the time from the end of the first measurement of the temperatue and humidity to
the start of the next measurement is 1 second. In this sample program, a measurement of the temperature and humidity
takes about 1.72 second. Therefore, time from the start of the first measurement to the start of the next measurement is
about “1.72 + 1 = 2.72” second.
4.9.1.
State Transition
Figure 4-5
State Transition Diagram (RC-ADC measurement )
109
ML610Q400 Series
Sample Program AP Notes
State
RC-ADC conversion
that is performed at
1-sec intervals is being
stopped
RC-ADC conversion
that is performed at
1-sec intervals is being
activated
RC-ADC conversion
results in EEPROM are
being transmitted
RC-ADC conversion
results in EEPROM are
being cleared
Description
Enters this mode immediately after mode transition.
A short S1 key press changes the channel.
A short S2 key press starts RC-ADC conversion.
A short S3 key press transmits the RC-ADC conversion results stored in EEPROM after the
baud rate correction.
A long S3 key press clears the RC-ADC conversion results stored in EEPROM.
A long S4 key press makes a transition to operating mode select mode.
Performs RC-ADC measurement of the channel 1 and channel 2 at 1-sec intervals and
corrects baud rate.
Displays the conversion results in the “text display” area of the LCD as a hexadecimal
number.
Displays the temperature or humidity calculated from the conversion results in the “text
display” area of the LCD as a decimal number.
Stores the measured clock time, conversion results, temperature, humidity and corrected
baud rate in EEPROM. If EEPROM is full (100 data items), a music tune is output.
A short S2 key press stops RC-ADC conversion.
When transmission of all data has been completed, a melody is output and a transition is
made to the “RC-ADC conversion performed at 1-sec intervals is being stopped” state.
A short S3 key press stops transmission and makes a transition to the “RC-ADC conversion
performed at 1-sec intervals is being stopped” state.
Upon completion of clearing of all data, a transition is made to the “RC-ADC conversion
performed at 1-sec intervals is being stopped” state.
Any key operation is ignored during clearing.
110
ML610Q400 Series
Sample Program AP Notes
4.9.2.
Description of LCD Display
R
C
-
1
5
0
0 : 0
.
0 : 0
0
0
0
°C
Figure 4-6
R
C
2
5
5
When Channel 1 Selected
2
3 : 5
F
.
F
9 : 5
F
F
9
F
F
%
Figure 4-7
Name
Mode display
Clock time display
Text display
4 digits on the left side:
6 digits on the right side:
Other digits:
Temperature/Humidity
symbol display:
When Channel 2 Selected
Content to be displayed
Displays “RC1 ” or “RC2 ” depending on the selected channel.
Displays the time elapsed after activation. The displayable time range is in the range of
“ 0:00:00” to “23:59:59”. Only the digits of hours are zero-suppressed.
Performs display as described below and performs zero-suppression.
When “RC1 “ is selected:
Displays the temperature calculated from the RC-ADC conversion results. If the
temperature is a negative value, “−” is displayed at the digit one digit before the
significant digit. Displayable temperature values are in the range of “−50.0” to “105.0”.
When “RC2 “ is selected:
Displays the humidity calculated from the RC-ADC conversion results. Displayable
temperature values are in the range of “20” to “100”. If the temperature is in the range
that the humidity can not measured (that is, lower than 0 degrees centigrade or higher
than 50 degrees centigrade), “− −” is displayed.
Displays the RC-ADC conversion results as a hexadecimal number. Displays in the
range of”
0” to “FFFFFF”.
Pads them with spaces.
When “RC1 “ is selected, the “°C” symbol lights up. When “RC2 “ is selected, the “%”
symbol lights up.
111
ML610Q400 Series
Sample Program AP Notes
4.9.3.
Description of UART Display
RC 00:00:01 RC1 CNT= 616A4 20.0[C] xx.x[F] RC2 CNT= 616A3 20[%] UABRT= 33
RC 00:00:11 RC1 CNT= 5883C –10.0[C] xx.x[F] RC2 CNT= 5883B 20[%] UABRT= 33
...
Content to be displayed
Type of ADC
Measured clock time
Channel No.
Measurement results (count value)
Display data
Displays RC.
Displays in the range of 00:00:00 to 23:59:59.
Displays RC1.
Displays in the range of 000000 to FFFFFF (as a hexadecimal number), after
“CNT=”.
Measurement results (temperature C) Displays in the range of –50.0[C] to 105.0[C] (as a decimal number).
Measurement results (temperature F) Displays in the range of –58.0[F] to 221.0[F] (as a decimal number).
Channel No.
Displays RC2.
Measurement results (count value)
Displays in the range of 000000 to FFFFFF (as a hexadecimal number), after
“CNT=”.
Measurement results (humidity)
Displays in the range of 20[%] to 100[%] (as a decimal number).
Baud rate count value
“Displays in the range of 000 to FFF (as a hexadecimal number), after “UABRT=”.
4.9.4.
Explanation of Key Operation
Key
S1
S2
S3
S4
Short
press
Operation
Switches between the RC-ADC displaying channels.
When channel 1 (temperature) being selected ⇒ Switches to channel 2 (humidity)
When channel 2 (humidity) being selected ⇒ Switches to channel 1 (temperature)
Long
press
Short
press
Long
press
Starts/stops RC-ADC measurement.
Short
press
Starts/stops transmission of the RC-ADC measurement result data stored in EEPROM.
- Other than during data transmission ⇒ Starts data transmission.
- During data transmission ⇒ Stops data transmission.
Long
press
Short
press
Long
press
No effect.
No effect.
Clears all the RC-ADC measurement result data stored in EEPROM.
No effect.
Makes a transition to operating mode select mode.
112
ML610Q400 Series
Sample Program AP Notes
4.10.
UART Communication Mode
Performs UART reception until a terminating character (\r) is received. After receiving a terminating character (\r),
transmits the received data as is via UART. However, if 128 bytes are received before receiving a terminating character
(\r), starts UART transmission at that point of time.
4.10.1.
State Transition
Makes a transition to
operating mode select mode
Long S4
press
Mode transition
Short S2
press or
framing error
Correction
complete
UART reception wait
Baud rate correction being
made
'\r' received
Transmission
or
complete
128 bytes received
UART transmission being
performed
Figure 4-8
State
UART reception wait
UART transmission
being performed
Baud rate correction
being made
State Transition Diagram (UART communication)
Description
Enters this mode immediately after mode transition.
Displays the value currently set in the UART baud rate register in the “text display” area of
the LCD.
Upon receiving ‘\r’ or 128 bytes, starts transmission of the received data and makes a
transition to the “UART transmission being performed” state.
A short S2 key press or the occurrence of a framing error corrects baud rate.
A long S4 key press makes a transition to operating mode select mode.
When all the received data has been transmitted, makes a transition to the “UART
reception wait” state.
No receive operation is performed during transmission.
When baud rate correction is finished, displays the already corrected UART baud rate
register value as a hexadecimal number in the “text display” area of the LCD. Then, outputs
a completion message via UART and makes a transition to the “UART reception wait”
state.
During baud rate correction, because UART is stopped in that period, no receive operation
is performed.
113
ML610Q400 Series
Sample Program AP Notes
4.10.2.
Description of LCD Display
C
O
M
2
3 : 5
9 : 5
F
Name
Mode display
Clock time display
Text display
Temperature symbol display
4.10.3.
4.10.4.
Description of UART Display
S1
S2
S3
S4
Display Data
Displays the data received from the PC as is.
Explanation of Key Operation
Key
Short
press
Long
press
Short
press
Long
press
Short
press
Long
press
Short
press
Long
press
F
F
Content to be displayed
Displays “COM ”.
Displays the time elapsed after activation in the range of “ 0:00:00” to “23:59:59”.
Only the digits of hours are zero-suppressed.
Displays the value that has been set in the UART baud rate register as a
hexadecimal number. Displays in the range of “
0” to
“
FFFF”.
The “°C” symbol goes off.
abcdefg
abcdefg
12345678901234567890
12345678901234567890
...
Content to be displayed
Echo back
F
9
Operation
No effect.
No effect.
Performs baud rate correction.
No effect.
No effect.
No effect.
No effect.
Makes a transition to operating mode select mode.
114
ML610Q400 Series
Sample Program AP Notes
4.11.
Stopwatch Mode
The stopwatch mode allows executing a stopwatch function, which can perform clocking in centiseconds and displays
measured time on the LCD.
4.11.1.
State Transition
Figure 4-9
State
STOP
RUN
SPLIT
State Transition Diagram (Stopwatch Mode)
Description
Enters this mode immediately after mode transition.
Display the time that has been measured in the “clock time display” area of the LCD.
A short S1 key press starts clocking and makes a transition to the RUN state.
A short S2 key press clears the measured time.
A long S4 key press makes a transition to the operating mode select mode. The mode of
the system clock is switched to high-speed mode before the transition to the operating
mode select mode.
Performs clocking in 1/100-second increments.
A short S1 key press stops clocking and makes the transition to the STOP state.
A short S2 key press display the SPLIT time to make a transition to the SPLIT state.
Makes a transition to the RUN state after a lapse of 10 seconds.
A short S1 key press makes the transition to the STOP state.
A short S2 key press updates the SPLIT time.
115
ML610Q400 Series
Sample Program AP Notes
4.11.2.
Description of LCD Display
C
H
R
0 : 0
0 : 0
0
8
Name
Mode display
Clock time display
Content to be displayed
Displays “CHR ”.
Displays the measured clock time in the range of “ 0:00:00” to “59:59:99”
(“minute: second: 1/10 sec, 1/100 sec”). Only the digits of minutes are
zero-suppressed.
During measurement, display is updated at 32 Hz for the 1 /10 sec and 1/100 sec digits. As for the ones digit of seconds
and higher, display is updated every second.
Text display
The 1/1000 sec digit is displayed when the compile option
(_CHRONO_DSP_REG) is enabled.
Temperature symbol display
The “°C” symbol goes off.
4.11.3.
Description of UART Display
No UART display is performed.
4.11.4.
S1
S2
S3
S4
Explanation of Key Operation
Key
Short
press
Long
press
Short
press
Long
press
Short
press
Long
press
Short
press
Long
press
Operation
Starts/stops clocking.
No effect.
Displays the SPLIT time or clears the measured time.
No effect.
No effect.
No effect.
No effect.
Makes the transition to operating mode select mode.
116
ML610Q400 Series
Sample Program AP Notes
4.12.
UART Data Formats
The following subsections show the UART transmission data formats in SA-ADC measurement mode, RC-ADC
measurement mode, and UART communication mode.
4.12.1. SA-ADC Measurement Result Transmission Data Format
Table 4-2 shows the data format for UART transmission in SA-ADC measurement mode.
Table 4-2 SA-ADC measurement result transmission data format
Offset
Size
(byte)
0
2
3
4
6
7
9
10
12
13
18
21
22
28
2
1
1
2
1
2
1
2
1
5
3
1
6
3
Type of ADC
Channel No.
Space
Hour data
:
Minute data
:
Second data
Space
SADR=
A/D value
Space
UABRT=
BRT value
“SA”
“1” or “2”
“”
“00” to “23”
“:”
“00” to “59”
“:”
“00” to “59”
“”
“SADR=”
“000” to “FFF”
“”
“UABRT=”
“000” to “FFF”
31
1
Line feed
“\r”
Total
32
Content of data
Value of data
Remarks
Insert a space as a data delimiter.
Insert a colon “:” as a clock-time delimiter.
Insert a colon “:” as a clock-time delimiter.
Insert a space as a data delimiter.
Insert a space as a data delimiter.
Insert a linefeed code to indicate the
termination of data.
* Use text data for the value of data.
117
ML610Q400 Series
Sample Program AP Notes
4.12.2. RC-ADC Measurement Result Transmission Data Format
Table 4-3 shows the data format for UART transmission in RC-ADC measurement mode.
Table 4-3 RC-ADC Measurement Result Transmission Data Format
Offset
Size
(byte)
0
2
3
5
6
8
9
11
12
15
16
2
1
2
1
2
1
2
1
3
1
4
Type of ADC
Space
Hour data
:
Minute data
:
Second data
Space
Channel No.
Space
CNT=
20
6
A/D value
26
27
32
35
36
41
44
45
48
49
1
5
3
1
5
3
1
3
1
4
Space
Temperature(C)
°C
Space
Temperature(F)
F
Space
Channel No.
Space
CNT=
53
6
A/D value
59
60
63
66
67
73
1
3
3
1
6
3
Space
Humidity
%
Space
UABRT=
BRT value
“RC”
“”
“00” to “23”
“:”
“00” to “59”
“:”
“00” to “59”
“”
“RC1”
“”
“CNT=”
“000000” to
“FFFFFF”
“”
-50.0 to 105.0
“[C]”
“”
-50.0 to 105.0
“[F]”
“”
“RC2”
“”
“CNT=”
“000000” to
“FFFFFF”
“”
“020” to “100”
“[%]”
“”
“UABRT=”
“000” to “FFF”
76
1
Line feed
“\r”
Total
77
Content of data
Value of data
Remarks
Insert a space as a data delimiter.
Insert a colon “:” as a clock-time delimiter.
Insert a colon “:” as a clock-time delimiter.
Insert a space as a data delimiter.
Insert a space as a data delimiter.
Insert a space as a data delimiter.
Insert a [C] as the unit of temperature.
Insert a space as a data delimiter.
Insert a [F] as the unit of temperature.
Insert a space as a data delimiter.
Insert a space as a data delimiter.
Insert a space as a data delimiter.
Insert a [%] as the unit of humidity.
Insert a space as a data delimiter.
Insert a linefeed code to indicate the
termination of data.
118
ML610Q400 Series
Sample Program AP Notes
4.12.3. Data Format in UART Communication Mode
Table 4-4 shows the UART transmission data format used for baud rate adjustment.
Table 4-4 Baud Rate Adjustment Result Transmission Data Format
Offset
Size
(byte)
Content of data
Value of data
0
1
M or A
“M” or “A”
1
2
8
1
6
3
Space
UABRT=
BRT value
“”
“UABRT=”
“000” to “FFF”
11
1
Line feed
“\r”
Total
12
Remarks
M: Manual (manual operation by a short S2
press)
A: Auto (automatic operation by a framing
error)
Insert a space as a data delimiter.
Insert a linefeed code to indicate the
termination of data.
119
ML610Q400 Series
Sample Program AP Notes
4.13.
EEPROM Memory Map
The memory map of EEPROM in the sample program is shown below.
Address
0x0000
to
0x000B
0x000C
to
Area name
Size
Management information storage area
12 bytes
SA-ADC measurement result storage
area
16378 bytes
(for 1819 data items)
RC-ADC measurement result storage
area
16378bytes
(for 1023 data items)
0x4005
0x4006
to
0x7FFF
* Two measurement result storage areas are allocated by separating the area excluding the management information
storage are into two half and half.
Note:
In the sample program, the number of data items that can be stored in the SA-ADC measurement storage area or
RC-ADC measurement storage area is a maximum of 100.
4.13.1. Management Information Storage Area
Management information is stored in the following data format.
Table 4-5
Offset
Size
(bytes)
0
8
9
2
11
2
Total
12
Management Information Storage Area Storage Data Format
Content of data
Signature
The number of
SA-ADC measurement
result data items that
have been stored
The number of
RC-ADC measurement
result data items that
have been stored
Value of data
Remarks
“U8Sample”
ASCII data
0 to 65535
Binary data
0 to 65535
Binary data
120
ML610Q400 Series
Sample Program AP Notes
4.13.2. SA-ADC Measurement Result Storage Area
SA-ADC measurement results are stored in succession in the following data format. In the sample program, the number
of data items that can be stored in the SA-ADC measurement storage area or RC-ADC measurement storage area is a
maximum of 100.
Table 4-6 SA-ADC Measurement Result Storage Data Format
Offset
Size
(bytes)
0
1
Type of ADC
0
1
2
3
4
5
7
1
1
1
1
2
2
Channel No.
Hour data
Minute data
Second data
A/D value
BRT value
1 to 2
0 to 23
0 to 59
0 to 59
0 to 0xFFF
0 to 0xFFF
Total
9
Content of data
Value of data
Remarks
* Use binary data for the value of data.
4.13.3. RC-ADC Measurement Result Storage Area
SA-ADC measurement results are stored in succession in the following data format. In the sample program, the number
of data items that can be stored in the RC-ADC measurement storage area or RC-ADC measurement storage area is a
maximum of 100.
Table 4-7 RC-ADC Measurement Result Storage Data Format
Offset
Size
(bytes)
0
1
2
3
4
1
1
1
1
3
Type of ADC
Hour data
Minute data
Second data
A/D value (CH1)
1
0 to 23
0 to 59
0 to 59
0 to 0xFFFFFF
7
2
Temperature
−500 to 1050
9
12
14
3
2
2
A/D value (CH2)
Humidity
BRT value
0 to 0xFFFFFF
20 to 100
0 to 0xFFF
Total
16
Content of data
Value of data
* Use binary data for the value of data.
121
Remarks
Value ten times the temperature value is
stored.
Revision History
ML610Q400 Series
Sample Program AP Notes
Revision History
Page
Edition
1
2
3
Date
June 26, 2009
January 27, 2010
April 16, 2010
Previous
Edition
–
Current
Edition
–
5
5
6
6
25
25
92
92
99
99
3-4
5
–
3-4
5-6
7-9
99
102
R–1
Description
lnitial edition
Option setting about assembler control in build
procedure is added.
The port, which is connected to WP pin of I2C
EEPROM in the circuit diagram, is corrected.
Description about the resistance mesurement
method, which is used by the temperature
calculation module, is corrected.
Note about the port function selection jumper
switch setting when using UART is added.
The firmware virsion number, displayed in LCD, is
updated.
List of Folders and Files is updated.
Build procedure is updated.
Description of Restrictions is added.
The firmware virsion number, displayed in LCD, is
updated.