SlideShare a Scribd company logo
1 of 30
1 
The 8051 Microcontroller and 
Embedded Systems 
CHAPTER 15 
RTC Interfacing and 
Programming
Introduction of Real Time Clock 
 The real-time clock (RTC) is a widely used 
device that provides accurate time and date 
for many applications 
 Many systems such as the x86 IBM PC come 
with such a chip on the motherboard 
 The RTC chip in the IBM PC provides time 
components of hour, minute, and second, in 
addition to the date/calendar components of 
year, month, and day 
2
Introduction of Real Time Clock 
 The RTC chip uses an internal battery, which 
keeps the time and date even when the 
power is off 
 One of the most widely used RTC chips is 
the DS 12887 from Dallas Semiconductor 
/Maxim Corp 
 It uses an internal lithium battery to keep 
operating for over 10 years in the absence of 
external power 
3
Introduction of Real Time Clock 
 According to the DS 12887 data sheet from 
Maxim, it keeps track of “seconds, minutes, 
hours, days, day of week, date, month, and 
year with leap-year compensation valid up to 
year 2100″ 
 The above information is provided in both 
binary (hex) and BCD formats. The DS 
12887 supports both 12-hour and 24-hour 
clock modes with AM and PM in the 12-hour 
4 mode
 It also supports the Daylight Savings Time 
option 
 The DS 12887 uses CMOS technology to 
keep the power consumption low and it has 
the designation DS12C887, where C is for 
CMOS 
 The DS12887 has a total of 128 bytes of 
nonvolatile RAM 
5 
Introduction of Real Time Clock
 It uses 14 bytes of RAM for clock/calendar 
and control registers, and the other 114 
bytes of RAM are for general-purpose data 
storage 
 In the x86 IBM PC, these 114 bytes of NV-RAM 
are used for the CMOS configuration, 
where the system setups are kept before the 
operating system takes over 
6 
Introduction of Real Time Clock
Pin Diagram of DS12887 RTC 
7
Address map of the DS12887 
8
 The DS12887 has a total of 128 bytes of 
RAM space with addresses 00 -7FH 
 The first ten locations, 00 – 09, are set aside 
for RTC values of time, calendar, and alarm 
data 
 The next four bytes are used for the control 
and status registers 
9 
Address map of the DS12887
 They are registers A, B, C, and D and are 
located at addresses 10-13 (OA – OD in hex) 
 The next 114 bytes from addresses OEH to 
7FH are available for data storage 
 The entire 128 bytes of RAM are accessible 
directly for read or write except the following: 
– Registers C and D are read-only 
– D7 bit of register A is read-only 
– The high-order bit of the seconds byte is read-only 
10 
Address map of the DS12887
DS12887 Address Location for 
Time, Calendar, and Alarm 
11
Interfacing of DS12887 with 8051 
12
Turning on the oscillator for the 
first time 
 The DS12887 is equipped with the internal 
oscillator which is turned off in order to save 
the lithium battery. 
 We need to turn on the oscillator before we 
use the time keeping features of the DS 
12887 
 To do that, bits D6 – D4 of register A must be 
set to value 010 
13
Register A Bits for Turning on the 
DS12887′s Oscillator 
14
Code for turning ON DS12887 
 ACALL DELAY_200MS ;Giving settling time 
 MOV R0,#0AH ; Reg A address of DS12887 
 MOV A,#20H ; 010 DATA FOR D6-D4 
 MOVX @R0,A 
15
Bits of Register B 
16
Register C 
17 
– IRQF =1: if PF = PIE= 1 orAF=AIE= 1 orUF = 
UIE= 1 
– PF Periodic interrupt flag. Periodic interrupts can 
be generated at a rate of once every 500 ms to 
once every 122 us. The rate is set by bits RS3 – 
RSO of register A
Register C 
 AF Alarm interrupt flag. The AF becomes 1 
when the current real time matches the alarm 
time. AF and AIE of register B together (if 
both are 1) will allow the IRQ to be 
asserted low when all the three bytes of the 
real time (yy:mm:dd) are the same as the 
bytes in the alarm time 
 The AF also becomes 1 for cases of once 
per second, once per minute, and once per 
18 hour alarm
ALARM AND SQW FEATURES OF 
THE DS12887 CHIP 
19 
The SQW pin 
provides us a 
square wave 
output of various 
frequencies 
The frequency is 
chosen by bits 
RSO – RS3 of 
register A
 Also enable SQWE bit in Register B 
