Jump to content

Component: SPI (CAL) (Misc): Difference between revisions

From Flowcode Help
No edit summary
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder""
 
(5 intermediate revisions by the same user not shown)
Line 70: Line 70:


===GetConsoleHandle===
===GetConsoleHandle===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| 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;" | '''GetConsoleHandle'''
| width="90%" class="mtx-class-macrohead" | '''GetConsoleHandle'''
|-
|-
| colspan="2" | Returns a handle to the console used by this component 
| colspan="2" | Returns a handle to the console used by this component 
Line 84: Line 84:


===GetList===
===GetList===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| 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;" | '''GetList'''
| width="90%" class="mtx-class-macrohead" | '''GetList'''
|-
|-
| colspan="2" | returns Named property list 
| colspan="2" | returns Named property list 
Line 103: Line 103:


===GetValue===
===GetValue===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| 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;" | '''GetValue'''
| width="90%" class="mtx-class-macrohead" | '''GetValue'''
|-
|-
| colspan="2" | Reads Named property Value.   
| colspan="2" | Reads Named property Value.   
Line 122: Line 122:


===Master_Byte===
===Master_Byte===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| 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;" | '''Master_Byte'''
| width="90%" class="mtx-class-macrohead" | '''Master_Byte'''
|-
|-
| colspan="2" | Sends and receives a data byte 
| colspan="2" | Sends and receives a data byte 
Line 141: Line 141:


===Master_Disable_CS===
===Master_Disable_CS===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| 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;" | '''Master_Disable_CS'''
| width="90%" class="mtx-class-macrohead" | '''Master_Disable_CS'''
|-
|-
| colspan="2" | Outputs a high signal to the chip select pin to deselect the remote slave device. 
| colspan="2" | Outputs a high signal to the chip select pin to deselect the remote slave device. 
Line 155: Line 155:


===Master_Enable_CS===
===Master_Enable_CS===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| 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;" | '''Master_Enable_CS'''
| width="90%" class="mtx-class-macrohead" | '''Master_Enable_CS'''
|-
|-
| colspan="2" | Outputs a low signal to the chip select pin to select the remote slave device. 
| colspan="2" | Outputs a low signal to the chip select pin to select the remote slave device. 
Line 169: Line 169:


===Master_Init===
===Master_Init===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| 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;" | '''Master_Init'''
| width="90%" class="mtx-class-macrohead" | '''Master_Init'''
|-
|-
| colspan="2" | Initialise the Master 
| colspan="2" | Initialise the Master 
Line 183: Line 183:


===Master_Transaction===
===Master_Transaction===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| 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;" | '''Master_Transaction'''
| width="90%" class="mtx-class-macrohead" | '''Master_Transaction'''
|-
|-
| colspan="2" | Sends and receives data bytes via the SPI channel. The Buffer is to contain the data to be sent, and is overwritten by the retuning data from the device. Returns 1 for success, 0 for failure 
| colspan="2" | Sends and receives data bytes via the SPI channel. The Buffer is to contain the data to be sent, and is overwritten by the retuning data from the device. Returns 1 for success, 0 for failure 
Line 207: Line 207:


===Master_Uninit===
===Master_Uninit===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| 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;" | '''Master_Uninit'''
| width="90%" class="mtx-class-macrohead" | '''Master_Uninit'''
|-
|-
| colspan="2" | Uninitialise the Master 
| colspan="2" | Uninitialise the Master 
Line 221: Line 221:


===Prv_TextConsole===
===Prv_TextConsole===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| 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;" | '''Prv_TextConsole'''
| width="90%" class="mtx-class-macrohead" | '''Prv_TextConsole'''
|-
|-
| colspan="2" | Send text to the SPI console. Exposed as part of the CAL_SPI component to allow none AutoCS pins and other. 
| colspan="2" | Send text to the SPI console. Exposed as part of the CAL_SPI component to allow none AutoCS pins and other. 
Line 250: Line 250:


===SetPrescaler===
===SetPrescaler===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| 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;" | '''SetPrescaler'''
| width="90%" class="mtx-class-macrohead" | '''SetPrescaler'''
|-
|-
| colspan="2" | Sets the prescaler value for the clock divider chain 
| colspan="2" | Sets the prescaler value for the clock divider chain 
Line 269: Line 269:


===SetValue===
===SetValue===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| 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;" | '''SetValue'''
| width="90%" class="mtx-class-macrohead" | '''SetValue'''
|-
|-
| colspan="2" | Change Named property to new Value.   
| colspan="2" | Change Named property to new Value.   
Line 293: Line 293:


===Slave_Init===
===Slave_Init===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| 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;" | '''Slave_Init'''
| width="90%" class="mtx-class-macrohead" | '''Slave_Init'''
|-
|-
| colspan="2" | Initialise the Slave 
| colspan="2" | Initialise the Slave 
Line 307: Line 307:


===Slave_RxByte===
===Slave_RxByte===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| 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;" | '''Slave_RxByte'''
| width="90%" class="mtx-class-macrohead" | '''Slave_RxByte'''
|-
|-
| colspan="2" | Returns the data received from the SPI Master 
| colspan="2" | Returns the data received from the SPI Master 
Line 321: Line 321:


