Author | Rob Jansen, Copyright © 2024..2024, all rights reserved. |
Adapted-by | |
Compiler | 2.5r8 |
Library functions for the MCP23S08. The port and individual port bits are all accessed using pseudo variables. In this way accessing the pins is the same as accessing PIC IO pins. The provided pin functions are (x = 0..7): mcp23s08_pinx_direction using value INPUT/OUTPUT mcp23s08_pinx_polarty using value ENABLED/DISABLED mcp23s08_pinx using value HIGH/LOW mcp23s08_latchx using value HIGH/LOW mcp23s08_pull_upx using value ENABLED/DISABLED Port pseudo variables, activating all pins at once: mcp23s08_port_direction Bits 0 = output, 1 = input mcp23s08_port_polarity Bits 0 = normal, 1 = inverted mcp23s08_port Bits 0 = LOW, 1 = HIGH mcp23s08_latch Bits 0 = LOW, 1 = HIGH mcp23s08_pull_up Bits 0 = DISABLED, 1 = ENABLED All other functions are provided via procedures and functions as described in the Public API section.
Microchip MCP23008/MCP23S08 8-bit I/O Expander with serial interface. Datasheet DS20001919F.
No dependency found
const byte _MCP23S08_IPOL = 0x01
const byte _MCP23S08_GPPU = 0x06
const byte _MCP23S08_INTCON = 0x04
const byte _MCP23S08_IODIR = 0x00
const byte _MCP23S08_GPIO = 0x09
const byte _MCP23S08_GPINTEN = 0x02
const byte _MCP23S08_IOCON = 0x05
const byte _MCP23S08_INTF = 0x07
const byte _MCP23S08_DEFVAL = 0x03
const byte _MCP23S08_INTCAP = 0x08
const byte _MCP23S08_OLAT = 0x0A
mcp23s08_pin7'put(bit in level)
mcp23s08_latch5'put(bit in level)
mcp23s08_pin4'put(bit in level)
mcp23s08_port'put(byte in value)
mcp23s08_set_interrupt_output_open_drain()
mcp23s08_pin3_polarity'put(bit in polarity)
mcp23s08_pin2'put(bit in level)
mcp23s08_pin0'put(bit in level)
mcp23s08_pin6_polarity'put(bit in polarity)
mcp23s08_pin5'put(bit in level)
mcp23s08_pin3'put(bit in level)
mcp23s08_latch3'put(bit in level)
mcp23s08_pull_up7'put(bit in level)
mcp23s08_pull_up'put(byte in value)
mcp23s08_pull_up1'put(bit in level)
mcp23s08_pull_up2'put(bit in level)
mcp23s08_set_interrupt_control(byte in value)
mcp23s08_pull_up0'put(bit in level)
mcp23s08_port_direction'put(byte in direction)
mcp23s08_pin2_polarity'put(bit in polarity)
mcp23s08_pin0_polarity'put(bit in polarity)
mcp23s08_latch0'put(bit in level)
mcp23s08_pull_up6'put(bit in level)
mcp23s08_port_polarity'put(byte in polarity)
mcp23s08_enable_hardware_address()
mcp23s08_set_interrupt_output_driving()
mcp23s08_set_interrupt_on_change(byte in value)
mcp23s08_pull_up5'put(bit in level)
mcp23s08_pin2_direction'put(bit in direction)
mcp23s08_pin4_polarity'put(bit in polarity)
mcp23s08_pin1'put(bit in level)
mcp23s08_latch7'put(bit in level)
mcp23s08_disable_hardware_address()
mcp23s08_pin7_polarity'put(bit in polarity)
mcp23s08_pin5_direction'put(bit in direction)
mcp23s08_pin7_direction'put(bit in direction)
mcp23s08_latch6'put(bit in level)
mcp23s08_pull_up4'put(bit in level)
mcp23s08_latch2'put(bit in level)
mcp23s08_pin5_polarity'put(bit in polarity)
mcp23s08_latch4'put(bit in level)
mcp23s08_pin1_direction'put(bit in direction)
mcp23s08_pin3_direction'put(bit in direction)
mcp23s08_pin6_direction'put(bit in direction)
mcp23s08_latch'put(byte in value)
mcp23s08_pin6'put(bit in level)
mcp23s08_set_interrupt_compare_value(byte in value)
mcp23s08_pin1_polarity'put(bit in polarity)
mcp23s08_pin4_direction'put(bit in direction)
mcp23s08_set_interrupt_active_high()
mcp23s08_pull_up3'put(bit in level)
mcp23s08_set_interrupt_active_low()
mcp23s08_latch1'put(bit in level)
mcp23s08_pin0_direction'put(bit in direction)
mcp23s08_pull_up6'get() return bit
mcp23s08_pin6_direction'get() return bit
mcp23s08_latch3'get() return bit
mcp23s08_pin4_polarity'get() return bit
mcp23s08_pin0_polarity'get() return bit
mcp23s08_pin1_direction'get() return bit
mcp23s08_pull_up1'get() return bit
mcp23s08_pin4_direction'get() return bit
mcp23s08_pin5_polarity'get() return bit
mcp23s08_latch7'get() return bit
mcp23s08_pin7_polarity'get() return bit
mcp23s08_pin2_polarity'get() return bit
mcp23s08_pin3_polarity'get() return bit
mcp23s08_pin3'get() return bit
mcp23s08_latch6'get() return bit
mcp23s08_port_polarity'get() return byte
mcp23s08_latch2'get() return bit
mcp23s08_latch0'get() return bit
mcp23s08_pin3_direction'get() return bit
mcp23s08_latch1'get() return bit
mcp23s08_get_interrupt_capture() return byte
mcp23s08_get_interrupt_flags() return byte
mcp23s08_pull_up7'get() return bit
mcp23s08_port_direction'get() return byte
mcp23s08_pin0'get() return bit
mcp23s08_port'get() return byte
mcp23s08_pull_up4'get() return bit
mcp23s08_pin7'get() return bit
mcp23s08_latch'get() return byte
mcp23s08_pull_up3'get() return bit
mcp23s08_latch5'get() return bit
mcp23s08_latch4'get() return bit
mcp23s08_pin6_polarity'get() return bit
mcp23s08_pin5_direction'get() return bit
mcp23s08_pin1'get() return bit
mcp23s08_pin2_direction'get() return bit
mcp23s08_pin1_polarity'get() return bit
mcp23s08_pin4'get() return bit
mcp23s08_pull_up5'get() return bit
mcp23s08_pin7_direction'get() return bit
mcp23s08_pin2'get() return bit
mcp23s08_pull_up2'get() return bit
mcp23s08_pin6'get() return bit
mcp23s08_pin0_direction'get() return bit
mcp23s08_pin5'get() return bit
mcp23s08_pull_up'get() return byte
mcp23s08_pull_up0'get() return bit
const byte _MCP23S08_IPOL = 0x01
No documentation found
const byte _MCP23S08_GPPU = 0x06
No documentation found
const byte _MCP23S08_INTCON = 0x04
No documentation found
const byte _MCP23S08_IODIR = 0x00
Configuration and control registers of the MCP23008/MCP23S08 (MCP23x08).
const byte _MCP23S08_GPIO = 0x09
No documentation found
const byte _MCP23S08_GPINTEN = 0x02
No documentation found
const byte _MCP23S08_IOCON = 0x05
No documentation found
const byte _MCP23S08_INTF = 0x07
No documentation found
const byte _MCP23S08_DEFVAL = 0x03
No documentation found
const byte _MCP23S08_INTCAP = 0x08
Read only.
const byte _MCP23S08_OLAT = 0x0A
No documentation found
mcp23s08_pin7'put(bit in level)
Pseudo variable to set the level of port pin 7. Level FALSE represents LOW, TRUE represents HIGH.
mcp23s08_latch5'put(bit in level)
Pseudo variable to set the level of latch bit 5. Level FALSE represents LOW, TRUE represents HIGH.
mcp23s08_pin4'put(bit in level)
Pseudo variable to set the level of port pin 4. Level FALSE represents LOW, TRUE represents HIGH.
mcp23s08_port'put(byte in value)
Pseuse variable to set the port value. Value with bits set represents HIGH, bits cleared represents LOW.
mcp23s08_set_interrupt_output_open_drain()
Set the interrupt output to open drain.
mcp23s08_pin3_polarity'put(bit in polarity)
Pseudo variable to set the input polarity of pin 3. Polarity ENABLED (TRUE) is inverted, polarity DISABLED (FALSE) is normal.
mcp23s08_pin2'put(bit in level)
Pseudo variable to set the level of port pin 2. Level FALSE represents LOW, TRUE represents HIGH.
mcp23s08_pin0'put(bit in level)
Pseudo variable to set the level of port pin 0. Level FALSE represents LOW, TRUE represents HIGH.
mcp23s08_pin6_polarity'put(bit in polarity)
Pseudo variable to set the input polarity of pin 6. Polarity ENABLED (TRUE) is inverted, polarity DISABLED (FALSE) is normal.
mcp23s08_pin5'put(bit in level)
Pseudo variable to set the level of port pin 5. Level FALSE represents LOW, TRUE represents HIGH.
mcp23s08_pin3'put(bit in level)
Pseudo variable to set the level of port pin 3. Level FALSE represents LOW, TRUE represents HIGH.
mcp23s08_latch3'put(bit in level)
Pseudo variable to set the level of latch bit 3. Level FALSE represents LOW, TRUE represents HIGH.
mcp23s08_pull_up7'put(bit in level)
Pseudo variable to set the resistor pull-up configuration of port pin 7. Level TRUE represents ENABLED, FALSE represents DISABLED.
mcp23s08_pull_up'put(byte in value)
Pseudo variable to set the resistor pull-up configuration. Value with bits set represents ENABLED, bits cleared represents DISABLED.
mcp23s08_pull_up1'put(bit in level)
Pseudo variable to set the resistor pull-up configuration of port pin 1. Level TRUE represents ENABLED, FALSE represents DISABLED.
mcp23s08_pull_up2'put(bit in level)
Pseudo variable to set the resistor pull-up configuration of port pin 2. Level TRUE represents ENABLED, FALSE represents DISABLED.
mcp23s08_set_interrupt_control(byte in value)
Set the interrupt control value. See datasheet for details.
mcp23s08_pull_up0'put(bit in level)
Pseudo variable to set the resistor pull-up configuration of port pin 0. Level TRUE represents ENABLED, FALSE represents DISABLED.
mcp23s08_port_direction'put(byte in direction)
Pseudo variable to set the port direction. Direction with bits set are to INPUT, bits cleared are set to OUTPUT.
mcp23s08_pin2_polarity'put(bit in polarity)
Pseudo variable to set the input polarity of pin 2. Polarity ENABLED (TRUE) is inverted, polarity DISABLED (FALSE) is normal.
mcp23s08_pin0_polarity'put(bit in polarity)
Pseudo variable to set the input polarity of pin 0. Polarity ENABLED (TRUE) is inverted, polarity DISABLED (FALSE) is normal.
mcp23s08_latch0'put(bit in level)
Pseudo variable to set the level of latch bit 0. Level FALSE represents LOW, TRUE represents HIGH.
mcp23s08_pull_up6'put(bit in level)
Pseudo variable to set the resistor pull-up configuration of port pin 6. Level TRUE represents ENABLED, FALSE represents DISABLED.
mcp23s08_port_polarity'put(byte in polarity)
Pseudo variable to set the port input polarity. Polarity with bits set are inverted, bits cleared are normal.
mcp23s08_enable_hardware_address()
Enable the use of the SPI hardware address.
mcp23s08_set_interrupt_output_driving()
Set the interrupt output to driving.
mcp23s08_set_interrupt_on_change(byte in value)
Set interrupt on change register. Bit set is ENABLE, bit clear is DISABLE. See datasheet for details.
mcp23s08_pull_up5'put(bit in level)
Pseudo variable to set the resistor pull-up configuration of port pin 5. Level TRUE represents ENABLED, FALSE represents DISABLED.
mcp23s08_pin2_direction'put(bit in direction)
Pseudo variable to set the pin direction of pin 2. Direction TRUE equals INPUT, direction FALSE equals OUTPUT.
mcp23s08_pin4_polarity'put(bit in polarity)
Pseudo variable to set the input polarity of pin 4. Polarity ENABLED (TRUE) is inverted, polarity DISABLED (FALSE) is normal.
mcp23s08_pin1'put(bit in level)
Pseudo variable to set the level of port pin 1. Level FALSE represents LOW, TRUE represents HIGH.
mcp23s08_latch7'put(bit in level)
Pseudo variable to set the level of latch bit 7. Level FALSE represents LOW, TRUE represents HIGH.
mcp23s08_disable_hardware_address()
Disable the use of the SPI hardware address.
mcp23s08_pin7_polarity'put(bit in polarity)
Pseudo variable to set the input polarity of pin 7. Polarity ENABLED (TRUE) is inverted, polarity DISABLED (FALSE) is normal.
mcp23s08_pin5_direction'put(bit in direction)
Pseudo variable to set the pin direction of pin 5. Direction TRUE equals INPUT, direction FALSE equals OUTPUT.
mcp23s08_pin7_direction'put(bit in direction)
Pseudo variable to set the pin direction of pin 7. Direction TRUE equals INPUT, direction FALSE equals OUTPUT.
mcp23s08_latch6'put(bit in level)
Pseudo variable to set the level of latch bit 6. Level FALSE represents LOW, TRUE represents HIGH.
mcp23s08_pull_up4'put(bit in level)
Pseudo variable to set the resistor pull-up configuration of port pin 4. Level TRUE represents ENABLED, FALSE represents DISABLED.
mcp23s08_latch2'put(bit in level)
Pseudo variable to set the level of latch bit 2. Level FALSE represents LOW, TRUE represents HIGH.
mcp23s08_pin5_polarity'put(bit in polarity)
Pseudo variable to set the input polarity of pin 5. Polarity ENABLED (TRUE) is inverted, polarity DISABLED (FALSE) is normal.
mcp23s08_latch4'put(bit in level)
Pseudo variable to set the level of latch bit 4. Level FALSE represents LOW, TRUE represents HIGH.
mcp23s08_pin1_direction'put(bit in direction)
Pseudo variable to set the pin direction of pin 1. Direction TRUE equals INPUT, direction FALSE equals OUTPUT.
mcp23s08_pin3_direction'put(bit in direction)
Pseudo variable to set the pin direction of pin 3. Direction TRUE equals INPUT, direction FALSE equals OUTPUT.
mcp23s08_pin6_direction'put(bit in direction)
Pseudo variable to set the pin direction of pin 6. Direction TRUE equals INPUT, direction FALSE equals OUTPUT.
mcp23s08_latch'put(byte in value)
Pseudo variable to set the latch value. Value with bits set represents HIGH, bits cleared represents LOW.
mcp23s08_pin6'put(bit in level)
Pseudo variable to set the level of port pin 6. Level FALSE represents LOW, TRUE represents HIGH.
mcp23s08_set_interrupt_compare_value(byte in value)
Set interrupt compare value. See datasheet for details.
mcp23s08_pin1_polarity'put(bit in polarity)
Pseudo variable to set the input polarity of pin 1. Polarity ENABLED (TRUE) is inverted, polarity DISABLED (FALSE) is normal.
mcp23s08_pin4_direction'put(bit in direction)
Pseudo variable to set the pin direction of pin 4. Direction TRUE equals INPUT, direction FALSE equals OUTPUT.
mcp23s08_set_interrupt_active_high()
Set the interrupt polarity to active HIGH.
mcp23s08_pull_up3'put(bit in level)
Pseudo variable to set the resistor pull-up configuration of port pin 3. Level TRUE represents ENABLED, FALSE represents DISABLED.
mcp23s08_set_interrupt_active_low()
Set the interrupt polarity to active LOW.
mcp23s08_latch1'put(bit in level)
Pseudo variable to set the level of latch bit 1. Level FALSE represents LOW, TRUE represents HIGH.
mcp23s08_pin0_direction'put(bit in direction)
Pseudo variable to set the pin direction of pin 0. Direction TRUE equals INPUT, direction FALSE equals OUTPUT.
_mcp23s08_write_data(byte in register, byte in data)
Write a byte to the given register of the MCP23S08 via the SPI interface.
mcp23s08_pull_up6'get() return bit
Pseudo variable to get the resistor pull-up configuration of port pin 6. Return value TRUE represents ENABLED, FALSE represents DISABLED.
mcp23s08_pin6_direction'get() return bit
Pseudo variable to get the pin direction of pin 6. Return value TRUE equals INPUT, FALSE equals OUTPUT.
mcp23s08_latch3'get() return bit
Pseudo variable to get the level of latch bit 3. Return value TRUE represents level is HIGH, FALSE represents level is LOW.
mcp23s08_pin4_polarity'get() return bit
Pseudo variable to get the input polarity of pin 4. Return value TRUE represents inverted, polarity FALSE represents normal.
mcp23s08_pin0_polarity'get() return bit
Pseudo variable to get the input polarity of pin 0. Return value TRUE represents inverted, polarity FALSE represents normal.
mcp23s08_pin1_direction'get() return bit
Pseudo variable to get the pin direction of pin 1. Return value TRUE equals INPUT, FALSE equals OUTPUT.
mcp23s08_pull_up1'get() return bit
Pseudo variable to get the resistor pull-up configuration of port pin 1. Return value TRUE represents ENABLED, FALSE represents DISABLED.
mcp23s08_pin4_direction'get() return bit
Pseudo variable to get the pin direction of pin 4. Return value TRUE equals INPUT, FALSE equals OUTPUT.
mcp23s08_pin5_polarity'get() return bit
Pseudo variable to get the input polarity of pin 5. Return value TRUE represents inverted, polarity FALSE represents normal.
mcp23s08_latch7'get() return bit
Pseudo variable to get the level of latch bit 7. Return value TRUE represents level is HIGH, FALSE represents level is LOW.
mcp23s08_pin7_polarity'get() return bit
Pseudo variable to get the input polarity of pin 7. Return value TRUE represents inverted, polarity FALSE represents normal.
mcp23s08_pin2_polarity'get() return bit
Pseudo variable to get the input polarity of pin 2. Return value TRUE represents inverted, polarity FALSE represents normal.
mcp23s08_pin3_polarity'get() return bit
Pseudo variable to get the input polarity of pin 3. Return value TRUE represents inverted, polarity FALSE represents normal.
mcp23s08_pin3'get() return bit
Pseudo variable to get the level of port pin 3. Return value TRUE represents level is HIGH, FALSE represents level is LOW.
mcp23s08_latch6'get() return bit
Pseudo variable to get the level of latch bit 6. Return value TRUE represents level is HIGH, FALSE represents level is LOW.
mcp23s08_port_polarity'get() return byte
Pseudo variable to get the port polarity. Return value with bits set are inverted, bits cleared are normal.
mcp23s08_latch2'get() return bit
Pseudo variable to get the level of latch bit 2. Return value TRUE represents level is HIGH, FALSE represents level is LOW.
mcp23s08_latch0'get() return bit
Pseudo variable to get the level of latch bit 0. Return value TRUE represents level is HIGH, FALSE represents level is LOW.
mcp23s08_pin3_direction'get() return bit
Pseudo variable to get the pin direction of pin 3. Return value TRUE equals INPUT, FALSE equals OUTPUT.
mcp23s08_latch1'get() return bit
Pseudo variable to get the level of latch bit 1. Return value TRUE represents level is HIGH, FALSE represents level is LOW.
mcp23s08_get_interrupt_capture() return byte
Return the interrupt capture status. See datasheet for details.
mcp23s08_get_interrupt_flags() return byte
Return the interrupt flags. See datasheet for details.
mcp23s08_pull_up7'get() return bit
Pseudo variable to get the resistor pull-up configuration of port pin 7. Return value TRUE represents ENABLED, FALSE represents DISABLED.
mcp23s08_port_direction'get() return byte
Pseudo variable to get the port direction. Return value with bits set are INPUT, bits cleared are OUTPUT.
mcp23s08_pin0'get() return bit
Pseudo variable to get the level of port pin 0. Return value TRUE represents level is HIGH, FALSE represents level is LOW.
mcp23s08_port'get() return byte
Pseudo variable to get the port value. Return value with bits set represents HIGH, bits cleared represents LOW.
mcp23s08_pull_up4'get() return bit
Pseudo variable to get the resistor pull-up configuration of port pin 4. Return value TRUE represents ENABLED, FALSE represents DISABLED.
mcp23s08_pin7'get() return bit
Pseudo variable to get the level of port pin 7. Return value TRUE represents level is HIGH, FALSE represents level is LOW.
mcp23s08_latch'get() return byte
Pseudo variable to get the latch value. Return value with bits set represents HIGH, bits cleared represents LOW.
mcp23s08_pull_up3'get() return bit
Pseudo variable to get the resistor pull-up configuration of port pin 3. Return value TRUE represents ENABLED, FALSE represents DISABLED.
mcp23s08_latch5'get() return bit
Pseudo variable to get the level of latch bit 5. Return value TRUE represents level is HIGH, FALSE represents level is LOW.
mcp23s08_latch4'get() return bit
Pseudo variable to get the level of latch bit 4. Return value TRUE represents level is HIGH, FALSE represents level is LOW.
mcp23s08_pin6_polarity'get() return bit
Pseudo variable to get the input polarity of pin 6. Return value TRUE represents inverted, polarity FALSE represents normal.
mcp23s08_pin5_direction'get() return bit
Pseudo variable to get the pin direction of pin 5. Return value TRUE equals INPUT, FALSE equals OUTPUT.
mcp23s08_pin1'get() return bit
Pseudo variable to get the level of port pin 1. Return value TRUE represents level is HIGH, FALSE represents level is LOW.
mcp23s08_pin2_direction'get() return bit
Pseudo variable to get the pin direction of pin 2. Return value TRUE equals INPUT, FALSE equals OUTPUT.
mcp23s08_pin1_polarity'get() return bit
Pseudo variable to get the input polarity of pin 1. Return value TRUE represents inverted, polarity FALSE represents normal.
mcp23s08_pin4'get() return bit
Pseudo variable to get the level of port pin 4. Return value TRUE represents level is HIGH, FALSE represents level is LOW.
mcp23s08_pull_up5'get() return bit
Pseudo variable to get the resistor pull-up configuration of port pin 5. Return value TRUE represents ENABLED, FALSE represents DISABLED.
mcp23s08_pin7_direction'get() return bit
Pseudo variable to get the pin direction of pin 7. Return value TRUE equals INPUT, FALSE equals OUTPUT.
mcp23s08_pin2'get() return bit
Pseudo variable to get the level of port pin 2. Return value TRUE represents level is HIGH, FALSE represents level is LOW.
mcp23s08_pull_up2'get() return bit
Pseudo variable to get the resistor pull-up configuration of port pin 2. Return value TRUE represents ENABLED, FALSE represents DISABLED.
mcp23s08_pin6'get() return bit
Pseudo variable to get the level of port pin 6. Return value TRUE represents level is HIGH, FALSE represents level is LOW.
mcp23s08_pin0_direction'get() return bit
Pseudo variable to get the pin direction of pin 0. Return value TRUE equals INPUT, FALSE equals OUTPUT.
mcp23s08_pin5'get() return bit
Pseudo variable to get the level of port pin 5. Return value TRUE represents level is HIGH, FALSE represents level is LOW.
mcp23s08_pull_up'get() return byte
Pseudo variable to get the resistor pull-up configuration. Return value with bits set represents ENABLED, bits cleared represents DISABLED.
mcp23s08_pull_up0'get() return bit
Pseudo variable to get the resistor pull-up configuration of port pin 0. Return value TRUE represents ENABLED, FALSE represents DISABLED.
_mcp23s08_read_data(byte in register) return byte
Read a byte from the given register of the MCP23S08 via the SPI interface.
16f1825 | 16f1825_mcp23s08.jal |