20 
ALARM AND SQW FEATURES OF 
THE DS12887 CHIP
ALARM FEATURE OF DS12887 
CHIP 
 The alarm interrupt can be programmed to 
occur at rates of 
– (a) once per day 
– (b) once per hour 
– (c) once per minute 
– (d) once per second 
21
Once-per-day alarm 
 To program the alarm for once per day, we 
write the desired time for the alarm into the 
hour, minute, and second RAM locations 1, 
3, and 5 
 As the clock keeps the time, when all three 
bytes of hour, minute, and second for the 
real time clock match the values in the alarm 
hour, minute, and second, the AF (alarm 
flag) bit in register C of the DS 12887 will go 
22 high
Once-per-hour, minute and second 
alarms 
 To program the alarm for once per hour, we 
write value FFH into the alarm hour location 
of 5 only 
 To program the alarm for once per minute, 
we write value FFH into both the alarm hour 
and alarm minute locations of 5 and 3 
 To program the alarm for once per second, 
we write value FFH into all three locations of 
alarm hour, alarm minute, and alarm second 
23
 We can poll the AF bit in register C, which is 
a waste of microcontroller resources, or allow 
the IRQ pin to be activated upon matching 
the alarm time with the real time 
 It must be noted that in order to use the IRQ 
pin of the DS 12887 for an alarm, the 
interrupt-enable bit for alarm in register B 
(AIE) must be set high 
24 
IRQ FEATURE OF THE DS12887 
CHIP
IRQ FEATURE OF THE DS12887 
CHIP 
25
 Interrupt request (IRQ) is an output pin for 
the DS12887 RTC chip 
 There are three possible sources that can 
activate the IRQ pin 
– (a) alarm interrupt 
– (b) periodic pulse interrupt 
– (c) update interrupt 
 We can choose which source to activate the 
IRQ pin using the interrupt-enable bit in 
register B of the DS 12887 
26 
IRQ FEATURE OF THE DS12887 
CHIP
PERIODIC INTERRUPT 
 The second source of interrupt is the periodic 
interrupt flag (PF) 
 The periodic interrupt flag is part of register C 
 It will go high at a rate set by the RS3 -RSO 
bits of register A 
 This rate can be from once every 500 ms to 
once every 122 us as shown 
 The PF becomes 1 when an edge is detected 
27 for the period
 Just like alarm interrupt, the periodic interrupt 
can also be directed to the IRQ pin 
 To use IRQ, the interrupt-enable bits of PIE 
in register B must be set to 1 
 In other words, we can poll the PF bit of 
register C, which is a waste of the 
microcontroller’s resources, or it can be 
directed to the hardware IRQ pin 
 If we set PIE = 1, the IRQ pin is asserted low 
when PF goes high 
28 
PERIODIC INTERRUPT
 While the alarm interrupt gave us the options 
from once per day to once per second, the 
periodic interrupt gives us the option of 
subsecond interrupts 
 For example, we can write a program to send 
a message to the screen twice per second (2 
Hz) 
29 
PERIODIC INTERRUPT
Internal 
Architecture 
of DS12887 
30

More Related Content

What's hot

8086 microprocessor-architecture
8086 microprocessor-architecture8086 microprocessor-architecture
8086 microprocessor-architectureprasadpawaskar
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086saurav kumar
 
Architecture of 8051
Architecture of 8051Architecture of 8051
Architecture of 8051hello_priti
 
MICROCONTROLLER 8051- Architecture & Pin Configuration
MICROCONTROLLER 8051- Architecture & Pin Configuration MICROCONTROLLER 8051- Architecture & Pin Configuration
MICROCONTROLLER 8051- Architecture & Pin Configuration AKHIL MADANKAR
 
microcontroller vs microprocessor
microcontroller vs microprocessormicrocontroller vs microprocessor
microcontroller vs microprocessorsobhadevi
 
Fpga architectures and applications
Fpga architectures and applicationsFpga architectures and applications
Fpga architectures and applicationsSudhanshu Janwadkar
 
Introduction to Digital Signal processors
Introduction to Digital Signal processorsIntroduction to Digital Signal processors
Introduction to Digital Signal processorsPeriyanayagiS
 
