Wesley BC-620-4CA User Manual

Page 92

Advertising
background image

88

Curtis 1234/36/38 Manual,

OS

11

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.
This prevents noisy contacts or contact bounce from causing erroneous events
in your VCL code. The debounce time can be varied from 0 to 32 milliseconds
in 4ms steps, using this function:

Setup_Switches(5); 20 milliseconds

If this line is not in the VCL code, the debounce time is set at 16 ms.

Driver and Digital Outputs

There are five driver outputs (PWM1 through PWM5) and two digital out-
puts (DigOut6 and DigOut7). These outputs have variations in current and
frequency range. For their specifications, see “high power outputs” and “low
power outputs” on page 19.

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. This is useful when the battery voltage needs to be
brought down for lower voltage coils. The two digital outputs on the 1236/38
are low current NPN transistor drivers that are only On or Off. They work well
for driving LEDs or for interfacing to another digital device. The two digital
outputs on the 1234 are 1-amp drivers that are only On or Off.

Drivers use a special VCL function to set their PWM level. This PWM

level can be set up in a signal chain to update automatically or can be set di-
rectly 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. This automate statement needs only to be run once, usually in the ini-
tialization 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 filled with the present value of the driver output.

The proportional driver (Driver 5) is different from Drivers 1–4. It can

be controlled in two ways: with the proportional driver processing function (see
Figure 16, page 97) or with the VCL Put_PWM() function. The VCL statement
Put_PWM(PWM5, 16383) will result in a 50% PWM output on pin 2 only
if the parameter PD Enable is set to Off. See page 95 for more information on
interfacing the proportional driver.

Control of the two digital outputs (Digital Outputs 6 and 7) is done

using the VCL functions Set_Digout() and Clear_Digout().

7 — VCL

Advertising