Line/Port Manipulation With Pre-selection
|Top Previous Next|
I/O line manipulation with pre-selection works like this: you first select the line you want to work with using the io.num property. You can then read and set the state of this line using the io.state property. On certain platforms, you can also enable/disable the output buffer of the line with the io.enabled property — more on this in the Controlling Output Buffers topic. Here is a code example:
This way of controlling the lines/ports of your device is good when you are going to manipulate the same line/port repeatedly. Performance is improved because you select the line/port once and then address this line/port as many times as you need.
Note that I/O line and port names are platform-specific and are defined by pl_io_num and pl_io_port_num enums respectively. The declarations for these enums can be found in your device's platform documentation (for example, EM1000's is here).
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.