Automate_PWM(2)
This function is used automatically update the PWM output. This function only need be called
once. After this function is called, the PWM output it will run continuously. Note that in this
function, the output variable must be a variable.
Parameters
PWM# Identifies which PWM channel is to be read
• can be PWM1 through PWM16
Variable The variable that hold the desired output voltage
• The scale is 0-32767 = 0 to 100% ON.
Returns
0 – Setup did not execute.
1 – Setup successful.
Error Codes
Bad_ID = an incorrect PWM ID was used.
PT_Range = the Variable used is not acceptable
Examples
User1 = 0
Automate_PWM (PWM1, User1)
Loop: User1 = User1 +1 ;This will create a 0 to 100% PWM ramp Output 1
If User1 = 32767
{
User1 = 0
}
; add some delay or code here
Goto Loop
1310 Vehicle Control System Users Manual Release Rev B Page 33 of 51