===Slave_TxByte===
===Slave_TxByte===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| 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;" | '''Slave_TxByte'''
| width="90%" class="mtx-class-macrohead" | '''Slave_TxByte'''
|-
|-
| colspan="2" | Sets the data to be transmitted to the SPI master. 
| colspan="2" | Sets the data to be transmitted to the SPI master. 
Line 340: Line 340:


===Slave_Uninit===
===Slave_Uninit===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| 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;" | '''Slave_Uninit'''
| width="90%" class="mtx-class-macrohead" | '''Slave_Uninit'''
|-
|-
| colspan="2" | Uninitialise the Slave 
| colspan="2" | Uninitialise the Slave 
Line 355: Line 355:
==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'''  
|-
|-
|-
|-
Line 366: Line 366:
| colspan="2" | A global flag to enable or disable the SPI component from producing code. Useful for generating components with multiple communications options. 
| colspan="2" | A global flag to enable or disable the SPI component from producing code. Useful for generating components with multiple communications options. 
|-
|-
| 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 405: Line 405:
| colspan="2" |  
| colspan="2" |  
|-
|-
| 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;" | Options
| width="90%" class="mtx-class-propfolder" | Options
|-
|-
|-
|-
Line 434: Line 434:
| 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
|-
|-
|-
|-

Latest revision as of 14:37, 13 July 2026

Author Matrix TSL
Version 21.21
Category Misc


SPI component

CAL = Code Abstraction Layer - Allows one code base to run on a wide range of chips. A low level implementation giving direct access to the Serial Peripheral Interface peripheral.

Version information

Library Version, Component Version, Date, Author, Info
15, 2.1, 04-11-24, BR, Added pin caption to the remap port pin selection property
16, 2.2, 04-11-24, BR, Cleaned up pin caption from none remap port pin property
17, 2.2, 04-11-24, BR, Minor change to source to reflect change to I2C
21, 21.0, 28-04-25, MW, Minor change sim only to prevent chars FCD Helper from appearing on the display

Detailed description

No detailed description exists yet for this component

Examples

No additional examples









Macro reference

GetConsoleHandle

GetConsoleHandle
Returns a handle to the console used by this component 
- HANDLE Return


GetList

GetList
returns Named property list 
- STRING Name
 
- STRING Return


GetValue

GetValue
Reads Named property Value.  
- STRING Name
 
- STRING Return


Master_Byte

Master_Byte
Sends and receives a data byte 
- BYTE DataOut
 
- BYTE Return


Master_Disable_CS

Master_Disable_CS
Outputs a high signal to the chip select pin to deselect the remote slave device. 
- VOID Return


Master_Enable_CS

Master_Enable_CS
Outputs a low signal to the chip select pin to select the remote slave device. 
- VOID Return


Master_Init

Master_Init
Initialise the Master 
- BYTE Return


Master_Transaction

Master_Transaction
Sends and receives data bytes via the SPI channel. The Buffer is to contain the data to be sent, and is overwritten by the retuning data from the device. Returns 1 for success, 0 for failure 
- BYTE Buffer
 
- UINT Length
Number of bytes to transfer 
- BYTE Return


Master_Uninit

Master_Uninit
Uninitialise the Master 
- VOID Return


Prv_TextConsole

Prv_TextConsole
Send text to the SPI console. Exposed as part of the CAL_SPI component to allow none AutoCS pins and other. 
- STRING str
 
- BYTE Colour
0=Default, 1=TX, 2=RX 
- BYTE AppendTimestamp
0=Don't Append / 1=Do Append 
- VOID Return


SetPrescaler

SetPrescaler
Sets the prescaler value for the clock divider chain 
- BYTE Prescaler
 
- VOID Return


SetValue

SetValue
Change Named property to new Value.  
- STRING Name
 
- STRING Value
 
- VOID Return


Slave_Init

Slave_Init
Initialise the Slave 
- VOID Return


Slave_RxByte

Slave_RxByte
Returns the data received from the SPI Master 
- BYTE Return


Slave_TxByte

Slave_TxByte
Sets the data to be transmitted to the SPI master. 
- BYTE Data
 
- VOID Return


Slave_Uninit

Slave_Uninit
Uninitialise the Slave 
- VOID Return


Property reference

Properties
Component Enable
A global flag to enable or disable the SPI component from producing code. Useful for generating components with multiple communications options. 
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 Auto CS
Allow the SPI component to manage the CS pin for us in Master mode. On initialise the CS pin is automatically set high to disable the remote SPI device. Set to No if you want to create a component with multiple CS pins or if you want to manage the CS pin yourself. 
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.  
CS Polarity
 
Options
Mode
Configures the mode of the SPI component. Currently only Master mode is supported. 
Prescale
Prescale option selector 
Clock Phase
Clock Phase (data change edge) selection 
Clock Polarity
Clock Polarity setting, inactive (idle) state 
Sample Point
Data bit read sample point 
Simulation
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
Selects the API Slave to use to send and receive real world SPI data during simulation. 

Component Source Code

Please click here to download the component source project: FC_Comp_Source_SPI.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_SPI.fcfx