Difference between revisions of "Bot test"
Line 1: | Line 1: | ||
− | {| | + | |
+ | |||
+ | {| width="50%" | ||
|- | |- | ||
− | | width="20%" style="color:gray;" | Author | + | | width="20%" style="color: gray;" | Author |
− | | Matrix | + | | Matrix TSL |
|- | |- | ||
− | | width="20%" style="color:gray;" | Version | + | | width="20%" style="color: gray;" | Version |
− | | | + | | 1.0 (Release) |
|- | |- | ||
− | | width="20%" style="color:gray;" | Category | + | | width="20%" style="color: gray;" | Category |
− | | | + | | Comms: System |
|} | |} | ||
− | == | + | |
− | + | ==[[File:Component Icon 331daac0_653d_4f45_9822_6408a8258bda.png|Image]] IO Expander (MCP23S17) component== | |
+ | Provides 16 digital input/output pins arranged into two 8-bit ports using a SPI bus connection. | ||
+ | Multiple expanders can be connected to the same SPI peripheral by means of individual chip select pins. | ||
==Examples== | ==Examples== | ||
+ | ''<span style="color:red;">No additional examples</span>'' | ||
+ | |||
+ | |||
+ | ==Downloadable macro reference== | ||
+ | |||
+ | ===<span style="font-weight: normal;"><u><tt>ReadPort</tt></u></span>=== | ||
+ | Reads a value to one of the ports with a mask. | ||
+ | |||
+ | Configures the masked bits to be inputs before reading the input value. | ||
+ | |||
+ | '''Parameters''' | ||
+ | |||
+ | :[[Variable Types|BYTE]] ''Port'' | ||
+ | ::0=PortA, 1=PortB | ||
+ | |||
+ | :[[Variable Types|BYTE]] ''Mask'' | ||
+ | ::Allows port bits to be modified without effecting other bits, 255 = write full port. | ||
+ | |||
+ | |||
+ | '''Return value''' | ||
+ | |||
+ | :[[Variable Types|BYTE]] | ||
+ | |||
+ | |||
+ | ===<span style="font-weight: normal;"><u><tt>ConfigureInversion</tt></u></span>=== | ||
+ | Configures the pin inversion for the two ports. | ||
+ | |||
+ | Disabled on all pins by default. | ||
+ | |||
+ | '''Parameters''' | ||
+ | |||
+ | :[[Variable Types|BYTE]] ''PortA'' | ||
+ | ::Port A inversion sent as an 8-bit value, 0 = Disabled, 1 = Enabled | ||
+ | |||
+ | :[[Variable Types|BYTE]] ''PortB'' | ||
+ | ::Port B inversion sent as an 8-bit value, 0 = Disabled, 1 = Enabled | ||
+ | |||
+ | |||
+ | '''Return value''' | ||
+ | |||
+ | :''This call does not return a value'' | ||
+ | |||
+ | ===<span style="font-weight: normal;"><u><tt>ReadPortPin</tt></u></span>=== | ||
+ | Reads a single port pin from one of the ports. | ||
+ | Configures the pins to be an input before reading the input value. | ||
+ | Returns 0 or 1 corresponding to the value on the port pin. | ||
− | + | '''Parameters''' | |
− | |||
− | [[ | + | :[[Variable Types|BYTE]] ''Port'' |
+ | ::0=PortA, 1=PortB | ||
+ | :[[Variable Types|BYTE]] ''Pin'' | ||
+ | ::Port pin to read. Range: 0-7 | ||
− | |||
− | + | '''Return value''' | |
+ | :[[Variable Types|BYTE]] | ||
+ | ===<span style="font-weight: normal;"><u><tt>WritePortPin</tt></u></span>=== | ||
+ | Writes a single port pin on one of the ports. | ||
+ | Configures the pins to be an output before writing the input value. | ||
− | == | + | '''Parameters''' |
+ | |||
+ | :[[Variable Types|BYTE]] ''Port'' | ||
+ | ::0=PortA, 1=PortB | ||
+ | |||
+ | :[[Variable Types|BYTE]] ''Pin'' | ||
+ | ::Port pin to read. Range: 0-7 | ||
+ | |||
+ | :[[Variable Types|BYTE]] ''Value'' | ||
+ | ::Value to output on the selected pin. Range: 0-1 | ||
+ | |||
+ | |||
+ | '''Return value''' | ||
+ | |||
+ | :''This call does not return a value'' | ||
+ | |||
+ | |||
+ | ===<span style="font-weight: normal;"><u><tt>WritePort</tt></u></span>=== | ||
+ | Writes a value to one of the ports with a mask. | ||
+ | |||
+ | Configures the masked bits to be outputs before writing the output value. | ||
+ | |||
+ | '''Parameters''' | ||
+ | |||
+ | :[[Variable Types|BYTE]] ''Port'' | ||
+ | ::0=PortA, 1=PortB | ||
+ | |||
+ | :[[Variable Types|BYTE]] ''Mask'' | ||
+ | ::Allows port bits to be modified without effecting other bits, 255 = write full port. | ||
+ | |||
+ | :[[Variable Types|BYTE]] ''Value'' | ||
+ | ::Value to write. Range 0-255 | ||
+ | |||
+ | |||
+ | '''Return value''' | ||
+ | |||
+ | :''This call does not return a value'' | ||
+ | |||
+ | |||
+ | ===<span style="font-weight: normal;"><u><tt>ConfigurePullups</tt></u></span>=== | ||
+ | Configures the pullups for the two ports. | ||
+ | |||
+ | Disabled on all pins by default. | ||
+ | |||
+ | '''Parameters''' | ||
+ | |||
+ | :[[Variable Types|BYTE]] ''PortA'' | ||
+ | ::Port A pull ups sent as an 8-bit value, 0 = Disabled, 1 = Enabled | ||
+ | |||
+ | :[[Variable Types|BYTE]] ''PortB'' | ||
+ | ::Port B pull ups sent as an 8-bit value, 0 = Disabled, 1 = Enabled | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | '''Return value''' | ||
− | + | :''This call does not return a value'' | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | ===<span style="font-weight: normal;"><u><tt>ReadRegister</tt></u></span>=== | |
− | + | Reads an 8-bit value from a register on the I/O expander device. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | '''Parameters''' | ||
− | + | :[[Variable Types|BYTE]] ''Address'' | |
− | + | ::Register address to write to. Range: 0-15 | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | '''Return value''' | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | :[[Variable Types|BYTE]] | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | ===<span style="font-weight: normal;"><u><tt>WriteRegister</tt></u></span>=== | ||
+ | Writes an 8-bit value to a register on the I/O expander device. | ||
− | + | '''Parameters''' | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | :[[Variable Types|BYTE]] ''Address'' | ||
+ | ::Register address to write to. Range: 0-15 | ||
− | + | :[[Variable Types|BYTE]] ''Value'' | |
− | + | ::Value to write. Range: 0-255 | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | '''Return value''' | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | :''This call does not return a value'' | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | ===<span style="font-weight: normal;"><u><tt>Initialise</tt></u></span>=== | ||
+ | ''<span style="color:red;">No additional information</span>'' | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | '''Parameters''' | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | :''This macro has no parameters'' | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | '''Return value''' | ||
− | + | :''This call does not return a value'' | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | ==Simulation macro reference== | ||
+ | ''This component does not contain any simulation macros'' | ||
==Property reference== | ==Property reference== | ||
+ | <span style="font-weight: normal;"><u>Channel</u></span> | ||
+ | |||
+ | This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_spi1::CHANNEL''. | ||
+ | |||
+ | SPI Channel selector | ||
+ | |||
+ | <span style="font-weight: normal;"><u>Prescale</u></span> | ||
+ | |||
+ | This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_spi1::PR_SCALE''. | ||
+ | |||
+ | Prescale option selector | ||
− | + | <span style="font-weight: normal;"><u>MOSI</u></span> | |
− | + | ||
− | + | This property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_spi1::MOSI''. | |
− | + | ||
− | + | SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode. | |
− | + | ||
− | + | <span style="font-weight: normal;"><u>MISO</u></span> | |
− | + | ||
− | + | This property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_spi1::MISO''. | |
− | + | ||
− | + | SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode. | |
− | + | ||
− | + | <span style="font-weight: normal;"><u>CLK</u></span> | |
− | + | ||
− | + | This property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_spi1::CLK''. | |
− | + | ||
− | + | SPI Clock Pin CLK - The Clock signal is driven by the SPI master. | |
− | + | ||
− | + | <span style="font-weight: normal;"><u>CS / SS</u></span> | |
− | + | ||
− | + | This property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_spi1::SS''. | |
− | + | ||
− | + | Chip Select / Slave Select Pin | |
− | + | ||
− | + | Master Mode: General purpose output pin used to select the remote SPI device. | |
− | + | ||
− | + | Slave Mode: Hardware chip select pin input used to select the SPI device. | |
− | + | ||
− | + | <span style="font-weight: normal;"><u>Reset Pin</u></span> | |
− | + | ||
− | + | This property is of type ''Single digital pin'' and can be referenced with the variable name ''reset_pin''. | |
− | + | ||
− | + | ''<span style="color:red;">No additional information</span>'' | |
− | + | ||
− | + | ||
− | + | ||
− | + | <span style="font-weight: normal;"><u>Label</u></span> | |
− | + | ||
− | + | This property is of type ''Line of text'' and can be referenced with the variable name ''label''. | |
− | + | ||
− | + | ''<span style="color:red;">No additional information</span>'' | |
− | + | ||
− | + | ||
− | + | ||
− | + | <span style="font-weight: normal;"><u>Scope Traces</u></span> | |
− | + | ||
− | + | This property is of type ''True or false'' and can be referenced with the variable name ''cal_spi1::ScopeTraces''. | |
− | + | ||
− | + | Selects if the scope traces are automatically generated or not | |
− | + | ||
− | + | <span style="font-weight: normal;"><u>Console Data</u></span> | |
− | + | ||
− | + | This property is of type ''True or false'' and can be referenced with the variable name ''cal_spi1::ConsoleData''. | |
− | + | ||
− | + | Selects if the console data is automatically generated or not | |
− | + | ||
− | + | <span style="font-weight: normal;"><u>Injector</u></span> | |
− | + | ||
− | + | This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_spi1::Injector''. | |
− | + | ||
− | + | ''<span style="color:red;">No additional information</span>'' | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 14:51, 26 August 2021
Author | Matrix TSL |
Version | 1.0 (Release) |
Category | Comms: System |
Contents
IO Expander (MCP23S17) component
Provides 16 digital input/output pins arranged into two 8-bit ports using a SPI bus connection. Multiple expanders can be connected to the same SPI peripheral by means of individual chip select pins.
Examples
No additional examples
Downloadable macro reference
ReadPort
Reads a value to one of the ports with a mask.
Configures the masked bits to be inputs before reading the input value.
Parameters
- BYTE Port
- 0=PortA, 1=PortB
- BYTE Mask
- Allows port bits to be modified without effecting other bits, 255 = write full port.
Return value
ConfigureInversion
Configures the pin inversion for the two ports.
Disabled on all pins by default.
Parameters
- BYTE PortA
- Port A inversion sent as an 8-bit value, 0 = Disabled, 1 = Enabled
- BYTE PortB
- Port B inversion sent as an 8-bit value, 0 = Disabled, 1 = Enabled
Return value
- This call does not return a value
ReadPortPin
Reads a single port pin from one of the ports.
Configures the pins to be an input before reading the input value.
Returns 0 or 1 corresponding to the value on the port pin.
Parameters
- BYTE Port
- 0=PortA, 1=PortB
- BYTE Pin
- Port pin to read. Range: 0-7
Return value
WritePortPin
Writes a single port pin on one of the ports.
Configures the pins to be an output before writing the input value.
Parameters
- BYTE Port
- 0=PortA, 1=PortB
- BYTE Pin
- Port pin to read. Range: 0-7
- BYTE Value
- Value to output on the selected pin. Range: 0-1
Return value
- This call does not return a value
WritePort
Writes a value to one of the ports with a mask.
Configures the masked bits to be outputs before writing the output value.
Parameters
- BYTE Port
- 0=PortA, 1=PortB
- BYTE Mask
- Allows port bits to be modified without effecting other bits, 255 = write full port.
- BYTE Value
- Value to write. Range 0-255
Return value
- This call does not return a value
ConfigurePullups
Configures the pullups for the two ports.
Disabled on all pins by default.
Parameters
- BYTE PortA
- Port A pull ups sent as an 8-bit value, 0 = Disabled, 1 = Enabled
- BYTE PortB
- Port B pull ups sent as an 8-bit value, 0 = Disabled, 1 = Enabled
Return value
- This call does not return a value
ReadRegister
Reads an 8-bit value from a register on the I/O expander device.
Parameters
- BYTE Address
- Register address to write to. Range: 0-15
Return value
WriteRegister
Writes an 8-bit value to a register on the I/O expander device.
Parameters
- BYTE Address
- Register address to write to. Range: 0-15
- BYTE Value
- Value to write. Range: 0-255
Return value
- This call does not return a value
Initialise
No additional information
Parameters
- This macro has no parameters
Return value
- This call does not return a value
Simulation macro reference
This component does not contain any simulation macros
Property reference
Channel
This property is of type Fixed list of ints and can be referenced with the variable name cal_spi1::CHANNEL.
SPI Channel selector
Prescale
This property is of type Fixed list of ints and can be referenced with the variable name cal_spi1::PR_SCALE.
Prescale option selector
MOSI
This property is of type Single digital pin and can be referenced with the variable name cal_spi1::MOSI.
SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode.
MISO
This property is of type Single digital pin and can be referenced with the variable name cal_spi1::MISO.
SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode.
CLK
This property is of type Single digital pin and can be referenced with the variable name cal_spi1::CLK.
SPI Clock Pin CLK - The Clock signal is driven by the SPI master.
CS / SS
This property is of type Single digital pin and can be referenced with the variable name cal_spi1::SS.
Chip Select / Slave Select Pin
Master Mode: General purpose output pin used to select the remote SPI device.
Slave Mode: Hardware chip select pin input used to select the SPI device.
Reset Pin
This property is of type Single digital pin and can be referenced with the variable name reset_pin.
No additional information
Label
This property is of type Line of text and can be referenced with the variable name label.
No additional information
Scope Traces
This property is of type True or false and can be referenced with the variable name cal_spi1::ScopeTraces.
Selects if the scope traces are automatically generated or not
Console Data
This property is of type True or false and can be referenced with the variable name cal_spi1::ConsoleData.
Selects if the console data is automatically generated or not
Injector
This property is of type Fixed list of ints and can be referenced with the variable name cal_spi1::Injector.
No additional information