User guide
P/N: 021-00154, Rev. A.6 - updated for V4.7 Tools     Page | 132  
8  Programming Notes 
8.1    Examples of Program Statements and Logical Operators 
Dim Fault as Uint  Declare “Fault” as a variable for use in the project 
Dim Timer_0 as Timer  Declare “Timer_0” as a count down timer 
Dim Scale_Factor as EEmem  Declare “Scale_Factor” as a location in EEmemory 
Const Low_Limit = 256  Declare the constant “Low_Limit” to equal 256 
PWM_1.Enable = True  Set PWM_1.enable to True 
If (Dig_1 AND Dig_2) Then 
 PWM_1 = Ana_1 / Scale_Factor 
If Dig_1 and Dig_2 are true then, 
Set the value of PWM_1 to the equation (Analog input 1 divided 
by the value stored in the EEmemory location “Scale_Factor” 
ElseIf (Dig_1 OR Dig_2) Then 
 PWM_1 = (Ana_1 / Scale_Factor) / 2 
If Dig_1 or Dig_2 are true but not both then, 
Set the value of PWM_1 to the Equation (Analog input 1 divided 
by the value stored in the EEmemory location “Scale_Factor” 
divided by 2) 
ElseIf (Dig_3 XOR Dig_4) Then 
 PWM_1 = ((Ana_1 / Scale_Factor) * 2) 
If Dig_1 or Dig_2 are true but not both then,Set the value of 
PWM_1 to the Equation (Analog input 1 divided by the value 
stored in the EEmemory location “Scale_Factor” multiplied by 2) 
ElseIf (Dig_1 = NOT Dig_5) Then 
 PWM_1 = 0x0200 
If Dig_1 is not equal to Dig_5 then, 
Set the value of PWM_1 to 200hex (or 50%) 
Else 
 PWM_1 = Low_Limit 
End If 
If none of the above statements are true then, Set the value of 
PWM to the constant “Low_Limit” End of the IF Statement 
If (Uni_1 <= 5.5%) Then 
 HS1 = True 
 HS2 = False 
If Uni_1 is equal to or less than 5.5% then, 
High-Side 1 equals True 
High-Side 2 equals False 
ElseIf (Uni_1 > 5.5% and Uni_1 < 10%) Then 
 HS1 = False 
If Uni_1 is greater than 5.5% and less than 10% then, 
ElseIf (Uni_1 >= 10.5%) Then 
 HS1 = True 
End If 
If Uni_1 is equal to or greater than 10.5% Then… 
End of If Statement 
If (Uni_1 <> 0) Then 
 HS4 = True 
Else 
 HS4 = False 
End If 
If Uni_1 is not zero then, 
High-Side 4 equals True 
If Uni_1 is zero then 
High-Side 4 equals False 
End of If Statement 
If (Dig_7) Then 
 Timer_0 = 2.5s 
ElseIf (Dig_8) Then 
 Timer_0 = 500ms 
End If 
If Dig_7 is True then, 
Set Timer_0 to 2.5 seconds 
If Dig_8 is True then, 
Set Timer_0 to 500 milliseconds 
End of If Statement 
Fault = (supply >13.8sv)  If the Supply Voltage is greater than 13.8 Volts “Fault” equals 
True 
Dim Timer_0 Timer 
If (Timer_0 = 0) Then 
 Dig_1 = Not (Dig_1) 
Timer_0 = 2s 
End If 
Dim STRname as String “string “ 
VirtualDisplay.v1 = STRname 
Toggles a Digital input every time the Timer times out 
Defines STRname as string type and assigns “string” to it. 
8.2  Variable Display Types 
0 to 100% 
Scale
s the displayed value to a percentage of the value in engineering units (0 to 1023) and displays as a whole 
number. For example if the variable was displaying the input Ana_1 and the value at the input was 327 in 
engineering units (31%) then the displayed value would be 31 (%). 










