I'm not sure if I'm doing something wrong, or running into a bug.
The default duty-cycle math channel, for example, duty(A), seems to measure high voltage as on-time, as opposed to low voltage as on-time.
No problem, I tell myself. I'll simply flip it myself by subtracting the duty cycle from 100, 100-duty(A)
Problem is, my custom formula always returns zero. I don't think my math is incorrect. Is there something I did wrong, does it expect spaces, around the minus(-) sign? Or is this some weird syntax-parsing bug that I've run into?
In the meantime, if anyone else is experiencing this problem, the following math formula appears to be working for me:
(duty(A)-100)*-1
I'm simply reversing the subtraction problem, which will yield a negative number, and the multiplying the result by -1, which will turn it back into a positive number. Seems a little silly to have to go this route, buy it seems to work.
Attached is my sample waveform. I was trying to determine the duty-cycle of an IAC valve. The black line is the Pico default duty-cycle math channel. The purple line is the 100-duty(A) which always seems to return 0. And the orange one is my "fix":(duty(A)-100)*-1
Hi Curt,
Small correction on my comment.
I had the same problem a time ago and simply tried few tings which did not work, finally got the solution like this.
I have added the minus on front of the channel letter.
So instead of default: "duty(A)" changed to this: "duty(-A)". I have also added the formula to the waveform and attached here.