Git Product home page Git Product logo

8051-digitalclock-rtc's Introduction

8051-digitalclock-rtc

24Hr digital clock using 8051 and RTC DS1307

Program is written in Assembly Language on Keil uVision 5 and simulation was done on Proteus 8.9 using AT89C51

proteus-simulation

Operation of the clock in brief:

I2C protocol is used for communication between 8051 and DS1307. Initially 8051 enables the 1Hz Clock output on RTC chip. This 1Hz clock is used to interrupt 8051 every second. 8051 does not keep the track of time but instead outsources it to the RTC chip. At each interrupt, 8051 reads the time information present in the RTC chip and updates it's own time registers which is used to show information on the Groove 4 digit 7 segment display. 7447 BCD to 7 segment display is in multiplexing configuration for driving 4 7-seg display simultaneously. Switch bouncing is ignored in the simulation. Use debounce circuit while practically implementing the project.

RTC time can be manually adjusted using the Time Set Mode Switches, Switch A and Switch B

Setting the time using switches

Switches used:

  • set time/next bit -> switch A Interrupt switch to 8051
  • toggle current bit -> switch B Used by the program to choose proper interrupt operation

Important: Switch A is the interrupt switch. Interrupt program determines what operation to do based on the state of switch B. So make switch B on or off according to the requirement before toggling switch A

Switch combinations

To enter the time set mode:

  • Toggle switch A on-off while switch B is on

To change current time bit

  • Toggle switch A on-off while switch B is off

Go to next bit

  • Toggle switch A on-off while switch B is on
  • Previous bit is saved

To come out of set time mode

  • After setting the last bit use #go to next bit# switch combination twice to come out of the time set mode

In Time Set Mode LED is on

ledon

In Normal Mode LED is off

ledoff


8051 Registers used:

  • R1 -> ACCUMULATOR BACKUP

  • R2 -> MICRO_DELAY FUNCTION

  • R3 -> TEMPORARY STORAGE IN TIMESETMODE SUBROUTINE

  • R4 -> HOURS REGISTER

    • 0x(MSB)(LSB)
  • R5 -> MINUTES REGISTER

    • 0x(MSB)(LSB)
  • R6 -> STORE WHICH TIME SET MODE 8051 IS CURRENTLY OPERATING

    • 0x00: Normal Mode
      
    • 0x01: MSB HOUR SET
      
    • 0x02: LSB HOUR SET
      
    • 0x03: MSB MINUTES SET
      
    • 0x04: LSB MINUTES SET
      

8051 Subroutine addresses:

  • (150H)SETTIMEMODE -> INT1 CALLS THIS ADDRESS FOR MANUALLY SETTING TIME
  • (260H)DISPLAY -> 8051 DRIVING 7447 BCD TO 7SEG DISPLAY DECODER IN MULTIPLEX MODE
  • (300H)UPDATETIME -> CALL TO UPDATE 8051 INTERNAL TIME REGISTERS R4 AND R5
  • (2F0)MICRO_DELAY -> CALL A SMALL DELAY
  • (400H)RTCTIMEUPDATE -> CALLED WHILE MANUALY UPDATING TIME IN RTC CHIP
  • (510H)RSTART -> I2C RESTART CONDITION
  • (520H)STARTC -> I2C START CONDITION
  • (530H)STOP -> I2C STOP CONDITION
  • (540H)SEND -> I2C SEND DATA
  • (600H)ACK -> I2C ACKNOWLEDGEMENT (M TO S)
  • (610H)NAK -> I2C N-ACKNOWLEDGEMENT (M TO S)
  • (620H)RECV -> I2C RECEIVE DATA

8051-digitalclock-rtc's People

Contributors

ashvnv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.