|
|
View previous topic :: View next topic |
Author |
Message |
Markdem
Joined: 24 Jun 2005 Posts: 206
|
Working with LSBs |
Posted: Fri Nov 14, 2008 3:52 am |
|
|
Hello, I have been tring to work this out for hours now, but can't get my head around it. From the data sheet we read the following;
"The resolution of this register is 2.2 ms/LSB. When the line frequency is 60 Hz, the value of the period register is approximately 7576d"
So I know that at 60Hz, the period is 1/60 = 16ms. What I don't know is how you get 16ms out of the 7576 that the register is holding? How do I work this out.
Thanks
Mark |
|
|
Ttelmah Guest
|
|
Posted: Fri Nov 14, 2008 4:20 am |
|
|
What data sheet?.
It is hard to 'guess', which register you are talking about (except that a timer is involved). Given there are several hundred PIC models, it'd be nice to have a 'hint'.....
Best Wishes |
|
|
Markdem
Joined: 24 Jun 2005 Posts: 206
|
|
Posted: Fri Nov 14, 2008 4:34 am |
|
|
Sorry, the data sheet is not for a PIC, it is for a AD7753.
I did not think that it would matter, as a LSB is a LSB, regadless of which device it is on, or is there somthing I am not understanding.
Thanks
Mark |
|
|
Wayne_
Joined: 10 Oct 2007 Posts: 681
|
|
Posted: Fri Nov 14, 2008 4:41 am |
|
|
the value 7576d = 0x1D98 or 0b0001110110011000
So the LSB (Byte) = 0x98 or 0b10011000
= 152d
The resolution is 2.2ms, with a value of 152 = (152 * 2.2) = 334.4ms
Something not quite right, hold on a min |
|
|
Markdem
Joined: 24 Jun 2005 Posts: 206
|
|
|
Wayne_
Joined: 10 Oct 2007 Posts: 681
|
|
Posted: Fri Nov 14, 2008 5:27 am |
|
|
OK
LSB refers to Least Sig bit (LSb)
60Hz = 1/60 = 16ms
Calculation 38 shows Line period(s) = PERIOD * (8 / clckIn)
Their example shows clkIN as 3.579545 MHz so
Line period(s) = PERIOD * (8 / 3579545) = PERIOD * .0000022...
This shows the resolution to be 2.2us NOT 2.2ms as stated
7576 * 0.0000022 = 0.016... = 16ms |
|
|
Ttelmah Guest
|
|
Posted: Fri Nov 14, 2008 5:30 am |
|
|
Yes, an LSB is an LSB, but how the calculation 'gets' to 60Hz (which is what you asked), cannot be explained, without knowing what the numbers are referring to. It is also not plain, whether this number is actually 7576 decimal (which is what you seem to have assumed), or 7576D Hex.
I'm going to 'guess' that you mean the ADE7753 metering IC?.
Finding the actual paragraph, then tells us that this is clocked off 3.579545MHz. Then,we see that this is a zero crossing detector, which means it will trigger _twice_ in each mains cycle, making the actual time involved, 1/120th second, not 1/60th second. Looking further through the sheet, we find that the master clock, is divided by four (page 30), so we have the count in this being:
(3579545/4)/120 = 7457.
A slight, and 'interesting' difference.
The actual formula for the 'lline period', is given as equation 38.
They also seem to be doing quite a bit of 'rounding', using 1.1uSec as the /4 clock period, when it should be 1.11746uSec for the quoted clock...
Even more oddly, the data sheet says just in front of the bit you have quoted, that the 'MSB of this register is always 0'. Makes quoting a 16bit value rather 'weird'....
Now, they are talking about the 'resolution', which suggests that this should be the step size for a single bit charge. A quick 'thought', tells us that the resolution, for the frequency (given the /8, rather than /4 that this involves), will be in 2.2uSec steps. Suggesting that this is a simple factor of 1000 misprint, and should be in uSec...
There have also been erratas in this part of the sheet already listed. I'm afraid their accuracy is not good...
The number they are quoting, seems to be based on a master clock at 3.63648MHz, which is actually a quite likely, and common value, but it does make working out what they mean 'interesting'.
Best Wishes |
|
|
Markdem
Joined: 24 Jun 2005 Posts: 206
|
|
Posted: Fri Nov 14, 2008 3:42 pm |
|
|
Thank you all for the help. I guess I was on the right track, but did not know that the calculation involves the clock.
Anyway, it is working.
Thanks again
Mark |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|