How to use IF math function
Posted: Thu 24. Oct 2019, 14:32
Hello,
I'm using the PWM output D0 at 128Hz to control an LED with a sine wave modulation using a characteristic curve lookup table. The index to the table is controlled by a ramp function having a step of 5, 5ms process rate and reset value to give a 1 Hz period. I now want to change the 1Hz period to faster or slower by use of a input variable. Unfortunately, dynamically changing the ramp step size from a control variable to effect the 1Hz period time was unsuccessful.
Q1: It appears that once started the ramp step size appears unchangeable. Please confirm.
Q2: In place of the ramp function block, how can I implement a simple counter with reset using a variable? The math function addition is straight forward. My question is how to use the Math Function "if greater or equal" to reset the rolling counter? Can you provide an example of the IF statement to change a variable?
The MIO PPCAN Editor2 Referance Doc, P59 references Parameter 5 LinesPerformedifTrue. I would like an example of this for MIO 32-Bit version hardware.
Q3: Is there a C compiler available for the MIO module?
Thanks,
Kevin
I'm using the PWM output D0 at 128Hz to control an LED with a sine wave modulation using a characteristic curve lookup table. The index to the table is controlled by a ramp function having a step of 5, 5ms process rate and reset value to give a 1 Hz period. I now want to change the 1Hz period to faster or slower by use of a input variable. Unfortunately, dynamically changing the ramp step size from a control variable to effect the 1Hz period time was unsuccessful.
Q1: It appears that once started the ramp step size appears unchangeable. Please confirm.
Q2: In place of the ramp function block, how can I implement a simple counter with reset using a variable? The math function addition is straight forward. My question is how to use the Math Function "if greater or equal" to reset the rolling counter? Can you provide an example of the IF statement to change a variable?
The MIO PPCAN Editor2 Referance Doc, P59 references Parameter 5 LinesPerformedifTrue. I would like an example of this for MIO 32-Bit version hardware.
Q3: Is there a C compiler available for the MIO module?
Thanks,
Kevin