0% found this document useful (0 votes)
325 views13 pages

RTC PDF

A real time clock (RTC) provides timing interrupts to a system by generating interrupts at preset intervals. An interrupt service routine executes each time the RTC overflows. The RTC maintains time and date information in the system and is used to initiate control returns to the operating system at set clock periods. It provides a free-running counter that is generally never reset or reloaded with another value once started.

Uploaded by

rajesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
325 views13 pages

RTC PDF

A real time clock (RTC) provides timing interrupts to a system by generating interrupts at preset intervals. An interrupt service routine executes each time the RTC overflows. The RTC maintains time and date information in the system and is used to initiate control returns to the operating system at set clock periods. It provides a free-running counter that is generally never reset or reloaded with another value once started.

Uploaded by

rajesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

DEVICES AND COMMUNICATION

BUSES FOR DEVICES NETWORK–

Lesson-16: Real time clock

Chapter-3 L16: "Embedded Systems - " , Raj Kamal,


2008 1
Publs.: McGraw-Hill Education
Real Time Clock (RTC)
 A clock, which is based on the
interrupts at preset intervals. An
interrupt service routine executes on
each timeout (overflow) of this clock.
This timing device once started never
resets or never reloaded with another
value. Once it is set, it is not modified
later.

Chapter-3 L16: "Embedded Systems - " , Raj Kamal,


2008 2
Publs.: McGraw-Hill Education
RTC
 Used in a system to save the time and
date.
 Used in a system to initiate return of
control to the system (OS) after the set
system clock periods

Chapter-3 L16: "Embedded Systems - " , Raj Kamal,


2008 3
Publs.: McGraw-Hill Education
RTC Application
• Assume that a hardware timer of an RTC
for calendar is programmed to interrupt
after every 5.15 ms (=1 day period/ 224)
• Assume each tick (interrupt) a service
routine runs and updates at a memory
location. Within one day (86400 s) there
will be 224 ticks, the memory location will
reach 0x000000 after reaching the
maximum value 0xFFFFFF.

Chapter-3 L16: "Embedded Systems - " , Raj Kamal,


2008 4
Publs.: McGraw-Hill Education
RTC with 5.5 ms tick
• Within 256 days there will be 232 ticks,
the memory location will reach
0x00000000 after reaching the
maximum value 0xFFFFFFFF.
• A battery is used to protect the
memory for long period

Chapter-3 L16: "Embedded Systems - " , Raj Kamal,


2008 5
Publs.: McGraw-Hill Education
RTC for implementing a software timer
 A hardware 16-bit timer ticks from
processor clock after 0.5 µs. It will overflow
and execute an overflow interrupt service
routine after 215 µs = 32.768 ms.
 The interrupt service routine can generate a
port bit output after every time it runs or can
call a software routine or send a message
for a task. If n = 30, the RTC initiated
software will run every 30 × 32.768 ms,
which is close to 1 s.

Chapter-3 L16: "Embedded Systems - " , Raj Kamal,


2008 6
Publs.: McGraw-Hill Education
68HC11 microcontroller RTC
 Pulse Accumulator Control Register,
PACTL and two lowest significance bits,
RT1-RT0 (1st and 0th).
 PACTL is write only.
 If the RT1-RT0 pair is set =0-0, an RTC
interrupt can occur after 213 pulses of the
E clock. If the E clock pulses are of 2
MHz and T is 0.5 µs, the interrupt from a
real time clock occurs after every 4.096
ms.
Chapter-3 L16: "Embedded Systems - " , Raj Kamal,
2008 7
Publs.: McGraw-Hill Education
68HC11 microcontroller RTC
 If the RT1-RT0 pair is 01, an interrupt can
occur after 214 pulses of the E clock, that is,
after 8.192 ms.
 If the RT1-RT0 pair is 10, the interrupt can
occur after 215 pulses of the E clock, that is
after 16.384 ms.
 If the RT1-RT0 pair is 11, an interrupt can
occur after 216 pulses of the E clock, that is,
after 32.768 ms. The real time clock is
based on a free running counter. RT1-RT0
bits control its rate factor

Chapter-3 L16: "Embedded Systems - " , Raj Kamal,


2008 8
Publs.: McGraw-Hill Education
68HC11 microcontroller RTC
 RTC disabled or enabled by the I bit in
the CC (clock control) register
 Interrupts from real time clocks are
also locally masked by the 6th bit, RTI
in timer interrupt mask register2,
TMASK2.

Chapter-3 L16: "Embedded Systems - " , Raj Kamal,


2008 9
Publs.: McGraw-Hill Education
Unmask and reset to mask of real time
interrupt
 RTI is set to unmask and reset to mask
the real time interrupt locally.
 If RTI and I bits permit the interrupt
request for real time, the
microcontroller fetches the lower and
higher bytes of the interrupt servicing
routine address from the addresses
0xFFF0 (higher byte) and 0xFFF1
(lower byte)
Chapter-3 L16: "Embedded Systems - " , Raj Kamal,
2008 10
Publs.: McGraw-Hill Education
Summary

Chapter-3 L16: "Embedded Systems - " , Raj Kamal,


2008 11
Publs.: McGraw-Hill Education
We learnt
• A real time clock (RTC) provides the
system clock to generate the system
interrupts
• An interrupt service routine executes on
each tick (timeout or overflow) of this
clock.
• This timing device once started is generally
never reset or never reloaded to another
value
Chapter-3 L16: "Embedded Systems - " , Raj Kamal,
2008 12
Publs.: McGraw-Hill Education
End of Lesson 16 of Chapter 3

Chapter-3 L16: "Embedded Systems - " , Raj Kamal,


2008 13
Publs.: McGraw-Hill Education

You might also like