Page 1 of 2

Scale & offset values in Micromod configuration Sw

Posted: Tue 23. Aug 2016, 17:26
by Laurent
Hi all,
I'm trying to use the output frequency of a Micromod Module to drive a basic servo controller. As it requires a 20ms period signal, I set the options to PWM8Bits with a 50Hz frequency.
My main issue is that RC ON signal needs to be between 1 and 2 ms (out of 20 ms). So I wanted to use the scale and offset parameters to adjust my inputs (between 0 and 255 in decimal) to the rignt values, ie dividing by 20 (scale 0.05 in decimal) and adding +1 (offset +1 in decimal).

The online documentation says:
Scale / Offset
Multiplier and offset for the data contents. These may be positive or negative floating point values.
Calculation: Output = (MsgValue * Scale) + Offset, where MsgValue is a 16-bit value [0..65535]

What should be the "Scale" and "Offset" range?
Are these values 8 or 16 bits?
Does the module accept scales values between 0 and 1(decimal)?

Thanks for your help;
Laurent

Re: Scale & offset values in Micromod configuration Sw

Posted: Wed 24. Aug 2016, 12:03
by PEAK-Support
first of all we need to know which MicroMod Module you use?
only the CPU with your own board, or one of our boards - if yes - part number?

Re: Scale & offset values in Micromod configuration Sw

Posted: Wed 24. Aug 2016, 12:24
by Laurent
Good afternoon,
I have most of your micromod modules but for this test I wanted to use a Micromod Digital 1 or 2 with the Fout0 output. My remark was more on the configuration sw and the way to use it.
If the HW doesn't fit, is it possible to use any other module for this test (Micromod demo board, Mix 1 or Mix 3)?
Regards,
Laurent

Re: Scale & offset values in Micromod configuration Sw

Posted: Wed 24. Aug 2016, 13:18
by PEAK-Support
Yes, but the configuration is depending on the used baseboards - you need to select the profile for the different base boards. The Offset is a simple Addition to the Result Value of the scaling calculation. The scale is a multiplication - as you wrote :
(MsgValue * Scale) + Offset

the Message Value is the data that you send on the defibned CAN ID
Intel or Motorola, 8 or 16 Bit - this is up to you
Also the Startposition of Byte and Bit.

The Frequenzy output is a LowSide driver with max. 10 KHz, the max. current is 0.75A

Re: Scale & offset values in Micromod configuration Sw

Posted: Wed 24. Aug 2016, 13:31
by Laurent
I undestand these informations but then what should I put into the scale field (as the offset is already 1) to make my calculation look like Output=(MsgValue*0.05)+1?
0.05 is decimal and the float value is not the same in 8 or 16bits...
Here is a screenshot of the interface in attachment
Frequency output configuration
Frequency output configuration
2016-08-24_13h31_13.png (11.8 KiB) Viewed 17207 times
As a complement of information, 2.75 coded with a 8 bits format will correspond to 0110 1011 in binay and 0x6B as described in the example below...

Re: Scale & offset values in Micromod configuration Sw

Posted: Wed 24. Aug 2016, 13:39
by PEAK-Support
what do you need frequenzy or PWM ? I was talking about frequenzy, you about PWM.
Unbenannt.JPG
Unbenannt.JPG (31.37 KiB) Viewed 17206 times

Re: Scale & offset values in Micromod configuration Sw

Posted: Wed 24. Aug 2016, 13:57
by Laurent
I used the Frequency output (Fout0) configurated in 8 bits PWM mode...

Re: Scale & offset values in Micromod configuration Sw

Posted: Wed 24. Aug 2016, 14:01
by Laurent
The example I just mentionned was not included, sorry...

Re: Scale & offset values in Micromod configuration Sw

Posted: Thu 25. Aug 2016, 12:38
by PEAK-Support
8Bit PWM is a usignedByte not a 8Bit Float (which is not common)

Re: Scale & offset values in Micromod configuration Sw

Posted: Thu 25. Aug 2016, 16:04
by G.Lang
Hello Lauren,

the possible values for scale and offset are decimal values between -65535 and 65536
micromod_values.JPG
micromod_values.JPG (48.99 KiB) Viewed 17181 times
Below an example for a 50Hz PWM Output with scale =1 (note: the logic is inverted because it´s a lowside driver)
8Bit PWM Out -> 0..100%
FFh = 255 = 0%
00h = 0 = 100%
3Fh = 63 = 75%
pwm_out_scale1.JPG
pwm_out_scale1.JPG (212.51 KiB) Viewed 17181 times
And here the same with a scale =2
pwm_out_scale2.JPG
pwm_out_scale2.JPG (197.12 KiB) Viewed 17181 times
Hope this helps.

best regards
Gunther