APPENDIX A — VCL FUNCTIONS
pg. 125
Curtis Model 1351 – December 2018
Function Name
new/unique to 1351 = (
✔
)
Arguments
Short Comment
Description
Automate_Driver
3
(Driver,@Source, mode)
VCL_FUNCTION automate_driver; Make a pwm
output update on automatically every 4ms
Setup_Ramp
4
Setup a ramp
This function allows you to initialize the following
ramp variables. Warning: before you use a ramp
you MUST set it up.
Automate_Ramp
4
Set the ramping up to be done
automatically
This function allows you to set up a ramp that
runs automatically on each clock tick. You can
specify a Variable that will be the “target” of the
ramp as well as a Variable that can control the
ramp hold function. A value of 0 for Target, Hold
or Rate leaves the value unchanged. This allows
you to set some values (as constants) using the
setup routine while allowing run-time control
over others. For example, to set the target but
have automatic control over the ramp hold (using
whatever values is written to user1), you’d set
FP2 (Target) to 0 and FP3 (Hold) to @user1.
Set_Ramp_Target
2
Set the Target Ramp Value
This function installs a new target value.
Set_Ramp_Hold
2
Set the Ramp Hold value
This function installs a new value for the hold-
control. A value of 0 enables the ramps. Any non-
zero value will hold the ramp at its present value.
Set_Ramp_Rate
2
Set the Ramp Rate Value
This function installs a new value for the rate. On
each clock tick (1 millisecond) this value will be
added or subtracted from the current ramp value
if it is not already equal to the target value.
Random_Seed
1
'Seed' the random number
generator
The random number generator is automatically
seeded with the value of KSI * 2 when the system
starts up. If you want, you can use some other
pseudo-random number as the seed; or, write a
particular number as the seed so that you always
get the same (pseudo-random) sequence
Random
0
Return a (pseudo) random number
This routine returns the next (pseudo) random
number.
Automate_Scale
3
Set the Scaling up to be done
automatically
This function automates the scaling process.
If the second (Input) or third (scale factor)
parameters are set to a non-zero value, then that
is assumed to be an index into the variable table
where the actual value is stored. If the index to
the scaling factor is not set (i.e. Scale = 0) then
its value will not be altered by this routine and
you can set it using a call to setup_scale_factor().
Setup_Scale_Factor
2
Setup a Scaling Factor
This function installs a scaling factor in the
designated scaling block. The scaling factor is a
signed, 16-bit, integer that will be interpreted as
a percentage (i.e., 32767 = 1, 16383 = 0.5, and
so on).
Scale_Value
2
Return the value of the input scaled
by the Scale Factor
This function returns the value scaled by
the block's scaling factor. The scale factor is
interpreted as a 16-bit, signed, integer. For
example, if the scale factor were 16,383 (equal
to 50%), and the input value was 400, then the
output would be 200.