8257 DMA Controller
8257 DMA Controller8257 DMA Controller
8257 DMA ControllerShivamSood22
 
Pic microcontroller architecture
Pic microcontroller architecturePic microcontroller architecture
Pic microcontroller architectureDominicHendry
 
8259 Programmable Interrupt Controller
8259 Programmable Interrupt Controller8259 Programmable Interrupt Controller
8259 Programmable Interrupt Controllerabhikalmegh
 
Architecture of 8085 microprocessor
Architecture of 8085 microprocessorArchitecture of 8085 microprocessor
Architecture of 8085 microprocessorAMAN SRIVASTAVA
 
Addressing modes of 8051
Addressing modes of 8051Addressing modes of 8051
Addressing modes of 8051SARITHA REDDY
 

What's hot (20)

8086 microprocessor-architecture
8086 microprocessor-architecture8086 microprocessor-architecture
8086 microprocessor-architecture
 
ARM Processor
ARM ProcessorARM Processor
ARM Processor
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086
 
Architecture of 8051
Architecture of 8051Architecture of 8051
Architecture of 8051
 
Pin diagram 8085
Pin diagram 8085 Pin diagram 8085
Pin diagram 8085
 
8051 timer counter
8051 timer counter8051 timer counter
8051 timer counter
 
MICROCONTROLLER 8051- Architecture & Pin Configuration
MICROCONTROLLER 8051- Architecture & Pin Configuration MICROCONTROLLER 8051- Architecture & Pin Configuration
MICROCONTROLLER 8051- Architecture & Pin Configuration
 
CISC & RISC Architecture
CISC & RISC Architecture CISC & RISC Architecture
CISC & RISC Architecture
 
microcontroller vs microprocessor
microcontroller vs microprocessormicrocontroller vs microprocessor
microcontroller vs microprocessor
 
Fpga architectures and applications
Fpga architectures and applicationsFpga architectures and applications
Fpga architectures and applications
 
Introduction to Digital Signal processors
Introduction to Digital Signal processorsIntroduction to Digital Signal processors
Introduction to Digital Signal processors
 
Arm instruction set
Arm instruction setArm instruction set
Arm instruction set
 
8257 DMA Controller
8257 DMA Controller8257 DMA Controller
8257 DMA Controller
 
06. thumb instructions
06. thumb instructions06. thumb instructions
06. thumb instructions
 
Pic microcontroller architecture
Pic microcontroller architecturePic microcontroller architecture
Pic microcontroller architecture
 
8051 interfacing
8051 interfacing8051 interfacing
8051 interfacing
 
8085 MICROPROCESSOR
8085 MICROPROCESSOR 8085 MICROPROCESSOR
8085 MICROPROCESSOR
 
8259 Programmable Interrupt Controller
8259 Programmable Interrupt Controller8259 Programmable Interrupt Controller
8259 Programmable Interrupt Controller
 
Architecture of 8085 microprocessor
Architecture of 8085 microprocessorArchitecture of 8085 microprocessor
Architecture of 8085 microprocessor
 
Addressing modes of 8051
Addressing modes of 8051Addressing modes of 8051
Addressing modes of 8051
 

Viewers also liked

Audio devices and applications
Audio devices and applicationsAudio devices and applications
Audio devices and applicationsDevashish Raval
 
Motor Control Relay, Pwm, DC and Stepper Motors
Motor Control Relay, Pwm, DC and Stepper MotorsMotor Control Relay, Pwm, DC and Stepper Motors
Motor Control Relay, Pwm, DC and Stepper MotorsDevashish Raval
 
Introduction to Video Signals
Introduction to Video SignalsIntroduction to Video Signals
Introduction to Video SignalsDevashish Raval
 
Question paper with solution the 8051 microcontroller based embedded systems...
Question paper with solution  the 8051 microcontroller based embedded systems...Question paper with solution  the 8051 microcontroller based embedded systems...
Question paper with solution the 8051 microcontroller based embedded systems...manishpatel_79
 
RTOS based Confidential Area Security System
RTOS based Confidential Area Security SystemRTOS based Confidential Area Security System
RTOS based Confidential Area Security Systemajinky gadewar
 
Solution manual 8051 microcontroller by mazidi
Solution manual 8051 microcontroller by mazidiSolution manual 8051 microcontroller by mazidi
Solution manual 8051 microcontroller by mazidiMuhammad Abdullah
 
