Home
RTC - Rohm
Contents
1. Build result output folder UART baud rate correction module folder Clock control module folder General purpose function module folder Interrupt control module folder LCD display control module folder Sample program main folder UART state control module folder Real time clock module folder Time base counter control module folder Timer control module folder UART communication control module folder Description of compile options Project file for large model MCU Project file for large model MCU 1 3 Build Procedure Start IDEUS 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 Rtc Sample Small PID In the case of large model the project file is U8 Rtc Sample Large PID Correspondence of MCU and PID file is shown below Table 1 1 Correspondence of MCU and PID file U8 Rte Sample Small PID U8 Rte Sample Large PID ML610Q431 432 ML610Q421 422 ML610Q411 412 415 ML610Q482 Supported MCU ML610Q435 436 In the default setting ML610Q431 is set as the target MCU If your target MCU 1s different follow the procedure below to change the setting 1 Select the menu Project gt Options gt Compiler assembler 2 In the displayed window select the target MCU from the Target microcontroller list in the General tab 3 Remove the st
2. Main Routine Set alarm 0 rtc setAlarmO function y Update date and clock time rtc_updateTime function When the current time reaches Alarm O callback processing the time of alarm 0 callback function callback function is executed y Obtain the alarm 0 setting rtc getAlarmo0 function Figure 2 5 Alarm O Setting Procedure Software RTC Main Routine 1 Set alarm 0 gt Set date and clock time using the rtc_setAlarm0 function OD Minute data 0 59 Hour data 0 23 Day of the week data 1 7 Address of callback function gt If you do not use the day of the week data as comparison data of alarm 0 set 0x00 as its data For example in the case of setting 8 30 in the morning to alarm 0 set 0x00 to the day of the week data then set s hour and 30 minute to the hour and minute data respectively 2 Update date and clock time gt Update the current date and clock time by calling rtc_updateTime function gt If the current time reaches the time that is set to alarm 0 day of the week hour minute when the second of current time overflows from 59 to 00 and the minute is raised up the callback function specified in above Set alarm 0 rtc_setAlarm0 function is executed 3 Obtain the alarm 0 setting gt Obtain the current alarm 0 setting data day of the week hour minute address of callback functio
3. 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 Table of Contents E OVERVIEL Oss su asda rr ie pao a a a a eNotes ORE SR ENCE RUNS a TERR TINT a 1 1 1 SOFTWARE CONFIGURATION sais rica A ce cot acc ead sea Racca peed a coded O AR A SO DOR Da ER ate 2 1 2 EIST OP FOLDERS AND FILES cs rs PO A acts A id e A acts AE 3 TS BUILDIPROCEDURE iis cise ate O dene Rice ate ccd et eel Bech Cate oad eee baie eek 4 1 4 PRES TRIG TIONG sa ese E NI A a anced RR O ad dete heer aces te Dad Dea A cases 5 2 DESCRIPTION OF FUNCTIONAL MODULES ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccecces 7 Ee Ea BD 0 E cine nee even ven ta eevee ne SO ee Pee ee Re eee ene EAE nO ee re 7 3 DESCRIPTION OF THE SAMPLE PROGRAM 2 cecscccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccoes 17 Silks OPERATONICONDITIONS atari cules Sina ada ie natok A a beausaange nates Sd a aa Dn 17 Bee FUNCTION OVERVIEW us is iar isa cen
4. Correction Module and UART Communication Control Module in the ML610Q400 Series Sample Program AP Notes for Sensor Mesurement Application 18 3 4 LCD Panel Image This subsection describes the LCD panel configuration 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 This sample program assumes that the LCD panel is equipped with the display allocation function Day of the week Clock time 01 2 39 19 9 9 2 009 1220311 Vear Month and day Name Content to be displayed Day of the week Displays day of the week from Monday 1 to Saturday 7 that corresponds to current date year month day Clock time Displays the current time in 24 hour format Year Displays current year Upper place of year is fixed to 20 Month and day Displays current month and day These values are not zero suppressed 19 3 5 UART Data Formats In this sample program if the macro OUTPUT UART is defined th
5. Manual MACU8 Assembler Package User s Manual e CCU8 User s Manual e CCU8 Programming Guide CCU8 Language Reference DTU8 User s Manual IDEU8 User s Manual e uEASE User s Manual uEASE Connection Manual ML610Qxxx e FWuEASE Flash Writer Host Program User s Manual LCD Image Tool User s Manual Tel Software Configuration Figure 1 1 shows the software configuration Sample Program y y y y v v RTC LCD UART Behe Timer Clock Module Module Module Module Module Module Software vy y v v v v v Hardware RTC LOD UART Timer Clock Driver U8 internal function External components y y LCD RS 232C panel connector ML610Q400 Series Demo Board 7 PC Communication software Figure 1 1 Software Configuration 1 2 List of Folders and Files The folders and the files are as listed below ECO output hex Ltst obj prn adjustBaudrate adjustbaudrate c adjustBaudrate h CLO Kh Clock sSsysrune c Clock SysSiune lt h US Sample tbc mcu_ large L mcu h meu small L mcu h main c main h S610431SW asm S6104351W asm output mare OUTDUL uar tro output uartan E rtc h EDOS o LOC timer c uarts tarten readme txt US REG Sample Large PID US Rte Sample smallsPID
6. because the number of SEG pin that is connected to LCD panel is not enough 2 Frequency measurement mode by hardware is not available on ML610Q415 because it does not have low speed crystal oscillation clock 3 For the details of these modules please see the ML610Q400 Series Sample Program AP Notes For Sensor Mesurement Application 1 4 2 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 64segx4com pins at least The number of COM SEG pin that LCD driver in each MCU supports is listed m parenthesis ML610Q43X All area can be displayed ML610Q431 64segx16com ML610Q432 64segx24com ML610Q42X Only the area of and O can be displayed ML610Q421 50segx8com ML610Q422 5S0segx16com ML610Q41X Only the area of and can be displayed ML610Q411 36segx4com ML610Q412 44segx4com ML610Q415 36segx4com ML610Q48xX All area can not be displayed because ML610Q48X does not have LCD driver a TTT TTT x o o O ot Peral kc oo ni zi 2 2 Description of Functional Modules 2 1 RTC Module This sample program provides two methods to realize the real time clock RTC One method 1s the hardware RTC and another is the software RTC The hardware RTC is enabled by default The software RTC is enabled when the macro SOFTWA
7. 415 ML610Q421 422 ML610Q482 3 3 State Transition The following shows the state transision diagram of this sample program Power on Reset by RESET_N aed or reset by WDT overflow Initialization a 3 y Wait N Complete Display A lapse of 1 sec Update time Display date and clock time 2 E Figure 3 1 State Transition Diagram main function 17 State Description O S This state is wait sate for the clock time update When the 1 sec interval interrupt occurs It transits to Display date and clock time state after update date and clock time Display date and This state is the state for displaying the updated date and clock time Elock tme If the macro OUTPUT UART is defined the date and clock time data is transmitted via UART not displayed on LCD panel About the operation in transmitting via UART In this case it is necesary to correct UART baud rate by using UART Baud Rate Correction Module Therefore the state internally transits as follows A lapse of 1 sec Update time v eval E date and clock time Correct baud rate Complete correction y Transmit via UART S Complete transmitting e vy To Wait state Figure 3 2 Internal transition in Display date and clock time state when use UART About the procedure for correction of baud rate and UART communication please see the section UART Baud Rate
8. 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 SOFTWARE RTC OUTPUT UART Please define if you want to send the data of time and date via UART For ML610Q41X series MCU FREQ TIMER MODE 0 or 1 _SOFTWARE RTC OUTPUT UART Select the menu Project gt 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 1 4 Restrictions 1 4 1 About Available Functional Modules In the functional modules that compose this sample program 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 Supported MCU ML610Q43X ML610Q42X ML610Q41X O x x ML610Q48X RTC Control Hardware RTC Module Software RTC LCD Display Control Module 3 ae q Functional UART Communication Control Module 3 Pg modules OD DO DE Timer Control Module 3 O O Clock Control Module 3 Ce o a d a o Available x Not available O 1 All display area of LCD panel can not be available
9. RE RTC is defined The software RTC can realize the RTC function even if MCU doesn t have the RTC function About MCU that has the real time clock RTC function The following shows the configuration of the RTC in MCU To To Data bus Control circuit Alarm 0 1 ALOINT ALTINT RTCCON Control circuit Alarm interrupt Periodic interrupt control RTCINT Periodic interrupt T2HZ Operation Day counter T1HZ control Time counter WEEK SEC MIN HOUR DAY MON YAER Data bus RTCCON Real time clock control register Figure 2 1 Configuration of the real time clock For details refer to the chapter Real Time Clock of the User s Manual for your target MCU About MCU that does not have the real time clock RTC function The RTC function is realized by the software RTC The following shows the functional block diagram of the software RTC About the detail of each function please see the secton 2 1 1 Function Overview Application gt Set time rtc_setTime function v Current time data Get time lt rtc_getTime function lt Set Alarm 0 Alarm 1 gt rtc_setAlarm0 rtc_setAlarm 1 function y Alarm 0 Alarm 1 setting data Get the setting of Alarm 0 Alarm 1 lt rtc_getAlarmO rtc_getAlarm 1 function Update time rtc_updateTime function pb Count date an
10. SEMICONDUCTOR SQ003116E002 ML610Q400 Series Sample Program AP Notes For RTC 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 parti
11. a Sac O gana dE a DO Sachets tua SO ROO GR DOR Da RD cai Cain Cosan a E a 17 dd STATE RANSON us ndo laser o gd a Si las po a Re a a aa ca 17 Sd EGO PANELIMAGE ss nisso a sao Rd SA O aa a card de cao 19 So VAR TDATAFORMAI ss ada stn ceca detect da a a a ae a a Ea 20 As APPENDIX sc siiiba ess codiusas nda Casca so dis UN Gen aUds o God isa sado Gean a CICLEC da N O DNA DCL Todas asi nan and L Doce O a ga das edita 21 dd COIRANELSPECIFICATONOS e eia ii di AA aA 21 1 Overview This document describes the application programming notes hereafter called the AP notes arranged to help customers develop software that performs time measurements on the ML610Q400 Series MCU hereafter called the MCU 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 4 Related Documents The following are the related documents Read them as required e ML610Q400 Series Sample Program AP Notes For Sensor Mesurement Application ML610Q400 Series Sample Program API Manual e ML6100431 ML610Q432 User s Manual e ML610Q411 ML610Q412 ML610Q415 User s Manual e ML6100421 ML610Q422 User s Manual e ML610Q482 User s Manual e ML610Q435 ML610Q436 User s Manual ML610Q400 Series Demo kit Hardware User s Manual e nX U8 100 Core Instruction
12. artup 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 gt Options gt Compiler assembler gt Macro tab In the displayed window define the macro like following name _ML610Q4XxX 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 Ifnecessary 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 or SOFTWARE RTC OUTPUT UART Please define if you want to send the data of time and date via UART For ML610Q42X series MCU LCD TYPE 1 FREQ TIMER MODE 0 or 1 SOFTWARE RTC OUTPUT UART Please define if you want to send the data of time and date via UART For ML610Q41X series MCU LCD TYPE 0
13. d time Alarm control 4 y y Alarm O callback Alarm 1 callback Alarm O Application processing Alarm 1 Application processing Figure 2 2 Functional block diagram of the software RTC 2 1 1 Function Overview The RTC module mainly sets the settings for the counting functions of the real time clock of the MCU Table 3 20 lists the RTC module APIs that the sample program uses Table 2 1 List of APIs Function name Description Hardware Software RTC RTC rtc_setTime function Sets date year month day day of the week and clock time hour minute second rtc_getTime function Obtains date year month day day of the week and clock time hour minute second Starts RTC operation Stops RTC operation interrupts ae rtc setAlarml function Sets Alarm 1 month day hour minute rtc_getAlarm0 function Obtains the setting of Alarm O day of the week hour minute rtc getAlarml function Obtains the setting of Alarm 1 month day hour minute rtc updateTime function Updates date year month day day of the week and clock time hour minute second rtc_calcWeekday function Calculates day of the week 1 Not available for the hardware RTC 2 No need to use for the software RTC These functions do not execute any processing in the software RTC 2 1 2 Operating C
14. e date and clock time data is transmitted via UART not displayed on LCD panel The following shows the UART transmission data formats Table 3 1 UART transmission data format O0 4 Yeardata 2000 2099 4 1 Space Insert a space as a data delimiter 5 2 Monthdata ON 8 2 Daydata _ Jrott rar EO 10 1 Spase tro Inserta space as a data delimiter 1 Day ofthe week data 1 7 From Monday 1 to Saturday 7 _ 1 Space Jinsertaspaceasadatadelimiter IT Insert a colon as a clock time delimiter 1 C o ee e E O 00 59 Insert a colon as a clock time delimiter 00 59 SE D4 4 eee gp Insert a linefeed code to indicate the Toa oo Use text data for the value of data 20 4 Appendix 4 1 LCD Panel Specifications 16 segment characters The 4 digits on the upper part of the sane 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 Figure 4 1 Layout of the LCD Panel Table 4 1 Pin Assignments COM SEG aca E DENE iC MONT a aa 2b et a aa ap tan ak a at oF ua at al ea ee a at K LHH HE A EM ah EOL La of em Po a an an AM YEAR SE ZT ELE LZ EIEAEIEIEIES fae a arhat fa 337 3B 39 ad at ae a a 4 am pi a rs wna e ma TE
15. edure for setting date year month day day of the week and clock time hour minute second using the software RTC function in RTC module Main Routine Calculate day of the week rtc_calcWeekday function Set date and clock time rtc_setTime function y Update date and clock time rtc_updateTime function y Obtain date and clock time of RTC rtc_getTime function Figure 2 4 Date and Clock Time Setting Procedure Software RTC 13 Main Routine 1 Calculate day of the week gt Calculate day of the week using the rtc_calcWeekday function 2 Set date and clock time gt Set date and clock time using the rtc_setTime function Second data 0 59 Minute data 0 59 Hour data 0 23 Day of the week data caluculated value by rtc_calcWeekday function Day data 1 31 Month data 1 12 Year data 0 99 9008000 3 Update date and clock time gt Update the current date year month day day of the week and clock time hour minute second by calling rtc_updateTime function at regular intervals every second 4 Obtain the date and clock time of RTC gt Obtain the current date year month day day of the week and clock time hour minute second using the rtc_getTime function 14 2 1 3 3 Alarm O Setting Procedure Software RTC The figure below shows the procedure for setting alarm 0 using the software RTC function in RTC module
16. es 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
17. n using the rtc_getAlarm0 function 15 2 1 3 4 Alarm 1 Setting Procedure Software RTC The figure below shows the procedure for setting alarm 1 using the software RTC function in RTC module Main Routine Set alarm 1 rtc_setAlarm1 function y Update date and clock time rtc_updateTime function When the current time reaches Alarm 1 callback processing the time of alarm 1 callback function callback function is executed v Obtain the alarm 1 setting rtc_getAlarm1 function Figure 2 6 Alarm 1 Setting Procedure Software RTC Main Routine 1 Set alarm 1 gt Set date and clock time using the rtc setAlarml function OD Minute data 0 59 Hour data 0 23 Month data 1 12 Day data 1 31 Address of callback function gt If you do not use the month and day data as comparison data of alarm 1 set 0x00 as its data For example in the case of setting 8 30 in the morning to alarm 1 set 0x00 to the month and day data then set 8 hour and 30 minute to the hour and minute data respectively 2 Update date and clock time gt Update the current date and clock time by calling rtc_updateTime function gt If the current time reaches the time that is set to alarm 1 month day hour minute when the second of current time overflows from 59 to 00 and the minute 1s raised up the callback function specified in ab
18. ng date year month day day of the week and clock time hour minute second using the hardware RTC function in RTC module Main Routine Stop RTC operation rtc_stop function Set date and clock time in RTC rtc_setTime function Reset low speed time base counter Start RTC operation rtc start function Obtain date and clock time of RTC rtc_getTime function Figure 2 3 Date and Clock Time Setting Procedure Hardware RTC 1 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 gt Stop RTC operation using the rtc stop function gt Set date and clock time using the rtc_setTime function 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 9008000 3 Reset the low speed time base counter gt 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 gt Start RTC operation using the rtc start function 5 Obtain the date and clock time of RTC gt Obtain the current date year month day day of the week and clock time hour minute second using the rtc_getTime function 12 2 1 3 2 Date and Clock Time Setting Procedure Software RTC The figure below shows the proc
19. onditions 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 00 99 Month values settable with the date counting function 01 12 Day values settable with the date counting function 01 31 Day of the week values settable with the date counting function 1 7 Hour values settable with the clock time counting function 00 23 Minute values settable with the clock time counting function 00 59 Second values settable with the clock time counting function 00 59 Year range in which day of the week can be calculated 2000 2099 Note The parameters used in each of the APIs above must be specified by binary code decimal BCD values except for day of the week m Day of the week which is calculated by rtc_calcWeekday function is represented by the following values Sunday 1 Monday 2 Tuesday 3 EF I m The timing that the alarm occurs is different between the hardware RTC and the software RTC gt Hardware RTC Alarm interrupt ALOINT ALIINT gt Software RTC Main routine rtc_updateTime function call 10 21 3 Sample of Use The subsection below describes the procedure for setting date and clock time using RTC module 2 1 3 1 Date and Clock Time Setting Procedure Hardware RTC The figure below shows the procedure for setti
20. ove Set alarm 1 rtc setAlarml function is executed 3 Obtain the alarm setting gt Obtain the current alarm 1 setting data month day hour minute address of callback function using the rtc_getAlarm1 function 16 3 Description of the Sample Program Sala Operation conditions 1 System clock e SYSCLK HSCLK RC oscillation mode 500 kHz 2 Timer e Channels 0 16 bit mode operating clock LSCLK e Overflow interval 0 015625 second It is multiplied by 64 in dorder to make 1 second interval 3 LCD driver e Bias voltage multiplying clock 2 kHz Bias 1 4 bias Duty 1 4 duty e Frame frequency 73 Hz 4 UART e 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 About the other conditions and the peripheral circuit please see ML610Q400 Series Demo kit Hardware User s Manual 3 2 Function Overview This sample program displays date and clock time on LCD panel If the macro OUTPUT _ UART is defined the date and clock time data is transmitted via UART not displayed on LCD panel Date and clock time is updated every second from the pre defined date and clock time In the case of the following MCU OUTPUT UART is defined by default ML610Q411 412
21. ren ie a fr aa LaF ia Pa aaa Dae tie Pec be Lp pas i Pie Lie bee Lia bec bat Pac ae GT eg TT eA o eo o o ut mm atorl a ets rsel st S 5a 59 oo be ba oa 65 66 a ob ea 70 TI Fe COMI SA 15F 16A 16F THA 177 IBA 15 eco ia 1 ua anr a fe een eer YS 1h 5E 156 n 166 176 176 168 165 4 198 1936 20 etc e1 21 zes zen K v Le TEALA ARRAES E BIC BIE a FARAN COMA ISH SD WH 160 17H 170 164 160 Ce 19H 190 20H 200 EENEI 220 FA ci LL Specifications of Operation Clock for bias generation circuit voltage multiplication 1 16 LSCLK 2 kHz Bias of the bias generation circuit 1 4 Duty 1 4 duty Frame frequency 73 Hz 21 Revision History Revision History Date 2009 6 26 2010 1 27 2010 4 16 Page Previous Edition Current Edition 3 4 5 6 23 Description Initial Edition Update edition number to match with Japanese edition List of Folders and Files is updated Build procedure is updated Description of Restrictions is added
Download Pdf Manuals
Related Search
Related Contents
Star Micronics SP298MD42-G 安全保障輸出管理の事前チェックリストの記入方法 Copyright © All rights reserved.
Failed to retrieve file