366
Platforms
©2000-2008 Tibbo Technology Inc.
device. Two enum constant sets -- pl_io_num and pl_io_port_num -- define the
set of available lines and ports. You can find the declaration of these enums in the
"Platform-dependent Constants" section of your platform documentation.
There are two different methods for controlling I/O lines (ports):
;
.
I/O lines of your device can work as both inputs and outputs --
topic explains this.
Some I/O lines can work as interrupts -- see
for
explanation. The list of available interrupt lines is platform-specific. The
pl_int_num enum constant set defines the set of related variables. You can find the
declaration of this enum in the "Platform-dependent Constants" section of your
platform documentation.
On many devices, a number of I/O lines may be shared with inputs/outputs of
special function blocks (serial ports, etc.). When a special function block is
enabled, I/O lines it uses cannot (should not) be manipulated though the io object.
Line/Port Manipulation With Pre-selection
I/O line manipulation with pre-selection works like this: you first select the line
you want to work with using the
property. You can then read and set the
property. On certain platforms, you can also
enable/disable the output buffer of the line with the
property -- more
on this in the
topic. Here is a code example:
io.num=PL_IO_NUM_5
'select line #5
io.enabled=YES
'enable this line
io.state=HIGH
'set this line to HIGH
io.state=LOW
'now set this line to LOW
io.enabled=NO
'configure the line as input now
x=io.state
'read the state of the line
Same can be done with ports -- use
,
, and
properties to achieve this:
366
367
368
369
372
375
370
368
374
375
373