# 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???

Thank you very much.
i'm not so good at microcontroller

#### Nigel Goodwin

##### Super Moderator
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???

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.

#### mikemike

##### New Member
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.

#### colin mac

##### New Member

There's a good simulator on that site too.

#### ikalogic

##### Member
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.

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..

#### Nigel Goodwin

##### Super Moderator
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?.

#### ikalogic

##### Member
Nigel Goodwin said:
So basically it's a limitation of the poor hardware?.

No, simply the characteristics of the hardware of the 8051 archtecture.

#### Naresh123

##### New Member
CAN any one SEND ME Schimeticts & Hex + Source codes for LED display For 8051/AVR

THANX

#### xainnasir

##### New Member

Last edited by a moderator:
Status
Not open for further replies.

Replies
6
Views
3K
Replies
3
Views
2K
Replies
31
Views
5K
Replies
2
Views
3K
Replies
13
Views
16K