Return to TOC Curtis 1239E-1269E Manual, os 37.0 RevA – May 2021
10 — VEHICLE CONTROL LANGUAGE (VCL)
pg. 107
I/O CONTROL WITH VCL
Digital Inputs
e controllers each have 16 digital inputs. Nine are switch inputs (Sw_1 through Sw_8, and Sw_16.
ese switch inputs are shown on the standard wiring diagram (Figure 5, page 12). e remaining
seven digital inputs are less obvious: one on each driver and digital output (Sw_9 through Sw_15).
ese can be used as digital inputs or to sense the state of the output or its wiring (e.g., open
coil check).
To address a digital input in a VCL program, use the desired input label (Sw_1 through Sw_16).
Use On or O in the code when determining a switch state; using true/false or 1/0 will give
erroneous results.
if (Sw_1 = ON)
{
;put code here to run when switch 1 is On
}
if (Sw_16 = OFF)
{
;put code here to run when switch 16 is Off
}
All switch inputs are automatically debounced by the VCL operating system. is prevents noisy
contacts or contact bounce from causing erroneous events in the application’s VCL code. The
debounce time can be varied from 0 to 32 ms in 4 ms steps, using this function:
Setup_Switches(5); 20 ms
If this line is not in the VCL code, the debounce time is set at 16 ms.
e VCL function Automate_PWM_Input() can measure the duty cycle of a PWM signal applied to
the switch (SW1 - SW16) inputs.
Driver and Digital Outputs
There are five driver outputs (PWM1 through PWM5) and two digital outputs (DigOut6 and
DigOut7). ese outputs have variations in current and frequency range. For their specications,
see Digital and PWM Outputs.
Driver outputs have high current FET output stages and can be pulse width modulated (PWM)
to vary the average output to inductive loads such as contactors and relays. is is useful when the
battery voltage needs to be brought down for lower voltage coils. e two digital outputs are 1 A
drivers that are only On or O.
Drivers use a special VCL function to set their PWM level. is PWM level can be set up in a signal
chain to update automatically or can be set directly in the main loop. PWM can be set from 0–100%
using the digital range of 0 to 32767.
Put_PWM(PWM2,16384)
will output a 50% waveform on Driver 2.
Automate_PWM(PWM2,@user1)
will continually update the Driver 2 output with the present value of variable User1. is automate
statement needs only to be run once, usually in the initialization section of the VCL program. VCL
can monitor the present value of a PWM driver: the variable PWMx_Output (where “x” is the PWM
channel number) is automatically lled with the present value of the driver output.
Quick Link:
Digital and PWM
Outputs p.16