IPAM IO in BCL

IPAM 100 features parallel input and output pins (PIO). In ABCL most of the PIOs are controllable in software.

Reserved PIOs

Several PIOs are reserved for standard functions on the ABCL firmware. Those are:

  • PIO 24 and 25 - red and green LED
  • PIO 8 - reset button
  • PIO 17 - one-wire RTC (IPAM carrier board only)

Programmable PIOs

There are 8 freely programmable PIOs available on IPAM 100:

  • PIO 11
  • PIO 16
  • PIO 17 (not on IPAM carrier board)
  • PIO 20
  • PIO 22
  • PIO 23
  • PIO 29
  • PIO 30

PIO control in BCL

The above PIOs can be used as inputs as well as outputs. By default all are initialised as inputs with internal pull-up resistor.

The PIOs are read with the iostate command and written with the ioctl command. The ABCL technical manual provides a complete IO map for the IPAM 100. The map is divided into logical sections: relays, digital inputs, digital outputs, analog inputs, etc. The PIOs are mapped to both digital inputs as well as digital outputs.

Reading a PIO (iostate on a digital input) switches the respective pin to an input, writing a PIO (ioctl on a digital output) switches the respective pin to an output.

IMPORTANT: If you have an external peripherals attached to PIOs do not call ioctl on a PIO which is an input. This may damage the hardware!

Example

We want to use PIOs 11, 16, 17 and 20 as inputs and PIOs 22, 23, 29 and 30 as outputs. By default all are initialised as inputs.

PIOs 11, 16, 17 and 20 are mapped to digital inputs 201, 202, 203 and 204 as well as to digital output 101, 102, 103 and 104.

PIOs 22, 23, 29 and 30 are mapped to digital inputs 205, 206, 207 and 208 as well as to digital output 105, 106, 107 and 108.

To read the first four PIOs as inputs, use:

iostate (201)    ' read input PIO 11
iostate (202)    ' read input PIO 16
iostate (203)    ' read input PIO 17
iostate (204)    ' read input PIO 20

To control the last four PIOs as outputs, use:

ioctl(105,0)    ' set PIO 22 to output value 0
ioctl(106,0)    ' set PIO 23 to output value 0
ioctl(107,0)    ' set PIO 29 to output value 0
ioctl(108,0)    ' set PIO 30 to output value 0

ioctl(105,1)    ' set PIO 22 to output value 1
ioctl(106,1)    ' set PIO 23 to output value 1
ioctl(107,1)    ' set PIO 29 to output value 1
ioctl(108,1)    ' set PIO 30 to output value 1


Back to IPAM_100