|
|
| (12 intermediate revisions by 2 users not shown) |
| Line 16: |
Line 16: |
|
| |
|
| ==Component Source Code== | | ==Component Source Code== |
| | |
| | Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_SPI_Slave.fcfx FC_Comp_Source_SPI_Slave.fcfx] |
|
| |
|
| Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_SPI_Slave.fcfx FC_Comp_Source_SPI_Slave.fcfx] | | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_SPI_Slave.fcfx FC_Comp_Source_SPI_Slave.fcfx] |
|
| |
|
| ==Detailed description== | | ==Detailed description== |
| | |
| | |
| | |
| | |
| | |
| | |
|
| |
|
|
| |
|
| Line 40: |
Line 48: |
|
| |
|
| ==Examples== | | ==Examples== |
| | |
| | |
| | |
| | |
| | |
| | |
|
| |
|
|
| |
|
| Line 74: |
Line 88: |
|
| |
|
|
| |
|
| ==Macro reference==
| |
|
| |
|
| {| 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;" | '''SendChar'''
| |
| |-
| |
| | colspan="2" | General purpose SPI send byte macro
| |
| |-
| |
| |-
| |
| | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| |
| | width="90%" | Char
| |
| |-
| |
| | colspan="2" | Data byte to send
| |
| |-
| |
| | 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''
| |
| |}
| |
|
| |
|
|
| |
|
| {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | ==Macro reference== |
| | |
| | ===GetChar=== |
| | {| class="mtx-class-macrotable wikitable" |
| |- | | |- |
| | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] |
| | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetChar''' | | | width="90%" class="mtx-class-macrohead" | '''GetChar''' |
| |- | | |- |
| | colspan="2" | General purpose SPI get byte macro | | | colspan="2" | General purpose SPI get byte macro |
| Line 107: |
Line 114: |
|
| |
|
|
| |
|
| {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | | ===Initialise=== |
| | {| class="mtx-class-macrotable wikitable" |
| |- | | |- |
| | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] |
| | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''UnInitialise''' | | | width="90%" class="mtx-class-macrohead" | '''Initialise''' |
| |-
| |
| | colspan="2" | Deactivates the SPI peripheral leaving the I/O pins in a state where they can be used for general purpose I/O.
| |
| |-
| |
| |-
| |
| | 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''
| |
| |}
| |
| | |
| | |
| {| 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" | Activates the SPI peripheral and claims control over the I/O pins. | | | colspan="2" | Activates the SPI peripheral and claims control over the I/O pins. |
| Line 133: |
Line 128: |
|
| |
|
|
| |
|
| | | ===SendChar=== |
| | | {| class="mtx-class-macrotable wikitable" |
| ==Property reference== | |
| | |
| {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | |
| |-
| |
| | width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| |
| | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
| |
| |-
| |
| |-
| |
| | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| |
| | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Connections
| |
| |-
| |
| |-
| |
| | width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| |
| | width="90%" | Channel
| |
| |-
| |
| | colspan="2" | SPI Channel selector
| |
| |-
| |
| | width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| |
| | width="90%" | MOSI
| |
| |-
| |
| | colspan="2" | 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-5-icon.png]]
| |
| | width="90%" | MISO
| |
| |-
| |
| | colspan="2" | 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-5-icon.png]]
| |
| | width="90%" | CLK
| |
| |-
| |
| | colspan="2" | SPI Clock Pin CLK - The Clock signal is driven by the SPI master.
| |
| |-
| |
| | width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
| |
| | width="90%" | Use Slave Select
| |
| |-
| |
| | colspan="2" |
| |
| |-
| |
| | width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| |
| | width="90%" | CS / SS
| |
| |-
| |
| | colspan="2" | 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.
| |
| |-
| |
| | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| |
| | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Bus Settings
| |
| |-
| |
| |-
| |
| | width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| |
| | width="90%" | Clock Phase
| |
| |-
| |
| | colspan="2" | Clock Phase (data change edge) selection
| |
| |-
| |
| | width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| |
| | width="90%" | Clock Polarity
| |
| |-
| |
| | colspan="2" | Clock Polarity setting, inactive (idle) state
| |
| |-
| |
| | width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| |
| | width="90%" | Sample Point
| |
| |-
| |
| | colspan="2" | Data bit read sample point
| |
| |-
| |
| | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| |
| | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
| |
| |-
| |
| |-
| |
| | width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
| |
| | width="90%" | Label
| |
| |-
| |
| | colspan="2" | Label used to identify the component on the panel.
| |
| |-
| |
| | width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
| |
| | width="90%" | Scope Traces
| |
| |-
| |
| | colspan="2" | Selects if the scope traces are automatically generated or not
| |
| |-
| |
| | 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
| |
| |-
| |
| | width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| |
| | width="90%" | API
| |
| |-
| |
| | colspan="2" |
| |
| |}==Macro reference==
| |
| | |
| {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
| |
| |- | | |- |
| | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] |
| | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendChar''' | | | width="90%" class="mtx-class-macrohead" | '''SendChar''' |
| |- | | |- |
| | colspan="2" | General purpose SPI send byte macro | | | colspan="2" | General purpose SPI send byte macro |
| Line 239: |
Line 147: |
|
| |
|
|
| |
|
| {| class="wikitable" style="width:60%; background-color:#FFFFFF;"
| | ===UnInitialise=== |
| |-
| | {| class="mtx-class-macrotable wikitable" |
| | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| |
| | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetChar''' | |
| |-
| |
| | colspan="2" | General purpose SPI get byte macro
| |
| |-
| |
| |-
| |
| | 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="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] |
| | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''UnInitialise''' | | | width="90%" class="mtx-class-macrohead" | '''UnInitialise''' |
| |- | | |- |
| | colspan="2" | Deactivates the SPI peripheral leaving the I/O pins in a state where they can be used for general purpose I/O. | | | colspan="2" | Deactivates the SPI peripheral leaving the I/O pins in a state where they can be used for general purpose I/O. |
| Line 263: |
Line 159: |
| | width="90%" style="border-top: 2px solid #000;" | ''Return'' | | | 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" | Activates the SPI peripheral and claims control over the I/O pins.
| |
| |-
| |
| |-
| |
| | 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''
| |
| |}
| |
|
| |
|
| |
|
| |
|
|
| |
|
| ==Property reference== | | ==Property reference== |
|
| |
|
| {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | | {| class="mtx-class-macrotable wikitable" |
| |- | | |- |
| | width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]] | | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]] |
| | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties''' | | | width="90%" class="mtx-class-macrohead" | '''Properties''' |
| |- | | |- |
| |- | | |- |
| | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] |
| | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Connections | | | width="90%" class="mtx-class-propfolder" | Connections |
| |- | | |- |
| |- | | |- |
| Line 322: |
Line 203: |
| | colspan="2" | 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. | | | colspan="2" | 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. |
| |- | | |- |
| | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] |
| | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Bus Settings | | | width="90%" class="mtx-class-propfolder" | Bus Settings |
| |- | | |- |
| |- | | |- |
| Line 341: |
Line 222: |
| | colspan="2" | Data bit read sample point | | | colspan="2" | Data bit read sample point |
| |- | | |- |
| | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | | | width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]] |
| | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation | | | width="90%" class="mtx-class-propfolder" | Simulation |
| |- | | |- |
| |- | | |- |
| Author
|
Matrix Ltd
|
| Version
|
1.0
|
| Category
|
Comms: Interface
|
SPI Slave component
Low level routines for controlling or interacting with an SPI interface. SPI or Serial Peripheral Interface is a bus used for board level communications between devices. A target microcontroller will usually have at least one hardware SPI peripheral built in.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_SPI_Slave.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_SPI_Slave.fcfx
Detailed description
No detailed description exists yet for this component
Examples
Simple Master program that sends an incrementing test value to the SPI bus as well as outputting the value onto LEDs.
SPI_Master
Simple Slave program that collects the value sent by the master and outputs the value onto LEDs. Allows the master slave comms to be compared to check that everything is working correctly.
SPI_Slave
Another simple example to buffer incoming SPI bytes sent by the master and output these to the LCD.
SPI_Slave2
Macro reference
GetChar
|
GetChar
|
| General purpose SPI get byte macro
|
- BYTE
|
Return
|
Initialise
|
Initialise
|
| Activates the SPI peripheral and claims control over the I/O pins.
|
- VOID
|
Return
|
SendChar
|
SendChar
|
| General purpose SPI send byte macro
|
- BYTE
|
Char
|
| Data byte to send
|
- VOID
|
Return
|
UnInitialise
|
UnInitialise
|
| Deactivates the SPI peripheral leaving the I/O pins in a state where they can be used for general purpose I/O.
|
- VOID
|
Return
|
Property reference
|
Properties
|
|
Connections
|
|
Channel
|
| SPI Channel selector
|
|
MOSI
|
| SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode.
|
|
MISO
|
| SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode.
|
|
CLK
|
| SPI Clock Pin CLK - The Clock signal is driven by the SPI master.
|
|
Use Slave Select
|
|
|
|
CS / 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.
|
|
Bus Settings
|
|
Clock Phase
|
| Clock Phase (data change edge) selection
|
|
Clock Polarity
|
| Clock Polarity setting, inactive (idle) state
|
|
Sample Point
|
| Data bit read sample point
|
|
Simulation
|
|
Label
|
| Label used to identify the component on the panel.
|
|
Scope Traces
|
| Selects if the scope traces are automatically generated or not
|
|
Console Data
|
| Selects if the console data is automatically generated or not
|
|
API
|
|
|