Frequency output resolution at low frequencies

Complete evaluation board, incl. PCAN-MicroMod and CAN interface
Post Reply
can_beginner
Posts: 5
Joined: Wed 15. Jun 2011, 19:47

Frequency output resolution at low frequencies

Post by can_beginner » Wed 15. Jun 2011, 20:19

Hello Peak System users,
I am relatively new to CAN bus, and have bought MicroMod evaluation kit. My first CAN project is converting an analogue voltage in to a CAN message. After about a day experimenting I now have now MicroMod doing this job perfectly. I would also like to convert the same input signal into a frequency (by wiring two analogue inputs together). I have got this to work, converting the analogue input first into an internal variable, then converting the internal variable into a frequency output. The output frequency goes up and down with the analogue input and the CAN output, and the scaling is correct, however the resolution of the frequency seems to be very poor. The MicroMod is set as follows:

Analogue Input number: 0
Enable: Yes
CAN-ID: Int0
Byteposition: 1
Bit position: 0
Bit length: 10
Scale: 1
Offset: 0
Tau: 0 (I do not understand what 'Tau' is)
Intel
Unsigned

PWM + Frequency Output number: 0
Enable: Yes
CAN-ID: Int0
Byte position: 1
Bit position: 0
Bit length: 10
Scale: 0.010293
Offset: 0
Timeout: 0 Hz
Powerup Value: 0 Hz
Tau: 0
Intel
Unsigned
Timeout (ms): 0
Frequency

The analogue input varies across the whole 0 - 5V range. The CAN output responds perfectly, but the frequency output only has about 10 steps across the whole range (0 - 10.5 Hz). I was hoping for much higher resolution than this - I expected 1024 steps (from the 10 bit input resolution) to cover the 0 - 10.5 Hz range, although I don't need resolution this high.
I have tried changing everything I can think of, but still I get very poor frequency resolution. I know the internal variable responds OK to the analogue input, because if I set it to output this value as a CAN message instead, I get all 1024 steps. I think the problem is with the internal variable to frequency conversion. Am I doing something wrong, or have I found a limitation to what the MicroMod is capable of (possibly becauae of the low frequencies involved)?
Any help would be much appreciated. Thank you

G.Lang
Support
Support
Posts: 169
Joined: Wed 22. Sep 2010, 14:58

Re: Frequency output resolution at low frequencies

Post by G.Lang » Thu 16. Jun 2011, 14:14

Hi,

the analog input resolution are 10bit = 1024 steps -> so with a scale value 1 at the frequency output side you are able to generate frequencies in a range between 0 Hz and 1024 Hz. And with your scale factor 0.010293 it´s theoretically possible to generate frequencies between 0 Hz and 10,5 Hz. But the mimium step the hardware could handle is 1 Hz. So your 10 steps are right.


Example with output scale factor 1
0 V @ Ain = 0000h = 0 decimal x 1 = 0 Hz (theoretical) -> 0 Hz real
2.5 V @ Ain = 01ffh = 511 decimal x 1 = 511 Hz (theoretical) -> 511 Hz real
2.6 V @ Ain = 0213h = 531 decimal x1 = 531 Hz (theoretical) -> 531 Hz real
2.7 V @ Ain = 0228h = 552 decimal x 1 = 552 Hz (theoretical) -> 552 Hz real
5 V @ Ain = 03FFh = 1023 decimal x 1 = 1023 Hz (theoretical)-> 1023 Hz real


Example with output scale factor 0.01

0V @ Ain = 0000h = 0 decimal x 0.01 = 0Hz
2.5V @ Ain = 01ffh = 511 decimal x 0.01 = 5.11 Hz (theoretical) -> 5 Hz real
2.6V @ Ain = 0213h = 531 x 0.01 = 5.31 Hz (theoretical) -> 5 Hz real
2.7V @ Ain = 0228h = 552 x 0.01 = 5.52 Hz (theoretical) -> 5 Hz (or maybe 6 Hz) real
5V @ Ain = 03FFh = 1024 decimal x 0.01 = 10.23 Hz (theoretical) -> 10 Hz real

I hope this explanation helps.

regards
Gunther

can_beginner
Posts: 5
Joined: Wed 15. Jun 2011, 19:47

Re: Frequency output resolution at low frequencies

Post by can_beginner » Fri 17. Jun 2011, 13:59

Hello Gunther,
Thank you for your explanation. I thought I had understood it incorrectly, so I have just done some more experimenting. My experiments seem to confirm what I initially thought - that it is not possible to get more than 10 steps across my required 0 - 10.5 Hz output fro MicroMod's frequency generator?

If I ignore offsets , and assume an input scale factor of 1, it seems like the output function for the frequency generator must be:

F out = value of Internal CAN Message * Output Scale Factor

..... so if any Output Scale Factor with a value of less than 1 is used, it also reduces the resolution of the system. In my case by a factor of 1/ 0.010293 = 97.15.
I expected the Output Scale Factor to be used to calculate the range of output frequency required, and the resolution of the Internal CAN message controlling the frequency generator would then be spread across this required frequency range, so the output resolution is the same as the input resolution.
I expected that if I wanted an output resolution of less than 10 bit, I would use an input scale factor of less than 1 to reduce the range of Internal CAN message values used to drive the frequency generator to less than 1024.
This may be an unrealistic expectation, but to someone like me who has no digital electronics background, a system where the output resolution is reduced by an output scale factor of less than 1 seems very limiting. Surely output scaling should affect the range of values that are output, not the output scaling and the output resolution?

I hope I am incorrect about this?

G.Lang
Support
Support
Posts: 169
Joined: Wed 22. Sep 2010, 14:58

Re: Frequency output resolution at low frequencies

Post by G.Lang » Mon 20. Jun 2011, 10:20

Hi,

the output function
F out = value of Internal CAN Message * Output Scale Factor
is right. But the hardware limits the resolution, the minimal output resolution of the Fout is 1Hz. Fout can only increased or decreased by 1 Hz (a less step is not possible)

For example: You define in your example a scale factor of 0.010293

-> max. Ain = 5V
-> 5V = 3ffh = 1023
-> Fout = 1023 * 0.010293 = 10,5 = 10.5 Hz
-> 10.5 Hz is the max. frequency output at 5V Ain
-> from the output side only whole-numbered frequencies are possible

So in your case it´s only possible to use the following outputs: 0/1/2/3.....8/9 and 10 Hz -> 10 steps

regards
Gunther

can_beginner
Posts: 5
Joined: Wed 15. Jun 2011, 19:47

Re: Frequency output resolution at low frequencies

Post by can_beginner » Wed 22. Jun 2011, 02:01

I think I have found a way around the problem by making the system which the analogue output connects to accept a higher frequency. Thank you for your help.

G.Lang
Support
Support
Posts: 169
Joined: Wed 22. Sep 2010, 14:58

Re: Frequency output resolution at low frequencies

Post by G.Lang » Wed 22. Jun 2011, 08:06

Hi,

in your first email you wrote
....has about 10 steps across the whole range (0 - 10.5 Hz). I was hoping for much higher resolution than this - I expected 1024 steps (from the 10 bit input resolution) to cover the 0 - 10.5 Hz range, although I don't need resolution this high.
and now you write something about a higher frequency :?

A higher resolution and a higher frequcency is not the same.

regards
Gunther

Post Reply