Television Signal Transmission & Propagation
Television Signal Transmission & PropagationTelevision Signal Transmission & Propagation
Television Signal Transmission & PropagationDevashish Raval
 
Project report on embedded system using 8051 microcontroller
Project  report on embedded system using 8051 microcontrollerProject  report on embedded system using 8051 microcontroller
Project report on embedded system using 8051 microcontrollerVandna Sambyal
 
PIC32MX Microcontroller Family
PIC32MX Microcontroller FamilyPIC32MX Microcontroller Family
PIC32MX Microcontroller FamilyPremier Farnell
 
1 introducing embedded systems and the microcontrollers
1 introducing embedded systems and the microcontrollers1 introducing embedded systems and the microcontrollers
1 introducing embedded systems and the microcontrollersBidhu Deka
 
Timer based automatic power cutoff for industrial sealing or packaging machines
Timer based automatic power cutoff for industrial sealing or packaging machinesTimer based automatic power cutoff for industrial sealing or packaging machines
Timer based automatic power cutoff for industrial sealing or packaging machinesEcwayt
 
Intro to micro controller (Atmega16)
Intro to micro controller (Atmega16)Intro to micro controller (Atmega16)
Intro to micro controller (Atmega16)Ramadan Ramadan
 

Viewers also liked (20)

Audio devices and applications
Audio devices and applicationsAudio devices and applications
Audio devices and applications
 
Motor Control Relay, Pwm, DC and Stepper Motors
Motor Control Relay, Pwm, DC and Stepper MotorsMotor Control Relay, Pwm, DC and Stepper Motors
Motor Control Relay, Pwm, DC and Stepper Motors
 
Introduction to Video Signals
Introduction to Video SignalsIntroduction to Video Signals
Introduction to Video Signals
 
Television Receiver
Television ReceiverTelevision Receiver
Television Receiver
 
Question paper with solution the 8051 microcontroller based embedded systems...
Question paper with solution  the 8051 microcontroller based embedded systems...Question paper with solution  the 8051 microcontroller based embedded systems...
Question paper with solution the 8051 microcontroller based embedded systems...
 
RTOS based Confidential Area Security System
RTOS based Confidential Area Security SystemRTOS based Confidential Area Security System
RTOS based Confidential Area Security System
 
8051 microcontrollers
8051 microcontrollers8051 microcontrollers
8051 microcontrollers
 
Sound amplification
Sound amplificationSound amplification
Sound amplification
 
Solution manual 8051 microcontroller by mazidi
Solution manual 8051 microcontroller by mazidiSolution manual 8051 microcontroller by mazidi
Solution manual 8051 microcontroller by mazidi
 
Television Signal Transmission & Propagation
Television Signal Transmission & PropagationTelevision Signal Transmission & Propagation
Television Signal Transmission & Propagation
 
Television Basics
Television BasicsTelevision Basics
Television Basics
 
Digital audio
Digital audioDigital audio
Digital audio
 
Project report on embedded system using 8051 microcontroller
Project  report on embedded system using 8051 microcontrollerProject  report on embedded system using 8051 microcontroller
Project report on embedded system using 8051 microcontroller
 
Interfacing LCD with 8051 Microcontroller
Interfacing LCD with 8051 MicrocontrollerInterfacing LCD with 8051 Microcontroller
Interfacing LCD with 8051 Microcontroller
 
Sound fundamentals
Sound fundamentalsSound fundamentals
Sound fundamentals
 
PIC32MX Microcontroller Family
PIC32MX Microcontroller FamilyPIC32MX Microcontroller Family
PIC32MX Microcontroller Family
 
1 introducing embedded systems and the microcontrollers
1 introducing embedded systems and the microcontrollers1 introducing embedded systems and the microcontrollers
1 introducing embedded systems and the microcontrollers
 
Timer based automatic power cutoff for industrial sealing or packaging machines
Timer based automatic power cutoff for industrial sealing or packaging machinesTimer based automatic power cutoff for industrial sealing or packaging machines
Timer based automatic power cutoff for industrial sealing or packaging machines
 
Intro to micro controller (Atmega16)
Intro to micro controller (Atmega16)Intro to micro controller (Atmega16)
Intro to micro controller (Atmega16)
 
Loudness and pitch
Loudness and pitchLoudness and pitch
Loudness and pitch
 

