QE128 Quick Reference User Guide, Rev. 1.0
Freescale Semiconductor
9-1
Chapter 9
Using the Real Time Counter (RTC) for the QE
Microcontrollers
9.1
Overview
This is a quick reference for using the real time counter (RTC) module for the QE family microcontrollers
(MCUs). Basic information about the functional description and configuration options are provided. The
following example may be modified to suit an application. The RTC project is made for the
MC9S08QE128 and MCF51QE128 MCUs.
The RTC module can be used to generate a hardware interrupt at fixed periodic rate. The RTC module in
QE MCU has three clock sources, the 1 kHz internal clock, the 32 kHz internal clock and an external clock.
There are different periods of time that can be used to interrupt the MCU. Please refer the reference manual
for specific times. It can be found at www.freescale.com.
RTC Quick Reference
Module Configuration:
9.2
RTC project for EVB
9.2.1
Code Example and Explanation
This example code is available from the Freescale Web site www.freescale.com.
The zip file contains the following functions:
•
main — Endless loop waiting for the RTC interrupt to occur.
•
MCU_Init – MCU initialization, watchdog disable and the RTC clock module enabled.
•
GPIO_Init – Configure PTE port as output.
•
RTC_Init – RTC module configuration.
•
RTC_ISR — Toggles PTE port .
RTCSC
RTIF
RTCLKS
RTIE
RTCPS
RTIF - Real-Time Interrupt flag
IRTIE - Real-Time Interrupt Enable
RTCLKS - Real-Time Clock Source Select
RTCPS - Real-Time clock prescaler select
RTCCNT
RTCCNT
RTCCNT - It contains the value of the current RTC count
RTCMOD
RTCMOD
RTCMOD - RTC Modulo