7 more complex control program example, More complex control program example – High Country Tek DVC80 User Manual
Page 75

P/N: 021-00154, Rev. A.6 - updated for V4.7 Tools
Page | 75
5.7
More Complex Control Program Example
This example program illustrates how to program various types of processes on the DVC. The point of this
example is to show the kind of code written to make a given process work.
Processes
Valve Driver:
Drive a Dual Coil High-Side valve setup with a joystick.
AntiStall:
If the Engine RPM starts to drop, the Hydraulic load is reduced.
Bang-Bang:
Drive two Bang-bang valves with two digital switches.
Flash LED:
Pulse a High-Side output to drive an LED.
Pulse Regulation:
PID a PWM output to regulate a Pulse input to a Pot input
Valve Driver
Three lines of code are required to drive a Dual Coil High-Side Valve with a joystick. In the setup, there is an
output group set up as a Dual Coil High-Side and an analog Joystick with the Center Enabled.
PWM_1 = Joystick
This line of code sets the desired current percentage. The PWM_1 variable accepts a
number from 0 to 1023 or 0% to 100% to set the current PID setpoint. The Joystick variable changes with the
joystick position and is set to a value of 0 to 1023 or 0% to 100%.
PWM_1.dir = JoyStick.dir
This command allows dual High-Side valves to switch directions. The direction
can be set to the name of the High-Side valve. In this example it would be Fwd_Coil or Rev_Coil. On this
command, the PWM_1.dir is set to the Joystick's Direction. Because the joystick was setup with a center point,
the direction of the joystick can be determined. The joystick’s direction can be tested to the names given in the
setup, rather than testing if it is true or false.