Similar to RTC Interfacing and Programming

rtcinterfacingandprogramming-141016105525-conversion-gate01.pptx
rtcinterfacingandprogramming-141016105525-conversion-gate01.pptxrtcinterfacingandprogramming-141016105525-conversion-gate01.pptx
rtcinterfacingandprogramming-141016105525-conversion-gate01.pptxSnehalPawar406569
 
project report on embedded system
project report on embedded systemproject report on embedded system
project report on embedded systemram avtar
 
Advanced Embedded Automatic Car Parking System
	Advanced Embedded Automatic Car Parking System	Advanced Embedded Automatic Car Parking System
Advanced Embedded Automatic Car Parking Systemtheijes
 
microcontroller 8051 17.07.2023.pdf
microcontroller 8051 17.07.2023.pdfmicrocontroller 8051 17.07.2023.pdf
microcontroller 8051 17.07.2023.pdf818Farida
 
Training Report on embedded Systems and Robotics
Training Report on embedded  Systems and RoboticsTraining Report on embedded  Systems and Robotics
Training Report on embedded Systems and RoboticsNIT Raipur
 
Interfacing Of PIC 18F252 Microcontroller with Real Time Clock via I2C Protocol
Interfacing Of PIC 18F252 Microcontroller with Real Time Clock via I2C ProtocolInterfacing Of PIC 18F252 Microcontroller with Real Time Clock via I2C Protocol
Interfacing Of PIC 18F252 Microcontroller with Real Time Clock via I2C ProtocolIJERA Editor
 
Microprocessor and microcontroller
Microprocessor and microcontrollerMicroprocessor and microcontroller
Microprocessor and microcontrollerRavinder Singla
 
Chp4 introduction to the pic microcontroller copy
Chp4 introduction to the pic microcontroller   copyChp4 introduction to the pic microcontroller   copy
Chp4 introduction to the pic microcontroller copymkazree
 
Microprocessor 8085 Chapter 4
Microprocessor 8085 Chapter 4Microprocessor 8085 Chapter 4
Microprocessor 8085 Chapter 4Rishikesh Bhavsar
 
Presentation On: "Micro-controller 8051 & Embedded System"
Presentation On: "Micro-controller 8051 & Embedded System"Presentation On: "Micro-controller 8051 & Embedded System"
Presentation On: "Micro-controller 8051 & Embedded System"surabhii007
 
Introduction to microprocessor
Introduction to microprocessorIntroduction to microprocessor
Introduction to microprocessorRamaPrabha24
 
Industrial training report of embedded system and robotics
Industrial training report of embedded system and roboticsIndustrial training report of embedded system and robotics
Industrial training report of embedded system and roboticsPallavi Bharti
 

Similar to RTC Interfacing and Programming (20)

rtcinterfacingandprogramming-141016105525-conversion-gate01.pptx
rtcinterfacingandprogramming-141016105525-conversion-gate01.pptxrtcinterfacingandprogramming-141016105525-conversion-gate01.pptx
rtcinterfacingandprogramming-141016105525-conversion-gate01.pptx
 
020419.pdf
020419.pdf020419.pdf
020419.pdf
 
digital clock atmega16
digital clock atmega16digital clock atmega16
digital clock atmega16
 
project report on embedded system
project report on embedded systemproject report on embedded system
project report on embedded system
 
Advanced Embedded Automatic Car Parking System
	Advanced Embedded Automatic Car Parking System	Advanced Embedded Automatic Car Parking System
Advanced Embedded Automatic Car Parking System
 
microcontroller 8051 17.07.2023.pdf
microcontroller 8051 17.07.2023.pdfmicrocontroller 8051 17.07.2023.pdf
microcontroller 8051 17.07.2023.pdf
 
Training Report on embedded Systems and Robotics
Training Report on embedded  Systems and RoboticsTraining Report on embedded  Systems and Robotics
Training Report on embedded Systems and Robotics
 
Interfacing Of PIC 18F252 Microcontroller with Real Time Clock via I2C Protocol
Interfacing Of PIC 18F252 Microcontroller with Real Time Clock via I2C ProtocolInterfacing Of PIC 18F252 Microcontroller with Real Time Clock via I2C Protocol
Interfacing Of PIC 18F252 Microcontroller with Real Time Clock via I2C Protocol
 
