I'm looking at redesigning our existing MicroMod motherboard so that we can use your new PCAN-MicroMod FD modules in future systems and to support our existing systems. The key to my new design is to maintain as much backwards compatibility as possible with our original motherboard design, as we have a lot of systems around the globe which use 50+ MicroMods each, and I really don't want to have to reconfigure wiring if I can avoid it.
Our existing motherboard design provided an option of either 4 x PWM outputs or 2 x Analogue Outputs, or a combination of the two. To minimise eating into the digital output availability, I was considering using the two frequency outputs to provide my 2 x Analogue inputs. What I can't find in your documentation is the resolution of the duty cycle in these two outputs. Are the duty cycles capable of 16-bit adjustment just as your old MicroMods did, or do I need to look at a frequency-to-voltage converting circuit instead?
Frequency Outputs
Re: Frequency Outputs
Hello,
the two frequency outputs are based on a 10MHz timer. The equivalent resolution depends on the selected output frequency.
Example:
Output frequency for the PWM signal is set to 1kHz.
10MHz/1kHz=10000.
Equivalent bit resolution: log(10000)/log(2) = 13.29 => 13bit
With a 100Hz PWM frequency the equivalent resolution is 16bit
With 10kHz PWM frequency the equivalent resolution is 10bit.
The internal equivalent resolution is "hidden".
If you want to control the duty-cycle from the CAN-Bus, you can use a 16 bit CAN-Value of 0x0000 to set the duty cycle to 0%, and 0xffff to set the duty cycle to 100%. This means the CAN interface how to control the analog output based on the pwm-output stays compatible.
Regards, Gunnar Bohlen
the two frequency outputs are based on a 10MHz timer. The equivalent resolution depends on the selected output frequency.
Example:
Output frequency for the PWM signal is set to 1kHz.
10MHz/1kHz=10000.
Equivalent bit resolution: log(10000)/log(2) = 13.29 => 13bit
With a 100Hz PWM frequency the equivalent resolution is 16bit
With 10kHz PWM frequency the equivalent resolution is 10bit.
The internal equivalent resolution is "hidden".
If you want to control the duty-cycle from the CAN-Bus, you can use a 16 bit CAN-Value of 0x0000 to set the duty cycle to 0%, and 0xffff to set the duty cycle to 100%. This means the CAN interface how to control the analog output based on the pwm-output stays compatible.
Regards, Gunnar Bohlen
-
- Posts: 8
- Joined: Tue 25. Feb 2014, 16:51
Re: Frequency Outputs
Thanks for taking the time to provide an explanation, but I don't think I'm quite there. I've always appreciated that I could drive the duty cycle with an 8-bit, 10-bit, or even 16-bit CAN bus message. But what isn't clear to me is what step sizes are used by the MicroMod when adjusting/generating the duty cycle. It's not in your documentation for the MicroMod FD as far as I can see. And yet it was very well documented in the user manual (page 25) for the old standard MicroMod.
If I were to take this to the extreme and set up a MicroMod FD to receive 16-bit messages for the duty cycle, then send the value 0x0001 to the MicroMod, would I get a 0.001525 duty cycle? (Presuming I haven't messed up the maths). Or is the MicroMod only capable of 100 discrete steps on the two frequency outputs, thereby effectively rounding a received CAN message to the nearest 1% duty cycle? Which, in my reckoning, would mean the duty cycle would only change for multiples of 655 (0x28F).
For the systems in which we use the MicroMods, these two outputs would be driving simulated flight instruments. Therefore, the duty cycle step sizes are very crucial in making the indicated value as accurate as possible and also as smooth as possible when flight data changes.
If I were to take this to the extreme and set up a MicroMod FD to receive 16-bit messages for the duty cycle, then send the value 0x0001 to the MicroMod, would I get a 0.001525 duty cycle? (Presuming I haven't messed up the maths). Or is the MicroMod only capable of 100 discrete steps on the two frequency outputs, thereby effectively rounding a received CAN message to the nearest 1% duty cycle? Which, in my reckoning, would mean the duty cycle would only change for multiples of 655 (0x28F).
For the systems in which we use the MicroMods, these two outputs would be driving simulated flight instruments. Therefore, the duty cycle step sizes are very crucial in making the indicated value as accurate as possible and also as smooth as possible when flight data changes.
Re: Frequency Outputs
Hello,
for a better explaination I will add some examples to explain how the duty cycle is created:
The timer responsible for the PWM genaration runs with 10MHz. If you want to have a PWM output with a frequency of 1 Hz, you can imagine a counter that counts from 1 to 10,000,000. If a 20% duty cycle is required, the output is high while the counter is between 1 and 2,000,000 and low while the counter is betwenn 2,000,000 amd 10,000,000. This means the minimum step size is 1/10,000,000. The equivalent bit resoluton would be log(10,000,000)/ log(2) = 23,25 bits.
With a higher output frequency the number of steps per cycle is reduced. For a 100Hz frequency output the counter would run from 1 to 100,000. (10,000,000/100=100,000). To get a duty cycle of 30%, the output is high while the counter is in the range of 1 to 30,000, and low in the range from 30,001 to 100,000) On step is 1/100,000, this equals a bit resolution of 16.6bits.
If you use the configuration tool for MicroMod FD to configure the duty cycle, the valid value range for the dutycycle is 0...100. This is not an integer value, which would give you 100 discrete steps for the duty cycle. Insteady this value is represented a a double precision float. If you want to use a 16bit value (0x0000 to 0xffff) from the CAN-Bus to control the duty cycle from 0% to 100%, you have to choose a factor that converts the value of 0xffff into 100. The firmware calculates the required steps for a complete PWM-cycle based on the duty cycle and choosen frequency.
If you choose a frequency of 10,000,000/65,536=152.587Hz, then each PWM cycle consists of 65536 steps. This means that for every 16bit value for the duty cycle the output duty cycle is changed by one step.
I hope this answers your question.
Regads, Gunnar Bohlen
for a better explaination I will add some examples to explain how the duty cycle is created:
The timer responsible for the PWM genaration runs with 10MHz. If you want to have a PWM output with a frequency of 1 Hz, you can imagine a counter that counts from 1 to 10,000,000. If a 20% duty cycle is required, the output is high while the counter is between 1 and 2,000,000 and low while the counter is betwenn 2,000,000 amd 10,000,000. This means the minimum step size is 1/10,000,000. The equivalent bit resoluton would be log(10,000,000)/ log(2) = 23,25 bits.
With a higher output frequency the number of steps per cycle is reduced. For a 100Hz frequency output the counter would run from 1 to 100,000. (10,000,000/100=100,000). To get a duty cycle of 30%, the output is high while the counter is in the range of 1 to 30,000, and low in the range from 30,001 to 100,000) On step is 1/100,000, this equals a bit resolution of 16.6bits.
If you use the configuration tool for MicroMod FD to configure the duty cycle, the valid value range for the dutycycle is 0...100. This is not an integer value, which would give you 100 discrete steps for the duty cycle. Insteady this value is represented a a double precision float. If you want to use a 16bit value (0x0000 to 0xffff) from the CAN-Bus to control the duty cycle from 0% to 100%, you have to choose a factor that converts the value of 0xffff into 100. The firmware calculates the required steps for a complete PWM-cycle based on the duty cycle and choosen frequency.
If you choose a frequency of 10,000,000/65,536=152.587Hz, then each PWM cycle consists of 65536 steps. This means that for every 16bit value for the duty cycle the output duty cycle is changed by one step.
I hope this answers your question.
Regads, Gunnar Bohlen
-
- Posts: 8
- Joined: Tue 25. Feb 2014, 16:51
Re: Frequency Outputs
Hi Gunnar, your last explanation is perfect, thanks! I've a much better understanding now of the functionality of these two outputs and how useful (or not) they may be for my purposes.
Just to give you an idea, we currently use in our PCAN-MicroMods 8-bit PWM for backlight control, running at 100Hz, and 16-bit PWM for analogue voltage generation (0 - 10V), running at 20kHz, which is used for driving analogue instruments. The current analogue output design gives us a very smooth analogue output signal, providing us with fast and accurate voltage changes, which may even be a little over the top (0.153mV/bit).
Just to give you an idea, we currently use in our PCAN-MicroMods 8-bit PWM for backlight control, running at 100Hz, and 16-bit PWM for analogue voltage generation (0 - 10V), running at 20kHz, which is used for driving analogue instruments. The current analogue output design gives us a very smooth analogue output signal, providing us with fast and accurate voltage changes, which may even be a little over the top (0.153mV/bit).