1 / 22

System Programming

NFC-IET-2011. System Programming. Lecture-17 Real Time Clock Dated: May 30, 2011 By Somia Razzaq Note: Some slides and images of following lecture are taken from VU. Time Updation Through INT8. Real Time Clock Device. Battery powered device Updates time even if PC is shutdown

Télécharger la présentation

System Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. NFC-IET-2011 System Programming Lecture-17 Real Time Clock Dated: May 30, 2011 By Somia Razzaq Note: Some slides and images of following lecture are taken from VU

  2. Time Updation Through INT8 Real Time Clock Device • Battery powered device • Updates time even if PC is shutdown • RTC has 64 byte battery powered RAM • INT 1AH used to get/set time.

  3. Clock Counter 1AH/00 (hours*60*60 + min*60 + sec) * 18.2065 ON ENTRY AH = 00 ON EXIT AL = Midnight flag CX = Clock count (Hi word) DX = Clock count (Low word) 1573040 Times Increment 1573040/18.2065 = 86399.9121 sec Whereas 86400 sec represent 24 hrs.

  4. AL = 1 if Midnight passedAL = 0 if Midnight not passedSet Clock Counter 1AH/01 ON ENTRY AH = 01 CX = Clock count (Hi word) DX = Clock count (Low word)

  5. Read Time 1AH/02 ON ENTRY AH = 02 ON EXIT CH = Hours (BCD) CL = Minutes (BCD) DH = Seconds (BCD)

  6. Set Time 1AH/03 ON ENTRY AH = 03 CH = Hours (BCD) CL = Minutes (BCD) DH = Seconds (BCD) DL = Day Light saving = 1 Standard Time = 0

  7. Read Date 1AH/04 ON ENTRY AH = 04 ON EXIT CH = Century (BCD) CL = Year (BCD) DH = Month (BCD) DL = Day (BCD)

  8. Set Date 1AH/05 ON ENTRY AH = 05 CH = Century (BCD) CL = Year (BCD) DH = Month (BCD) DL = Day (BCD)

  9. Set Alarm 1AH/06 ON ENTRY AH = 06 CH = Hours (BCD) CL = Minutes (BCD) DH = Seconds (BCD) Interrupt = 04Ah Intercept this interrupt (e.g. On the speakers)

  10. Disable Alarm 1AH/07 ON ENTRY AH = 07

  11. Read Alarm 1AH/09 ON ENTRY AH = 09 ON EXIT CH = Hours (BCD) CL = Minutes (BCD) DH = Seconds (BCD) DL = Alarm Status (00 = Not Enable 01 = Enable)

  12. Real Time Clock Clock and Logic circuitry 64 Bytes Battery Powered Low power CMOS RAM 70H Control Circuitry 71H :::::::::::::::::::::::::::::::::::: INT 7FH

  13. Internal Ports 70 – 7FH (16 ports) Only 70 & 71H are important from programming point of view It can also interrupt microprocessor using IRQ8

  14. 64 Byte Battery Powered RAM 00H = Current Second 01H = Alarm Second 02H = Current Minute 03H = Alarm Minute 04H = Current Hour 05H = Alarm Hour 06H = Day Of the Week 07H = Number Of Day

  15. 64 Byte Battery Powered RAM 08H = Month 09H = Year 0AH = Clock Status Register A 0BH = Clock Status Register B 0CH = Clock Status Register C 0DH = Clock Status Register D 32H = Century

  16. Week Day 01H = Sunday 02H = Monday 03H = Tuesday 04H = Wednesday 05H = Thursday 06H = Friday 07H = Saturday

  17. Year No of Century and Year are in BCD.

  18. Accessing the Battery Powered RAM Battery Powered RAM is accessed in two steps • Specify the Byte no. in 70H port. • Read/write port 71H to get/set the value of specified byte.

  19. Accessing the Battery Powered RAM outport (0x70, 0); outport (0x70, 4); sec = inport (0x71); outport (0x71,hrs);

  20. Status Register A 7 6 5 4 3 2 1 0 Interrupt frequency Time frequency 0 = Time is not updated 1 = Time is updated

  21. Status Register B 7 6 5 4 3 2 1 0 0 = Daylight saving time Update time 24/12 – hour counter 0 = 12 hour format 1 = 24 hour format Call periodic interrupt Call Alarm interrupt Call interrupt on time update Time & date format 0 = BCD 1 = Binary Block generator

  22. Status Register C 7 6 5 4 3 2 1 0 1 = Time update complete 1 = Alarm time reached 1 = Periodic interrupt call

More Related