EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Replies / hello romel, How does the

hello romel, How does the

|

Microcontroller › 8051 › question about digital clock project posted here. › hello romel, How does the

April 13, 2011 at 7:29 am #5967
dagakshay
Participant

hello romel,

 

How does the code you have pased above (which which given on site) is giving 1 second…

 

timer register is a 16 bit register since they are using it in mode1

 

TH1=0x4B;

TL1=0xFD;

 

so 4BFD = 19453 in decimal

 

65535 – 19453 = 46083;

 

they using 12MHz crystal so freq./12clock

12MH/12=1Mhz

t=1/f=1 us in the case of 12 MHz crystal

if they would have used 11.0592 Mhz it would be 1.085 us

 

46083*1us*20 loops= 921660 us near about 0.92 second for 12Mhz

46083*1.085us*20 loops= 1000001.1 micro second which is more closer to 1 second

 

ideally they would have used or calculated it for 11.0592Mhz

 

and the delay function(second one) which you have pasted will count = 49999 us*k (according to 12Mhz)

if k=20 the total it will give around 0.99 second… so you delay in case of 12 Mhz will be more accurate..

RSS Recent Posts

  • Harman Kardon radio module BMW noise February 16, 2026
  • Arduino standalone minimal February 16, 2026
  • analog logic of shmidt trigger bjt circuit February 16, 2026
  • CR2/CR123A Batteries In Projects February 16, 2026
  • Math problem February 15, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise