IO Pi ports
The IO Pi Plus is a 32 channel MCP23017 GPIO expander for the Raspberry Pi
03/08/2023
Posted by:
eddieprice
03/08/2023
Posted by:
andrew
If you wire up the first four pins from the bus on the IO Pi to your PIC micro you can use it as a four bit port with the write_port(port,0xXX) instruction.
The following python code would create an instance of the IOPi object on address 0x20 and set the first four pins to be high.
iobus = IOPi(0x20)
# set port 0 as outputs
iobus.set_port_direction(0, 0x00)
iobus.write_port(0, 0x0f)
If it is easier you can use a binary number instead of hex so you can see which of the pins are being set as high and low. The code below would set pins 1 and 3 as low and 2 and 4 as high.
iobus.write_port(0, 0b00001010)
04/08/2023
Posted by:
eddieprice
Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view.
Download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.