Freescale Semiconductor ColdFire MCF52210 User Manual

Page 175

Advertising
background image

Initialization/Application Information

MCF52211 ColdFire® Integrated Microcontroller Reference Manual, Rev. 2

Freescale Semiconductor

11-15

Figure 11-14. Flow Chart of RTC Operation

11.4.2

Code Example for Initializing the Real-Time Clock

Figure 11-15

shows sample code for initializing the RTC.

MCF_CLOCK_RTCCR=0b01010110; //RTCCC

MCF_RTCGOCL = 0x00002000; //32KHz

MCF_CLOCK_RTCCR=0b01010111; //RTCCC

MCF_RTC_HOURMIN = MCF_RTC_HOURMIN_HOURS(((uint32)time_temp % 24));

MCF_RTC_HOURMIN = MCF_RTC_HOURMIN_MINUTES(((uint32)time_temp % 60));

MCF_RTC_SECONDS = MCF_RTC_SECONDS_SECONDS(((uint32)time_temp % 60));

Figure 11-15. Code Example for Initializing the Real-Time Clock

Configure RTC Control Register

Config RTC Days Counter Register

Config RTC Hr/Min Counter Register

Config RTC Alarm Registers

Config RTC Interrupt Enable Reg

Check RTC Interrupt Status Register

Config RTC Seconds Counter Reg

Advertising
This manual is related to the following products: