Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Problems of digital clock by 8051...

Status
Not open for further replies.

mikemike

New Member
Hi everyone, i'm new in here.
i'm now doing a digital clock by using 8051 without using a rtc clock chip.
i've done it by a 16bit mode timer, but after i show to my tutor, he said a 16bit timer can't be so accurate, and it's quite obvious after days running. He suggests me to use 8bit with auto reload instead.
So, how to do it with a 8bit ones???:confused:

Thank you very much.
i'm not so good at microcontroller:eek:
 
mikemike said:
Hi everyone, i'm new in here.
i'm now doing a digital clock by using 8051 without using a rtc clock chip.
i've done it by a 16bit mode timer, but after i show to my tutor, he said a 16bit timer can't be so accurate, and it's quite obvious after days running. He suggests me to use 8bit with auto reload instead.
So, how to do it with a 8bit ones???:confused:

Can't help you on 8051's, but I fail to see why an 8 bit timer would be any more accurate than a 16 bit one?. The accuracy of your clock should be dependent upon the accuracy of it's clock source, and how well you program it.
 
Nigel Goodwin said:
Can't help you on 8051's, but I fail to see why an 8 bit timer would be any more accurate than a 16 bit one?. The accuracy of your clock should be dependent upon the accuracy of it's clock source, and how well you program it.
My tutor explain to me, according to his experiences, the 16bit requires some :mu: s to count over, but the 8bit is count over using hardware(inside 8051). Therefore, it's more accurate than the 16bit one.

forgive me for my english.
anyway,thank you for your reply.
 
mikemike said:
My tutor explain to me, according to his experiences, the 16bit requires some :mu: s to count over, but the 8bit is count over using hardware(inside 8051). Therefore, it's more accurate than the 16bit one.

forgive me for my english.
anyway,thank you for your reply.

Well.. i my point of view, what makes the 8-bit counter more reliable, is that the "autorelaoding" is done automatially, always at the same time, but when using a 16 bit timer (in 8051), you have to reload it manually, after an interrupt is exected, or by pooling, making it more difficult to control the timing and acheive precision.

to set timers, here is small code example:
Code:
TMOD = 0X25;  //counter 0 in mode 1 (16 bit counter)  , timer 1 in mode 2 (auto reload from TH1
TH1 = 100; //start timer 1 from 100, it will count 156 steps 
ET1 = 1; //enable timer 1 interrrupt (if you need to, and that's obvious in your application)
TR1 = 1; //Enable Timer/counter 1 to count

Now, to obtain even more precise timing, try using the maximum crystal frequency that the micro contoller can support. i think it is 36 Mhz if you'r working with 89s52..
 
ikalogic said:
Well.. i my point of view, what makes the 8-bit counter more reliable, is that the "autorelaoding" is done automatially, always at the same time, but when using a 16 bit timer (in 8051), you have to reload it manually, after an interrupt is exected, or by pooling, making it more difficult to control the timing and acheive precision.

So basically it's a limitation of the poor hardware?.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top