6.pptx
6.pptx6.pptx
6.pptx
 
Microprocessor and microcontroller
Microprocessor and microcontrollerMicroprocessor and microcontroller
Microprocessor and microcontroller
 
Qb microprocessors
Qb microprocessorsQb microprocessors
Qb microprocessors
 
8051 Presentation
8051 Presentation8051 Presentation
8051 Presentation
 
Chp4 introduction to the pic microcontroller copy
Chp4 introduction to the pic microcontroller   copyChp4 introduction to the pic microcontroller   copy
Chp4 introduction to the pic microcontroller copy
 
Microprocessor 8085 Chapter 4
Microprocessor 8085 Chapter 4Microprocessor 8085 Chapter 4
Microprocessor 8085 Chapter 4
 
Presentation On: "Micro-controller 8051 & Embedded System"
Presentation On: "Micro-controller 8051 & Embedded System"Presentation On: "Micro-controller 8051 & Embedded System"
Presentation On: "Micro-controller 8051 & Embedded System"
 
Pic full note
Pic full notePic full note
Pic full note
 
8085_LAB_PROGRAMS.pdf
8085_LAB_PROGRAMS.pdf8085_LAB_PROGRAMS.pdf
8085_LAB_PROGRAMS.pdf
 
Introduction to microprocessor
Introduction to microprocessorIntroduction to microprocessor
Introduction to microprocessor
 
assignment 1-MC.pdf
assignment 1-MC.pdfassignment 1-MC.pdf
assignment 1-MC.pdf
 
Industrial training report of embedded system and robotics
Industrial training report of embedded system and roboticsIndustrial training report of embedded system and robotics
Industrial training report of embedded system and robotics
 

Recently uploaded

Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 

Recently uploaded (20)

Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 

