Well yes, so 0-100% PWM Output which is 0-5v which is 0-21% of O2. Sensible to concentrate operation to just the important bits you need.
First problem I see is right at the beginning where your math is insufficient for 0.1% resolution...
example1:
InputDutyCycle=55
55-30=25. Multiplied by 42 gives 1050 (or 10.50%)
example 2:
InputDutyCycle=56
50-30=26. Multiplied by 42 gives 1092 (or 10.92%).
You can see this isn't good enough. The Math getting the resultant into InputDutyCycle should give you a result which is at least a factor of five (at a minimum) bigger to get anywhere close to your resolution. Basically your scale of 30-80 (0-50) is too small... your math getting to here needs a far bigger scale (at least 0-210 for 0.1% resolution).
What is your PWM frequency or give me some typical values for PulseHigh and PulseLow and I'll show you how to achieve this.




Bookmarks