User`s manual

PK2100
5-2 s Software Reference
Driver Software
Drivers in the Dynamic C software library make it easy to communicate
with the PK2100 inputs and outputs. Drivers may be direct or indirect. A
direct driver immediately reads or writes to the controlled hardware. An
indirect driver uses intermediate variables. Z-Worlds virtual driver is a
periodically called interrupt service routine that connects the hardware
with intermediate variables.
Drivers may be low-level drivers that return, send, or transmit values
when the values are received or presented by the interface. High-level
drivers modify the inputs or outputs in some way, such as by introducing
calibration, hysteresis or averaging. Indirect, high-level drivers are
preferred because they eliminate any concern about the technical details of
the input/output interface. The price for this convenience is a slight loss
of speed and efficiency.
Digital Input
Direct Driver
int up_digin( int channel )
Gets the value at the specified digital input channel (17). The
function returns 1 when the channel is high and 0 when the channel is
low.
Virtual Driver
Reference the parameters DIGIN1, DIGIN2, DIGIN3, DIGIN4, DIGIN5,
DIGIN6, and DIGIN7. For example,
heater = DIGIN1 || DIGIN2;
These variables take the value 1 if the input is high (greater than 2.5volts)
and 0 if the input is low. The parameter value changes only if the new
value remains the same for 2 ticks (2550 ms) of the virtual driver.
Digital Output
Direct Driver
int up_setout( int channel, int value )
Passes channel number 110 and value 0 for OFF, 1 for ON. If
channel is 11 or 12, relay 1 or 2 is switched.
Indirect Driver
Set the variables OUT1, OUT2, OUT3, ... OUT9, OUT10 to a value of 0 to
turn the output off, or to a value of 1 to turn the output on. Outputs pull
low when turned on. The variables RELAY1 and RELAY2 control the relay
contacts.