Page 1 of 1

Setting PWM Time Threshold to 0.6 ms

Posted: Sat Aug 04, 2012 12:24 am
by kjones6039
Phil,

Is it just me or has anyone else noticed that they can't set 'PWM Time Threshold', under Injector Characteristics, to 0.6 ms?

I noticed this a long time ago with various versions of TS and firmware. If I enter 0.6 in the dialog, close it and reopen, the setting reverts to .7! If I enter 0.5 or 0.7 it saves the value correctly.

Just curious about it.........

Ken

EDIT: I did a little poking around and found a couple other settings that do the same thing... ie. 0.2 reverts to 0.1 and 1.1 reverts to 1.0

Re: Setting PWM Time Threshold to 0.6 ms

Posted: Sat Aug 04, 2012 4:37 am
by jsmcortina
The time threshold is actually in 0.128ms units, so there's always some rounding.

I would always suggest setting it to a few 0.1ms longer than your "dead time" in any case to make SURE that the injector gets a good "peak" current and opens reliably.

James

Re: Setting PWM Time Threshold to 0.6 ms

Posted: Sat Aug 04, 2012 5:01 am
by LT401Vette
There are 2 representations for setting values, Human Readable and the binary controller values.

The binary values in the controller are usually integer based and may represent something like the number of clock ticks in the MegaSquirt. As a human it is easier to read that as ms. So TunerStudio converts all values from the byte msValues to human userValues based on the scale and translate defined in the ini using this formula:
msValue = userValue / scale - translate
userValue = (msValue + translate) * scale

Then in the ini the number of decimal places is defined. So looking at a setting like 'PWM Time Threshold'
injPwmT = scalar, U08, 613, "ms", 0.12800, 0.128, 0.00, 32.64, 1 ; * ( 1 byte)

It is has a scale of 0.128, a translate of 0.128 and is defined to display 1 decimal place.

so a userValue of 0.7 would be converted to binary as such:

msValue = (0.6 / 0.128) - 0.128
msValue = 4.5595

But now that it is to be stored as a byte, the decimal places are lost, a byte can only hold integer values 0-255. So it will be rounded to a 5 and stored.

So then when it gets converted back to a user value:
userValue = (5+ 0.128) * 0.128
userValue = 0.656384

as 1 decimal place is defined, this will then be displayed back as 0.7.

With the defined scale and translate there is not enough resolution to hold a representation for every 0.1 value

You shouldn't need to close and reopen the dialog, it should be converted to the closest possible value as soon as you tab out of the text area.