Difference between revisions of "Bot test"

From Flowcode Help
Jump to navigationJump to search
Line 1: Line 1:
{| style="width:50%"
+
 
 +
 
 +
{| width="50%"
 
|-
 
|-
| width="20%" style="color:gray;" | Author
+
| width="20%" style="color: gray;" | Author
| Matrix Ltd.
+
| Matrix TSL
 
|-
 
|-
| width="20%" style="color:gray;" | Version
+
| width="20%" style="color: gray;" | Version
| 2.0
+
| 1.0 (Release)
 
|-
 
|-
| width="20%" style="color:gray;" | Category
+
| width="20%" style="color: gray;" | Category
| Wireless
+
| Comms: System
 
|}
 
|}
  
  
==GSM (EB066, Generic AT) component==
+
 
Low level routines for controlling a standard AT GSM / GPRS interface Also available in the form of the EB066 GSM E-block.
+
==[[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.
  
{{Fcfile|GSM_Test.fcfx|GSM Example}}
+
'''Parameters'''
Example should show the following on the display on the panel and on the hardware.
 
  
[[File:GSMPan.jpg]]
+
:[[Variable Types|BYTE]] ''Port''
 +
::0=PortA, 1=PortB
  
 +
:[[Variable Types|BYTE]] ''Pin''
 +
::Port pin to read. Range: 0-7
  
The AT injector component allows us to simulate the response of the GSM module.
 
  
[[File:GSMInject.jpg]]
+
'''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.
  
==Downloadable macro reference==
+
'''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
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DialNumber'''
 
|-
 
| colspan="2" | Performs a standard voice call by dialling the number specified. Returns 0 for call in progress and 255 for no response.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" | Number
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
 +
'''Return value'''
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
:''This call does not return a value''
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetTextString'''
 
|-
 
| colspan="2" | Collects the text message data from an incoming text message.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | NumBytes
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
===<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.
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendString'''
 
|-
 
| colspan="2" | Sends a string to the GSM module. &nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" | Text
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
 +
'''Parameters'''
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
:[[Variable Types|BYTE]] ''Address''
|-
+
::Register address to write to. Range: 0-15
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendScript'''
 
|-
 
| colspan="2" | Send an AT command script. Returns 0 for fail, 1 for success and 255 for unrecognised script idx.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | idx
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
'''Return value'''
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendCommand'''
 
|-
 
| colspan="2" | Sends a command string to the GSM module. 0 = Command sent ok, 255 = No Reply&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" | Command
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | SendCR
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
 +
:[[Variable Types|BYTE]]
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''AnswerIncomingCall'''
 
|-
 
| colspan="2" | Answers the phone for an incoming type call. Returns 0 for success and 255 for failure.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
 +
===<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.
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
'''Parameters'''
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetTextNumber'''
 
|-
 
| colspan="2" | Collects the sender's phone number from an incoming text message.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | NumBytes
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
 +
:[[Variable Types|BYTE]] ''Address''
 +
::Register address to write to. Range: 0-15
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
:[[Variable Types|BYTE]] ''Value''
|-
+
::Value to write. Range: 0-255
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''HangUpCall'''
 
|-
 
| colspan="2" | Ends a voice based call. Returns 0 for success and 255 for failure.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
'''Return value'''
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadString'''
 
|-
 
| colspan="2" | Copies the data from the data string array to a local string variable&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | NumBytes
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
 +
:''This call does not return a value''
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendTextMessage'''
 
|-
 
| colspan="2" | Sends the text message data specified to the number specified using the SMS protocol. Returns 0 for success and 255 for failure.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" | Number
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" | Message
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
 +
===<span style="font-weight: normal;"><u><tt>Initialise</tt></u></span>===
 +
''<span style="color:red;">No additional information</span>''
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''StringReceive'''
 
|-
 
| colspan="2" | Attempts to receive a string from the GSM modem.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
'''Parameters'''
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DeleteAllMessages'''
 
|-
 
| colspan="2" | Removes all pending text messages from the GSM module. Returns 0 for success and 255 for fail.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
 +
:''This macro has no parameters''
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckNetworkStatus'''
 
|-
 
| colspan="2" | Returns the state of the GSM network. 0 = Not connected, 1 = connected, 255 = no reply from GSM.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
 +
'''Return value'''
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
:''This call does not return a value''
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckForIncoming'''
 
|-
 
| colspan="2" | Checks to see if any incoming phone call or SMS message. 0 = Nothing, 1 = Text Received, 2 = Phone Ringing&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 
|-
 
| colspan="2" | Sets up the GSM module. Returns 0 for OK, 255 for no reply and 254 for command fail.&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
  
 +
==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
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
<span style="font-weight: normal;"><u>MOSI</u></span>
|-
+
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
+
This property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_spi1::MOSI''.
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
+
 
|-
+
SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode.
|-
+
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
+
<span style="font-weight: normal;"><u>MISO</u></span>
| width="90%" | Expect Echo
+
 
|-
+
This property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_spi1::MISO''.
| colspan="2" | Sets if we expect an echo of any data we send out to the GSM modem. Most AT type modems (e.g. GSM modules) will automatically echo back incoming data.&nbsp;
+
 
|-
+
SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode.
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
+
 
| width="90%" | String Array Size
+
<span style="font-weight: normal;"><u>CLK</u></span>
|-
+
 
| colspan="2" | Amount of RAM memory to dedicate to receiving responces from the GSM&nbsp;
+
This property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_spi1::CLK''.
|-
+
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
+
SPI Clock Pin CLK - The Clock signal is driven by the SPI master.
| width="90%" | Message Array Size
+
 
|-
+
<span style="font-weight: normal;"><u>CS / SS</u></span>
| colspan="2" | Amount of RAM memory to dedicate to storing the last SMS message received by the GSM.&nbsp;
+
 
|-
+
This property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_spi1::SS''.
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
+
 
| width="90%" | Script Count
+
Chip Select / Slave Select Pin  
|-
+
 
| colspan="2" | Maximum number of scripts to store in the device's ROM&nbsp;
+
Master Mode: General purpose output pin used to select the remote SPI device.
|-
+
 
| width="10%" align="center" | [[File:Fc9-type-11-icon.png]]
+
Slave Mode: Hardware chip select pin input used to select the SPI device.
| width="90%" | Script1
+
 
|-
+
<span style="font-weight: normal;"><u>Reset Pin</u></span>
| colspan="2" | ASCII based AT command data stored in ROM and used when sending script 1&nbsp;
+
 
|-
+
This property is of type ''Single digital pin'' and can be referenced with the variable name ''reset_pin''.
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]]
+
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Connections'''  
+
''<span style="color:red;">No additional information</span>''
|-
+
 
|-
+
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
+
 
| width="90%" | Channel
+
<span style="font-weight: normal;"><u>Label</u></span>
|-
+
 
| colspan="2" | UART Channel selector Software channels are bit banged using generic I/O pins but are not as reliable as hardware channels. Hardware channels use the selected peripheral on-board the target microcontroller.&nbsp;
+
This property is of type ''Line of text'' and can be referenced with the variable name ''label''.
|-
+
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
+
''<span style="color:red;">No additional information</span>''
| width="90%" | TX
+
 
|-
+
 
| colspan="2" | Pin to be used for Transmit data&nbsp;
+
 
|-
+
<span style="font-weight: normal;"><u>Scope Traces</u></span>
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
+
 
| width="90%" | RX
+
This property is of type ''True or false'' and can be referenced with the variable name ''cal_spi1::ScopeTraces''.
|-
+
 
| colspan="2" | Pin to be used for Receive data&nbsp;
+
Selects if the scope traces are automatically generated or not
|-
+
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
+
<span style="font-weight: normal;"><u>Console Data</u></span>
| width="90%" | Use Flow Control
+
 
|-
+
This property is of type ''True or false'' and can be referenced with the variable name ''cal_spi1::ConsoleData''.
| colspan="2" | Flow Control (Handshake) enable or disable.    On: Two I/O pins are used to control the flow of data in and out of the device.     Off: Flow control is disabled.&nbsp;
+
 
|-
+
Selects if the console data is automatically generated or not
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
+
 
| width="90%" | Baud Options
+
<span style="font-weight: normal;"><u>Injector</u></span>
|-
+
 
| colspan="2" | Baud rate option selector&nbsp;
+
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_spi1::Injector''.
|-
+
 
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
+
''<span style="color:red;">No additional information</span>''
| width="90%" | Baud Rate
 
|-
 
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Simulations'''  
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
 
| width="90%" | Label
 
|-
 
| colspan="2" | Textual label shown on the component I/O flasher&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Scope Traces
 
|-
 
| colspan="2" | Selects if the scope traces are automatically added to the data recorder window or not.    Simulation - draws an approximation of the UART data onto the scope trace.    ICT - sets up the scope trace for incoming data and adds UART packet decoding at the correct BAUD.&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Console Data
 
|-
 
| colspan="2" | Selects if the console data is automatically generated or not&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
| width="90%" | Console Columns
 
|-
 
| colspan="2" | Number of characters that can be displayed on a single line of the console.&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Data Source
 
|-
 
| colspan="2" | Simulation data source used to allow the component to connect to various remote devices    Nothing - Simulation data is ignored    COM port - Routes the communication data to and from a physical or virtual COM port      API - Routes the communication data via a data API component on the Panel.&nbsp;
 
|}
 

Revision as of 14:51, 26 August 2021


Author Matrix TSL
Version 1.0 (Release)
Category Comms: System


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

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

BYTE


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

BYTE


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

BYTE


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