RTC Interfacing and Programming

  • 1. 1 The 8051 Microcontroller and Embedded Systems CHAPTER 15 RTC Interfacing and Programming
  • 2. Introduction of Real Time Clock  The real-time clock (RTC) is a widely used device that provides accurate time and date for many applications  Many systems such as the x86 IBM PC come with such a chip on the motherboard  The RTC chip in the IBM PC provides time components of hour, minute, and second, in addition to the date/calendar components of year, month, and day 2
  • 3. Introduction of Real Time Clock  The RTC chip uses an internal battery, which keeps the time and date even when the power is off  One of the most widely used RTC chips is the DS 12887 from Dallas Semiconductor /Maxim Corp  It uses an internal lithium battery to keep operating for over 10 years in the absence of external power 3
  • 4. Introduction of Real Time Clock  According to the DS 12887 data sheet from Maxim, it keeps track of “seconds, minutes, hours, days, day of week, date, month, and year with leap-year compensation valid up to year 2100″  The above information is provided in both binary (hex) and BCD formats. The DS 12887 supports both 12-hour and 24-hour clock modes with AM and PM in the 12-hour 4 mode
  • 5.  It also supports the Daylight Savings Time option  The DS 12887 uses CMOS technology to keep the power consumption low and it has the designation DS12C887, where C is for CMOS  The DS12887 has a total of 128 bytes of nonvolatile RAM 5 Introduction of Real Time Clock
  • 6.  It uses 14 bytes of RAM for clock/calendar and control registers, and the other 114 bytes of RAM are for general-purpose data storage  In the x86 IBM PC, these 114 bytes of NV-RAM are used for the CMOS configuration, where the system setups are kept before the operating system takes over 6 Introduction of Real Time Clock
  • 7. Pin Diagram of DS12887 RTC 7
  • 8. Address map of the DS12887 8
  • 9.  The DS12887 has a total of 128 bytes of RAM space with addresses 00 -7FH  The first ten locations, 00 – 09, are set aside for RTC values of time, calendar, and alarm data  The next four bytes are used for the control and status registers 9 Address map of the DS12887
  • 10.  They are registers A, B, C, and D and are located at addresses 10-13 (OA – OD in hex)  The next 114 bytes from addresses OEH to 7FH are available for data storage  The entire 128 bytes of RAM are accessible directly for read or write except the following: – Registers C and D are read-only – D7 bit of register A is read-only – The high-order bit of the seconds byte is read-only 10 Address map of the DS12887
  • 11. DS12887 Address Location for Time, Calendar, and Alarm 11
  • 12. Interfacing of DS12887 with 8051 12
  • 13. Turning on the oscillator for the first time  The DS12887 is equipped with the internal oscillator which is turned off in order to save the lithium battery.  We need to turn on the oscillator before we use the time keeping features of the DS 12887  To do that, bits D6 – D4 of register A must be set to value 010 13
  • 14. Register A Bits for Turning on the DS12887′s Oscillator 14
  • 15. Code for turning ON DS12887  ACALL DELAY_200MS ;Giving settling time  MOV R0,#0AH ; Reg A address of DS12887  MOV A,#20H ; 010 DATA FOR D6-D4  MOVX @R0,A 15
  • 17. Register C 17 – IRQF =1: if PF = PIE= 1 orAF=AIE= 1 orUF = UIE= 1 – PF Periodic interrupt flag. Periodic interrupts can be generated at a rate of once every 500 ms to once every 122 us. The rate is set by bits RS3 – RSO of register A
  • 18. Register C  AF Alarm interrupt flag. The AF becomes 1 when the current real time matches the alarm time. AF and AIE of register B together (if both are 1) will allow the IRQ to be asserted low when all the three bytes of the real time (yy:mm:dd) are the same as the bytes in the alarm time  The AF also becomes 1 for cases of once per second, once per minute, and once per 18 hour alarm
  • 19. ALARM AND SQW FEATURES OF THE DS12887 CHIP 19 The SQW pin provides us a square wave output of various frequencies The frequency is chosen by bits RSO – RS3 of register A
  • 20.  Also enable SQWE bit in Register B 20 ALARM AND SQW FEATURES OF THE DS12887 CHIP
  • 21. ALARM FEATURE OF DS12887 CHIP  The alarm interrupt can be programmed to occur at rates of – (a) once per day – (b) once per hour – (c) once per minute – (d) once per second 21
  • 22. Once-per-day alarm  To program the alarm for once per day, we write the desired time for the alarm into the hour, minute, and second RAM locations 1, 3, and 5  As the clock keeps the time, when all three bytes of hour, minute, and second for the real time clock match the values in the alarm hour, minute, and second, the AF (alarm flag) bit in register C of the DS 12887 will go 22 high
  • 23. Once-per-hour, minute and second alarms  To program the alarm for once per hour, we write value FFH into the alarm hour location of 5 only  To program the alarm for once per minute, we write value FFH into both the alarm hour and alarm minute locations of 5 and 3  To program the alarm for once per second, we write value FFH into all three locations of alarm hour, alarm minute, and alarm second 23
  • 24.  We can poll the AF bit in register C, which is a waste of microcontroller resources, or allow the IRQ pin to be activated upon matching the alarm time with the real time  It must be noted that in order to use the IRQ pin of the DS 12887 for an alarm, the interrupt-enable bit for alarm in register B (AIE) must be set high 24 IRQ FEATURE OF THE DS12887 CHIP
  • 25. IRQ FEATURE OF THE DS12887 CHIP 25
  • 26.  Interrupt request (IRQ) is an output pin for the DS12887 RTC chip  There are three possible sources that can activate the IRQ pin – (a) alarm interrupt – (b) periodic pulse interrupt – (c) update interrupt  We can choose which source to activate the IRQ pin using the interrupt-enable bit in register B of the DS 12887 26 IRQ FEATURE OF THE DS12887 CHIP
  • 27. PERIODIC INTERRUPT  The second source of interrupt is the periodic interrupt flag (PF)  The periodic interrupt flag is part of register C  It will go high at a rate set by the RS3 -RSO bits of register A  This rate can be from once every 500 ms to once every 122 us as shown  The PF becomes 1 when an edge is detected 27 for the period
  • 28.  Just like alarm interrupt, the periodic interrupt can also be directed to the IRQ pin  To use IRQ, the interrupt-enable bits of PIE in register B must be set to 1  In other words, we can poll the PF bit of register C, which is a waste of the microcontroller’s resources, or it can be directed to the hardware IRQ pin  If we set PIE = 1, the IRQ pin is asserted low when PF goes high 28 PERIODIC INTERRUPT
  • 29.  While the alarm interrupt gave us the options from once per day to once per second, the periodic interrupt gives us the option of subsecond interrupts  For example, we can write a program to send a message to the screen twice per second (2 Hz) 29 PERIODIC INTERRUPT