Home

RL78/G13 Real-Time Clock

image

Contents

1. Caution For details on the register setup procedures refer to RL78 G13 User s Manual Hardware R01AN0454EJ0200 Rev 2 00 Page 16 of 29 Dec 27 2013 RENESAS RL78 G13 Real Time Clock Specifying the date and time in the format of year month day week hour minute and second e Count registers YEAR MONTH DAY WEEK HOUR MIN and SEC Specify the date and time Symbol YEAR 7 6 5 4 3 2 1 0 00 to 99 BCD code Symbol MONTH 7 6 5 4 3 2 1 0 ojoj o 01 to 12 BCD code Symbol DAY 7 6 5 4 3 2 1 0 0 o 0 to 31 BCD code Symbol WEEK 7 6 5 4 3 Symbol HOUR 2 1 0 7 6 5 4 3 2 1 0 o o 0 to 23 or 1 to 12 21 to 32 BCD code Symbol MIN 7 6 5 4 3 2 1 0 0 0 to 59 BCD code Symbol SEC 7 6 5 4 3 2 1 0 0 to 59 BCD code Caution For details on the register setup procedures refer to RL78 G13 User s Manual Hardware R01AN0454EJ0200 Rev 2 00 Page 17 of 29 Dec 27 2013 RENESAS RL78 G13 Real Time Clock Configuring the alarm interrupt generated by the real time clock e Real time clock control register 1 RTCC1 Configure the alarm match operation Configure the alarm match interrupt Symbol RTCCI 5 4 2 1 7 6 3 0 wae wae o ware re o AWST awar qx 8 Bit 7 WALE Alarm operation control 0 Disables match operation 1 Enables match operation Bit 6 WALIE Alarm interrupt INTRTC function control
2. Arguments struct RTCAlarmValue alarmval Alarm output conditions Return value None Remarks None RO1AN0454EJ0200 Rev 2 00 Page 9 of 29 Dec 27 2013 RENESAS RL78 G13 Real Time Clock Function Name R RTC Interrupt Synopsis Header Declaration Explanation Arguments Return value Remarks RTC interrupt INTRTC processing r cg rtc h interrupt void R RTC Interrupt void Constant period interrupts and alarm interrupts arise from the same interrupt source INTRTC This function makes a distinction between the two types of interrupts An alarm interrupt triggers alarm interrupt processing A constant period interrupt triggers constant period interrupt processing None None None Function Name R RTC Callback Alarm Synopsis Header Declaration Explanation Arguments Return value Remarks Alarm interrupt processing r cg rtc h void RTC Callback Alarm void This function sets P11 to a high level output None None None Function Name RTC Callback ConstPeriod Synopsis Constant period interrupt processing Header r cg rtc h Declaration void RTC Callback ConstPeriod void Explanation This function inverts the P10 output Arguments None Return value None Remarks None RO1AN0454EJ0200 Rev 2 00 Page 10 of 29 Dec 27 2013 RENESAS RL78 G13 Real Time Clock 5 6 Flowcharts Figure 5 1 shows the overall flow of the sample program described in this application note
3. Does not generate interrupts due to an alarm match Generates interrupts due to an alarm match Caution For details on the register setup procedures refer to RL78 G13 User s Manual Hardware R01AN0454EJ0200 Rev 2 00 Page 18 of 29 Dec 27 2013 RENESAS RL78 G13 Real Time Clock 5 6 6 Main Processing Figures 5 7 and 5 8 show the flowcharts for main processing Disable interrupts IE lt 0 Reconfigure RTC R RTC Set Const i PeriodInterruptOn HALFSEC Start operation of RTC RTC Start Disable watch error correction function SUBCUD register 00000000B counter val Structure variable Store clock time in variable in RAM counter val Sec lt 55h e Thursday April 1 2010 15 59 55 Coume M wen A duni counter val Hour lt 15h counter val Week lt 04h counter lt Oth counter val Month 04h counter val Year lt 10h R RTC Set Counter Value counter val Real time clock counter setup Completed Figure 5 7 Main Processing 1 2 R01AN0454EJ0200 Rev 2 00 Page 19 of 29 Dec 27 2013 RENESAS RL78 G13 Real Time Clock alarm val Structure variable Store alarm time in variable in RAM alarm val Alarmwm lt 00h e 16 hours 00 minutes each day alarm val Alarmwh 16h alarm val Alarmww lt FFh Set alarm occurrence time Set Alarm Value alarm val Enable interrupts IE 1 Make transition to HALT mod
4. 2013 RENESAS RL78 G13 5 6 10 Alarm Generation Time Setup Real Time Clock Figure 5 13 shows the flowchart for setting the alarm generation time R_RTC_Set_AlarmValue Disable real time clock alarm match interrupts Disable alarm function Enable alarm match interrupts Set alarm 16 00 each day Activate alarm function Clear real time clock alarm match interrupt request flag Enable real time clock alarm match interrupts return Arguments alarmval Alarmwm alarmval Alarmwh alarmval Alarmww RTCMK bit lt 1 WALE bit lt 0 WALIE bit lt 1 WALE bit lt 1 WAFG bit lt 0 RTCIF bit lt 0 RTCMK bit 0 Figure 5 13 Alarm Generation Time Setup RO1AN0454EJ0200 Rev 2 00 Dec 27 2013 Page 27 of 29 RENESAS RL78 G13 Real Time Clock 5 6 11 RTC Interrupt INTRTC Processing Figure 5 14 shows the flowchart for processing RTC interrupts INTRTC Constant period interrupts and R HTC Interrupt alarm interrupts arise from the same interrupt source No Alarm interrupt has occurred Yes Clear alarm detection status flag WAFG bit lt 0 Set P11 to high level output onstant period interrupt has occurred Yes Clear constant period interrupt status flag RIFG bit lt 0 Invert P10 output a return D Figure 5 14 RTC Interrupt INTRTC Processing R01AN0454EJ0200 Rev 2 00 Page 28 of 29 Dec 27 2013 RENESAS RL78 G13 6 Sample Code
5. Dec 27 2013 RENESAS RL78 G13 Real Time Clock 5 5 Function Specifications This section describes the specifications for the functions that are used in this sample program Function Name RTC Set ConstPeriodInterruptOn Synopsis Constant period interrupt enable Header r cg rtc h Declaration MD STATUS R RTOC Set ConstPeriodInterruptOn enum RTCINTPeriod period Explanation This function configures the constant period interrupt Arguments enum RTCINTPeriod period Constant period interrupt period Return value MD ARGERROR Argument invalid MD OK Setup completed and operation started Remarks None Function Name R RTC Start Synopsis RTC enable Header r cg rtc h Declaration void RTC Start void Explanation This function enables the RTC Arguments None Return value None Remarks None Function Name R RTC Set CounterValue Synopsis RTC counter value change Header r cg rtc h Declaration MD STATUS R Set CounterValue struct RTCCounterValue counterwriteval Explanation This function sets RTC counter values Arguments struct RTCCounterValue Structure for storing count register values counterwriteval Return value MD OK Setup completed Others Setup incomplete or unsuccessful Remarks None Function Name R RTC Set AlarmValue Synopsis Alarm output setup Header r cg rtc h Declaration void R RTC Set AlarmValue struct RTCAlarmValue alarmval Explanation This function configures the alarm interrupt
6. The sample code is available on the Renesas Electronics Website 7T Documents for Reference User s Manual RL78 G13 User s Manual Hardware RO1IUHOI146EJ RL78 Family User s Manual Software RO1USOO15EJ The latest version can be downloaded from the Renesas Electronics website Technical Updates Technical News The latest information can be downloaded from the Renesas Electronics website Website and Support Renesas Electronics Website http www renesas com index jsp Inquiries http www renesas com contact Real Time Clock R01AN0454EJ0200 Rev 2 00 Dec 27 2013 RENESAS Page 29 of 29 REVISION HISTORY RL78 G13 Real Time Clock Description Summary Sep 30 2011 First edition issued Dec 27 2013 Table 2 1 Added e2studio and IAR information Added note Figure 5 2 Fixed typo in function name Figure 5 3 Fixed typo in function name All trademarks and registered trademarks are the property of their respective owners A 1 General Precautions in the Handling of MPU MCU Products The following usage notes are applicable to all MPU MCU products from Renesas For detailed usage notes on the products covered by this manual refer to the relevant sections of the document as well as any technical updates that have been issued for the products 1 Handling of Unused Pins Handle unused pins in accord with the directions given under Handling of Unused Pins in the manual The inpu
7. The option bytes are referenced before the initialization function is called Initialization function hdwinit Note Main processing main Figure 5 1 Overall Flow 5 6 1 Initialization Function Figure 5 2 shows the flowchart for the initialization function Note hdwinit IE System function R Systeminit IE 1 Enable interrupts Figure 5 2 Initialization Function Note low level init function initializes the system in the Workbench IDE Oriented sample code RO1AN0454EJ0200 Rev 2 00 Page 11 of 29 Dec 27 2013 RENESAS RL78 G13 5 6 2 System Function Figure 5 3 shows the flowchart for the system function Real Time Clock C R Systeminit D Disuse peripheral I O redirection function Set up I O ports R_PORT_Create Set up CPU clock R_CGC_Create Initialize RTC R_RTC_Create return Figure 5 3 System Function RO1AN0454EJ0200 Rev 2 00 Dec 27 2013 PIOR register 00000000B RENESAS Page 12 of 29 RL78 G13 Real Time Clock 5 6 3 I O Port Setup Figure 5 4 shows the flowchart for setting up the I O ports Set P11 pin to low level output C gt Figure 5 4 Port Setup Refer to the section entitled Flowcharts in RL78 G13 Initialization Application Note RO1ANO0451EJ0100 for the configuration of the unused ports Note Caution Provide proper treatment for unu
8. pereo eai 7 5 4 Goto Functions cert a eoe iecur ki Dae renun nt Fue ea e re recu 8 bb Function Specifications denti e ead lina bns ed De gabe edad NR Ran dd d uade 9 56 EM CIL L 11 5 644 lInitialization FUMCHOMN cies eee cose tee ke rede edu ar ii 11 BS MEE cV edm 12 SE RCMMIeN SEES 13 5 624 OPU Clock Setup etre pese acabo E erased xa En eeu De geh 14 56 5 RIC Initialization ient see ede cete eel Pe Ros 15 5 6 6 Main Processing uitio erret eben e odes act d bo died 19 5 6 7 RIC Reconfiguration 3 iere dards ei ore ed eae reed adds ated iaa 22 5 6 8 to 23 56 9 RTO Time Set p entr peti sesta rimum nue nested ru as inae oddE 25 5 6 10 Alarm Generation Time Setup ssssssssssssssssseseeeeeee entrent nnns nnne nennen 27 5 6 11 RTC Interrupt INTRTC Processing ssssesesesseeeee eee 28 SEE us 290v dee dee 29 7 Documents for Reference ssssssssssssssesseeeen 29 R01AN0454EJ0200 Rev 2 00 Page 2 of 29 Dec 27 2013 RENESAS RL78 G13 Real Time Clock 1 Specifications This application note shows example settings for using the constant period interrupt function and alarm i
9. product depends on the product s quality grade as indicated below Standard Computers office equipment communications equipment test and measurement equipment audio and visual equipment home electronic appliances machine tools personal electronic equipment and industrial robots etc High Quality Transportation equipment automobiles trains ships etc traffic control systems anti disaster systems anti crime systems and safety equipment etc Renesas Electronics products are neither intended nor authorized for use in products or systems that may pose a direct threat to human life or bodily injury artificial life support devices or systems surgical implantations etc or may cause serious property damages nuclear reactor control systems military equipment etc You must check the quality grade of each Renesas Electronics product before using it in a particular application You may not use any Renesas Electronics product for any application for which it is not intended Renesas Electronics shall not be in any way liable for any damages or losses incurred by you or third parties arising from the use of any Renesas Electronics product for which the product is not intended by Renesas Electronics 6 You should use the Renesas Electronics products described in this document within the range specified by Renesas Electronics especially with respect to the maximum rating operating supply voltage range movement power voltage range heat radia
10. 5 11 and 5 12 show the flowcharts for setting the RTC time R RTC Set CounterValue Initialize status flag Real time clock counter read write mode Arguments counterwriteval Sec counterwriteval Min counterwriteval Hour counterwriteval W eek counterwriteval Day counterwriteval Month counterwriteval Year status MD OK status Variable in RAM RWAIT 1 4 Cycle time of 32 768 kHz signals has Yes _ Active Read write mode Set current time e Second count register 55 seconds e Minute count register 59 minutes e Hour count register 15 hours e Week count register Thursday e Day count register 1st e Month count register April e Year count register 2010 Figure 5 11 RTC Time Setup 1 2 Set status flag to indicate error status MD BUSY 1 SEC register 55H MIN register 59H HOUR register lt 15H WEEK register lt 04H DAY register lt 01H MONTH register lt 04H YEAR register 10H RO1AN0454EJ0200 Rev 2 00 Dec 27 2013 Page 25 of 29 RENESAS RL78 G13 Real Time Clock Restart real time clock count operation RWAIT lt 0 Cycle time of 32 768 kHz signals ha elapsed No Read write mode Active Set status flag to indicate error status lt MD BUSY2 Return status flag C return 5 Figure 5 12 RTC Time Setup 2 2 R01AN0454EJ0200 Rev 2 00 Page 26 of 29 Dec 27
11. 6 21 6887 7858 7898 Renesas Electronics Hong Kong Limited Unit 1601 1613 16 F Tower 2 Grand Century Place 193 Prince Edward Road West Mongkok Kowloon Hong Kong Tel 852 2886 9318 Fax 852 2886 9022 9044 Renesas Electronics Taiwan Co Ltd 13F No 363 Fu Shing North Road Taipei Taiwan Tel 886 2 8175 9600 Fax 886 2 8175 9670 Renesas Electronics Singapore Pte Ltd 80 Bendemeer Road Unit 06 02 Hyflux Innovation Centre Singapore 339949 Tel 65 6213 0200 Fax 65 6213 0300 Renesas Electronics Malaysia Sdn Bhd Unit 906 Block B Menara Amcorp Amcorp Trade Centre No 18 Jin Persiaran Barat 46050 Petaling Jaya Selangor Darul Ehsan Malaysia Tel 60 3 7955 9390 Fax 60 3 7955 9510 Renesas Electronics Korea Co Ltd 11F Samik Lavied or Bldg 720 2 Yeoksam Dong Kangnam Ku Seoul 135 080 Korea Tel 82 2 558 3737 Fax 82 2 558 5141 2013 Renesas Electronics Corporation All rights reserved Colophon 2 2
12. E bit lt 1 e Generate alarm interrupts C return D Figure 5 6 RTC Initialization R01AN0454EJ0200 Rev 2 00 Page 15 of 29 Dec 27 2013 RENESAS RL78 G13 Real Time Clock Enabling supply of clock signals to the RTC e Peripheral enable register 0 PERO Enable supply of clock signals to the real time clock Symbol PERO 7 6 5 4 3 2 1 0 Bit 7 RTCEN Control of input oe to the real time Stops input clock supply Enables input clock supply RTC operation control e Real time clock control register 0 RTCCO Select a time format Set the interval of constant period interrupts Symbol RTCCO 7 6 5 4 3 2 1 0 RTCE o RCLOE o AMPM CT2 ct 0 jj 0o 0 0 J 1 0 0 J 1 Bit 7 RTCE Real time clock operation control 0 Stops the counter operation 1 Starts the counter operation Bit 3 AMPM Selection of 12 24 hour system 0 12 hour system a m and p m are displayed 1 24 hour system Bits 2 to 0 Constant period interrupt INTRTC selection use constant period interrupt function r 0 5 s Synchronized with second count up 1 s same time as second count up ES Once per 1 m second 00 of every minute Once per 1 hour minute 00 and second 00 of every hour 1 0 1 per 1 day hour 00 minute 00 and second 00 of every day 1 1 x per 1 month Day 1 hour 00 a m minute 00 and second 00 of every month
13. RoHS Directive Renesas Electronics assumes no liability for damages or losses occurring as a result of your noncompliance with applicable laws and regulations 9 Renesas Electronics products and technology may not be used for or incorporated into any products or systems whose manufacture use or sale is prohibited under any applicable domestic or foreign laws or regulations You should not use Renesas Electronics products or technology described in this document for any purpose relating to military applications or use by the military including but not limited to the development of weapons of mass destruction When exporting the Renesas Electronics products or technology described in this document you should comply with the applicable export control laws and regulations and follow the procedures required by such laws and regulations 10 It is the responsibility of the buyer or distributor of Renesas Electronics products who distributes disposes of or otherwise places the product with a third party to notify such third party in advance of the contents and conditions set forth in this document Renesas Electronics assumes no responsibility for any losses incurred by you or third parties as a result of unauthorized use of Renesas Electronics products 11 This document may not be reproduced or duplicated in any form in whole or in part without prior written consent of Renesas Electronics 12 Please contact a Renesas Electronics sales office if you have
14. any questions regarding the information contained in this document or Renesas Electronics products or if you have any other inquiries Note 1 Renesas Electronics as used in this document means Renesas Electronics Corporation and also includes its majority owned subsidiaries Note 2 Renesas Electronics product s means any product developed or manufactured by or for Renesas Electronics 5 5 SALES OFFICES Renesas Electronics Corporation http www renesas com Refer to http www renesas com for the latest and detailed information Renesas Electronics America Inc 2880 Scott Boulevard Santa Clara CA 95050 2554 U S A Tel 1 408 588 6000 Fax 1 408 588 6130 Renesas Electronics Canada Limited 1101 Nicholson Road Newmarket Ontario L3Y 9C3 Canada el 1 905 898 5441 Fax 1 905 898 3220 Renesas Electronics Europe Limited Dukes Meadow Millboard Road Bourne End Buckinghamshire SL8 5FH U K Tel 44 1628 651 700 Fax 44 1628 651 804 Renesas Electronics Europe GmbH Arcadiastrasse 10 40472 Dusseldorf Germany Tel 49 211 65030 Fax 49 211 6503 1327 Renesas Electronics China Co Ltd 7th Floor Quantum Plaza No 27 ZhiChunLu Haidian District Beijing 100083 P R China Tel 86 10 8235 1155 Fax 86 10 8235 7679 Renesas Electronics Shanghai Co Ltd Unit 204 205 AZIA Center No 1233 Lujiazui Ring Rd Pudong District Shanghai 200120 China Tel 86 21 5877 1818 Fax 8
15. ate N ESAS APPLICATION NOTE RL78 G13 RO1AN0454EJ0200 Rev 2 00 Dec 27 2013 Real Time Clock Introduction This application note describes the real time clock RTC It shows example settings for using the constant period interrupt function and alarm interrupt function of the real time clock Target Device RL78 G13 When applying the sample program covered in this application note to another microcomputer modify the program according to the specifications for the target microcomputer and conduct an extensive evaluation of the modified program RO1AN0454EJ0200 Rev 2 00 Page 1 of 29 Dec 27 2013 RENESAS RL78 G13 Real Time Clock Contents IEEE E 3 2 Operation Check Conditions sssssssssssssssessseeene enne nennen snnt inrer 4 3 Related Application 4 4 Description of the Hardware 4 14 Hardware Configuration Example sse 5 42 Listot Pins to be Used rera eed oM o fees Exe pe x aed re dne 5 5 Description of the Software ssssssssssssssessse eene 6 5 1 Operation Outline c ien ie ete ie ee eae adele 6 5 2 List of Option Byte Settings cece cecccececeeeceneeeeeeeeeeeeseaeeeeaaeeeeaee sense enne nente nennen inner enne 7 b 9 Listof Comte ints esi
16. e Figure 5 8 Main Processing 2 2 R01AN0454EJ0200 Rev 2 00 Page 20 of 29 Dec 27 2013 RENESAS RL78 G13 Real Time Clock Correcting the watch error e Watch error correction register SUBCUD Correct the watch error by incrementing or decrementing it Symbol SUBCUD 7 6 5 4 3 2 1 0 Poo o o o o jo joj o Bit 7 Setting of watch error correction timing Corrects watch error when the second digits are at 00 20 or 40 every 20 seconds Corrects watch error only when the second digits are at 00 every 60 seconds Bit 6 F6 Setting of watch error correction value Increases by F5 F4 F2 F1 FO 1 x 2 1 For details on the register setup procedures refer to RL78 G13 User s Manual Hardware Caution R01ANO0454EJO200 Rev 2 00 Page 21 of 29 Dec 27 2013 RENESAS RL78 G13 Real Time Clock 5 6 7 RTC Reconfiguration Figure 5 9 shows the flowchart for main processing R_RTC_Set_Const Argument Period PeriodInterruptOn n status MD OK Status fag status Variable in RAM No RTC interrupt interval normal No Reconfigure real time clock Set interval of constant period interrupt to ae 0 5 Set status flag to indicate error Select 24 hour system e Disable 1 Hz output Clear real time clock alarm match RTCIF bit lt 0 interrupt request flag Enable real time clock alarm match RTCMK bit 0 interrupts Retu
17. e after the operating clock signal has become stable When switching the clock signal during program execution wait until the target clock signal has stabilized When the clock signal is generated with an external resonator or from an external oscillator during a reset ensure that the reset line is only released after full stabilization of the clock signal Moreover when switching to a clock signal produced with an external resonator or by an external oscillator while program execution is in progress wait until the target clock signal is stable 5 Differences between Products Before changing from one product to another i e to one with a different part number confirm that the change will not lead to problems The characteristics of MPU MCU in the same group but having different a different part number may differ in terms of the internal memory capacity and layout pattern and other factors which can affect the ranges of electrical characteristics such as characteristic values operating margins immunity to noise and amount of radiated noise When changing to products with a different part number implement a system evaluation test for the given product Notice 1 Descriptions of circuits software and other related information in this document are provided only to illustrate the operation of semiconductor products and application examples You are fully responsible for the incorporation of these circuits software and
18. etup status setup unsuccessful due to counter activation failure 01 RTC COUNTER PAUSE 0x01U Specifies whether to activate or deactivate the real time clock counter Setting Activates the counter RTC_WAITTIME 320U Specifies the wait time about 10 us after switching between activation and deactivation of the real time clock counter 80 RTC ALARM ENABLE 0x80U Specifies whether to enable or disable alarm operation Setting Enables alarm operation _40 RTC ALARM INT ENABLE 0x40U Specifies whether to enable or disable interrupts d due to alarm matching Setting Enables interrupts 10 RTC ALARM MATCH 0x10U Clears the alarm detection status flag 08_RTC_INTC_GENERATE_FLAG 0x08U Clears the constant period interrupt status flag RO1AN0454EJ0200_ Rev 2 00 Page 7 of 29 Dec 27 2013 RENESAS RL78 G13 Real Time Clock 5 4 List of Functions Table 5 3 lists the functions that are used in this sample program Table 5 3 Functions for the Sample Program FuncionName Set ConstPeriodInterruptOn Enables constant period interrupts Start Enables the Set CounterValue Changes the RTC counter value Set AlarmValue Configures the alarm output R Interrupt Processes RTC interrupts INTRTC R_RTC_Callback_Alarm Processes alarm interrupts R_RTC_Callback_ConstPeriod Processes constant period interrupts RO1AN0454EJ0200_ Rev 2 00 Page 8 of 29
19. h uses 2 81 V 2 76 V to 2 87 V Integrated development environment CubeSuite CubeSuite V1 00 01 from Renesas Electronics Corp C compiler CubeSuite CA78KOR V1 20 from Renesas Electronics Corp Integrated development environment e2studio C compiler e2studio e2studio V2 0 1 3 from Renesas Electronics Corp KPIT GNURL78 ELF Toolchain V13 02 from Renesas Electronics Corp Integrated development environment IAR IAR Embedded Workbench for Renesas RL78 V1 30 2 C compiler IAR IAR C C Compiler for Renesas RL78 V1 30 2 3 Related Application Note The application note that is related to this application note is listed below for reference RO1AN0454EJ0200 Rev 2 00 Dec 27 2013 RL78 G13 Initialization RO1 ANO451EJ0100 Application Note Page 4 of 29 RENESAS RL78 G13 Real Time Clock 4 Description of the Hardware 4 1 Hardware Configuration Example Figure 4 1 shows an example of hardware configuration that is used for this application note EVpp RESET Vbo Set to an inverted output by RL78 G13 P10 constant period interrupt processing P11 Set to a high level output by alarm interrupt processing 32 768 kHz P40 TOOLO For on chip debugger Figure 4 1 Hardware Configuration Cautions 1 The purpose of this circuit is only to provide the connection outline and the circuit is simplified accordingly When designing and implementing an actual circuit provide pr
20. information in the design of your equipment Renesas Electronics assumes no responsibility for any losses incurred by you or third parties arising from the use of these circuits software or information 2 Renesas Electronics has used reasonable care in preparing the information included in this document but Renesas Electronics does not warrant that such information is error free Renesas Electronics assumes no liability whatsoever for any damages incurred by you resulting from errors in or omissions from the information included herein 3 Renesas Electronics does not assume any liability for infringement of patents copyrights or other intellectual property rights of third parties by or arising from the use of Renesas Electronics products or technical information described in this document No license express implied or otherwise is granted hereby under any patents copyrights or other intellectual property rights of Renesas Electronics or others 4 You should not alter modify copy or otherwise misappropriate any Renesas Electronics product whether in whole or in part Renesas Electronics assumes no responsibility for any losses incurred by you or third parties arising from such alteration modification copy or otherwise misappropriation of Renesas Electronics product 5 Renesas Electronics products are classified according to the following two quality grades Standard and High Quality The recommended applications for each Renesas Electronics
21. nterrupt function of the real time clock RTC The constant period interrupt function provides an inverted output to the external output pin by using interrupts The alarm interrupt function generates an alarm interrupt upon the elapse of five seconds after the date and time specified with the clock Table 1 1 lists the peripheral functions to be used and their uses Figure 1 1 presents an overview of sample code operation Table 1 1 Peripheral Functions to be Used and Their Uses Peripheral Function Real time clock Used to generate interrupts INTRTC P10 Set to a port output inverted output by constant period interrupt processing Set to a port output high level output by alarm P11 interrupt processing P10 Constant period interrupts P11 Alarm interrupts RL78 G13 Figure 1 1 Overview of Sample Code Operation RO1AN0454EJ0200 Rev 2 00 Page 3 of 29 Dec 27 2013 RENESAS RL78 G13 Real Time Clock 2 Operation Check Conditions The sample code described in this application note has been checked under the conditions listed in the table below Table 2 1 Operation Check Conditions Item Description Microcontroller used Operating frequency RL78 G13 R5F100LEA High speed on chip oscillator HOCO clock 32 MHz CPU peripheral hardware clock 32 MHz Operating voltage 5 0 V Operation is possible over a voltage range of 2 9 V to 5 5 V LVD operation VLVI Reset mode whic
22. oper pin treatment and make sure that the hardware s electrical specifications are met connect the input only ports separately to Vpp or Vss via a resistor Connect any pins whose name begins with EVss to Vss and any pins whose name begins with EV pp to Vpp respectively 3 Vpp must be held at not lower than the reset release voltage V that is specified as 4 2 List of Pins to be Used Table 4 1 lists the pins to be used and their functions Table 4 1 Pins to be Used and Their Functions Output Set to an inverted output by constant period interrupt processing Output Set to a high level output by alarm interrupt processing RO1AN0454EJ0200 Rev 2 00 Page 5 of 29 Dec 27 2013 RENESAS RL78 G13 Real Time Clock 5 Description of the Software 5 1 Operation Outline After initialization the current date and time of the clock are set to 2010 4 1 THU 15 59 55 and the alarm date and time to 16 00 00 each day for the operations described in this application note Also the following interrupt processing is performed e Constant period interrupt processing for setting P10 to an inverted output e Alarm interrupt processing for setting P11 to a high level output 1 Initialize the real time clock RTC Conditions for setting e Select the subsystem clock fsug as the RTC operation clock e Disable the RTCIHZ pin output e Present the time in 24 hour system e Enable RTC constant period inte
23. rn status flag C return lib Figure 5 9 RTC Reconfiguration RO1AN0454EJ0200_ Rev 2 00 Page 22 of 29 Dec 27 2013 RENESAS RL78 G13 Real Time Clock 5 6 8 RTS Startup Figure 5 10 shows the flowchart for starting the operation of the RTC R_RTC_Start Enable real time clock interrupts Start operation of real time clock C return D RTCIF bit 0 Clears interrupt request flag RTCMK bit 0 Enables interrupt processing RTCE bit lt 1 Starts counter operation Figure 5 10 RTC Startup R01AN0454EJ0200 Rev 2 00 Page 23 of 29 Dec 27 2013 RENESAS RL78 G13 Real Time Clock Configuring the RTC interrupt INTRTC e Interrupt request flag register IF1H Clear the RTCIF interrupt source flag e Interrupt mask flag register MK1H Mask RTCMK interrupts Symbol IF1H 7 6 5 4 3 2 1 0 TMIF04 TMIF13 SRIF3 STIF3 CSIIF31 CSIIF30 IICIF31 Bit 1 RTCIF Interrupt request flag 0 No interrupt request signal is generated Interrupt request is generated interrupt request status Symbol MK1H 6 5 4 1 0 7 3 2 4 1 SRMK3 STMK3 KRMK ITMK RTCMK ADMK CSIMK31 CSIMK30 IICMK31 IICMK30 Caution For details on the register setup procedures refer to RL78 G13 User s Manual Hardware RO1AN0454EJ0200_ Rev 2 00 Page 24 of 29 Dec 27 2013 RENESAS RL78 G13 5 6 9 RTC Time Setup Real Time Clock Figures
24. rrupts and set their cycle time to 0 5 second e Initialize the current date and time to 2001 1 1 Monday 00 00 00 e Enable INTRTC interrupts 2 Configure the I O ports e Configure P10 as an output port initial value high level for constant period interrupt processing e Configure P11 as an output port initial value low level for alarm interrupt processing Caution For precautions in using the device refer to RL78 G13 User s Manual Hardware RO1AN0454EJ0200_ Rev 2 00 Page 6 of 29 Dec 27 2013 RENESAS RL78 G13 Real Time Clock 5 2 List of Option Byte Settings Table 5 1 summarizes the settings of the option bytes Table 5 1 Option Byte Settings 000COH 010C0H 01101110B Disables the watchdog timer Stops counting after the release from the reset state 000C1H 010C1H 01111111B LVD reset mode 2 81 V 2 76 V to 2 87 V 000C2H 010C2H 11101000B HS mode HOCO 32 MHz 000C3H 010C3H 10000101B Enables the on chip debugger 5 3 List of Constants Table 5 2 lists the constants that are used in this sample program Table 5 2 Constants for the Sample Program __ Constant Setting Descripion HALFSEC 1U Specifies the cycle time 0 5 s for constant period interrupts MD OK 0 000 Setup status setup completed MD ARGERROR 0x80U Setup status setup unsuccessful due to an invalid argument MD BUSY1 0x03U Setup status Setup unsuccessful due to a counter deactivation failure MD_BUSY2 0 040 S
25. sed pins so that their electrical specifications are observed Connect each of any unused input only ports to Vpp or Vss via a separate resistor Setting up the output pin by using real time clock interrupts INTRTC Symbol 1 7 6 5 4 3 2 1 0 Ex qx o Bits 1 and 0 PM1n PMin I O mode selection 0 1 0 Output mode output buffer on 1 Input mode output buffer off For details on the register setup procedures refer to RL78 G13 User s Manual Hardware Caution RO1AN0454EJ0200 Rev 2 00 Page 13 of 29 Dec 27 2013 RENESAS RL78 G13 Real Time Clock 5 6 4 CPU Clock Setup Figure 5 5 shows the flowchart for setting up the CPU clock RH CGC Create Set up high speed system clock subsystem clock register 10H XT1 oscillation mode in which high speed system clock is unused and subsystem clock used MSTOP bit lt 1 XTSTOP bit lt 0 Contact the oscillator manufacturer for information about the oscillator circuit constants for the subsystem clock and the timeout period for oscillation stabilization Oscillation stabilization ompleted within waiting period Enable supply of subsystem clock signals to peripheral functions Select CPU peripheral hardware clock feug C return 2 Figure 5 5 Clock Setup OSMC register lt MCMO bit lt 0 Select high speed clock as main system clock fain CSS bit 0 Selects main sy
26. stem clock fma as CPU peripheral hardware clock Remarks CPU clock setup R CGC Create determines whether stabilization of subsystem clock oscillation is completed within a waiting period about 1 second This period is specified with constant CGC SUBWAITTIME in r cg cgc h Caution For details on the procedure for setting up the CPU clock CGC Create refer to the section entitled Flowcharts RL78 G13 Initialization Application Note RO1ANO0451EJ0100 R01AN0454EJ0200 Rev 2 00 Page 14 of 29 Dec 27 2013 RENESAS RL78 G13 Real Time Clock 5 6 5 RTC Initialization Figure 5 6 shows the flowchart for RTC initialization R_RTC_Create Supply clock signals to real time RTCEN bit lt 1 Starts supplying input clock circuit clock signals Deactivate real time clock RTCE bit 0 Clear real time clock alarm match interrupt request flag RTCIF bit lt 0 Disable real time clock alarm RTCMK bit lt 1 match interrupts Initialize real time clock e Set interval of constant period interrupts to 0 5 RTCCO register lt 09H second Select 24 hour system e Disable 1 Hz output SEC register MIN register 00H HOUR register lt WEEK register lt 01H DAY register 01H MONTH register 01H YEAR register 01H Initialize real time clock counter Initialize alarm function e Disable match operation for alarm WALE bit 0 function WALI
27. t pins of CMOS products are generally in the high impedance state In operation with unused pin in the open circuit state extra electromagnetic noise is induced in the vicinity of LSI an associated shoot through current flows internally and malfunctions occur due to the false recognition of the pin state as an input signal become possible Unused pins should be handled as described under Handling of Unused Pins in the manual 2 Processing at Power on The state of the product is undefined at the moment when power is supplied The states of internal circuits in the LSI are indeterminate and the states of register settings and pins are undefined at the moment when power is supplied In a finished product where the reset signal is applied to the external reset pin the states of pins are not guaranteed from the moment when power is supplied until the reset process is completed In a similar way the states of pins in a product that is reset by an on chip power on reset function are not guaranteed from the moment when power is supplied until the power reaches the level at which resetting has been specified 3 Prohibition of Access to Reserved Addresses Access to reserved addresses is prohibited The reserved addresses are provided for the possible future expansion of functions Do not access these addresses the correct operation of LSI is not guaranteed if they are accessed 4 Clock Signals After applying a reset only release the reset lin
28. tion characteristics installation and other product characteristics Renesas Electronics shall have no liability for malfunctions or damages arising out of the use of Renesas Electronics products beyond such specified ranges 7 Although Renesas Electronics endeavors to improve the quality and reliability of its products semiconductor products have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions Further Renesas Electronics products are not subject to radiation resistance design Please be sure to implement safety measures to guard them against the possibility of physical injury and injury or damage caused by fire in the event of the failure of a Renesas Electronics product such as safety design for hardware and software including but not limited to redundancy fire control and malfunction prevention appropriate treatment for aging degradation or any other appropriate measures Because the evaluation of microcomputer software alone is very difficult please evaluate the safety of the final products or systems manufactured by you 8 Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental compatibility of each Renesas Electronics product Please use Renesas Electronics products in compliance with all applicable laws and regulations that regulate the inclusion or use of controlled substances including without limitation the EU

Download Pdf Manuals

image

Related Search

Related Contents

Achat et développement durable ou comment introduire le  HP Home Theater Audio System User's Manual  Xi3000 Bluetooth Scanner User`s Manual  WORKING WITH CASES - inData Corporation  Catalogue 2015 - ÉQUIPEMENTS TECHNO  区点コード一覧  Nokia E65  

Copyright © All rights reserved.
Failed to retrieve file