User`s manual

PK220052 s Software Reference
Digital Inputs and Outputs
DIGIN1, DIGIN2, ..., DIGING16
The virtual driver variables DIGIN1, DIGIN2, ... DIGIN16 represent
the state of the digital inputs. These variables take the value 1 if the
input is high and 0 if the input is low. The value is changed only if the
new value remains the same for 2 ticks (25 to 50 milliseconds) of the
virtual driver.
void VIOInit();
VIOInit is a dummy function used as a host for the GLOBAL
_
INIT of
the virtual I/O variables. Virtual inputs are read and virtual outputs are
written out whenever the function VIODrvr() is called. Inputs are
DIGIN1 to DIGIN16. Outputs are OUT1 to OUT16. The DIGIN
values have to be the same for two successive reads to be valid.
RETURN VALUE: None.
void VIODrvr();
Updates the virtual inputs DIGIN1 to DIGIN16. The virtual outputs
OUT1 to OUT14 are send out to corresponding output ports.
RETURN VALUE: None.
Digital Input Drivers
There are several methods for reading digital inputs and setting digital
outputs on the PK2200. Below is a listing of drivers for the digital inputs
and outputs, including the high-speed DMA counters.
int up
_
digin( int channel )
Read the value at the specified digital input channel (116).
RETURN VALUE: The function returns 1 when the channel is high
and 0 when the channel is low.
unsigned inport( unsigned port )
Reads value from I/O port.
PARAMETER: port is the I/O port to be read.
RETURN VALUE: Value from I/O port.
You can read multiple PK2200 digital inputs simultaneously using the
inport() function.
DIGBANK1 is the address ( 0x180 ) of the first eight digital inputs DIN1
through DIN8. Bit zero represents the state of DIN1, bit one is DIN2,
etc. DIGBANK2 is the address ( 0x181 ) of the second eight digital
inputs DIN9 through DIN16. Bit zero represents the state of DIN9, bit
one is DIN10, etc.