Appendix b programming statement examples, Appendix b, Programming statement examples – High Country Tek DVC80 User Manual

Page 147

Advertising
background image

P/N: 021-00154, Rev. A.6 - updated for V4.7 Tools

Page | 147

Appendix B

Programming Statement Examples

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 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
HS2 = True

If Uni_1 is greater than 5.5% and less than 10%
then…

ElseIf (Uni_1 >= 10.5%) Then
HS1 = True
HS2 = 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






Advertising
This manual is related to the following products: