Difference between revisions of "Component: API (Interface Board) (API Slave Devices)"
Line 126: | Line 126: | ||
{{Fcfile|IB_SCADASlave_UART.fcfx|Interface Board App Developer Slave UART Demo}} | {{Fcfile|IB_SCADASlave_UART.fcfx|Interface Board App Developer Slave UART Demo}} | ||
+ | |||
+ | |||
Line 131: | Line 133: | ||
==Macro reference== | ==Macro reference== | ||
+ | ===I2CInitialise=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 154: | Line 157: | ||
+ | ===SPITransferTrans=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 187: | Line 191: | ||
+ | ===IOGetInputPin=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 205: | Line 210: | ||
+ | ===UARTBaud=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 228: | Line 234: | ||
+ | ===ADCSample8=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 246: | Line 253: | ||
+ | ===I2CTransReceive=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 274: | Line 282: | ||
+ | ===UARTInitialise=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 292: | Line 301: | ||
+ | ===UARTCheckRX=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 310: | Line 320: | ||
+ | ===I2CRestart=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 328: | Line 339: | ||
+ | ===WIFIIsConnected=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 341: | Line 353: | ||
+ | ===PWMDisable=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 359: | Line 372: | ||
+ | ===I2CStart=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 377: | Line 391: | ||
+ | ===SPITransfer=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 400: | Line 415: | ||
+ | ===I2CReceive=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 423: | Line 439: | ||
+ | ===I2CStop=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 441: | Line 458: | ||
+ | ===WIFISetSSID=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 464: | Line 482: | ||
+ | ===ServoDisable=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 482: | Line 501: | ||
+ | ===SPIPrescaler=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 505: | Line 525: | ||
+ | ===ServoEnable=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 523: | Line 544: | ||
+ | ===ADCSample10=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 541: | Line 563: | ||
+ | ===I2CTransSend=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 569: | Line 592: | ||
+ | ===I2CTransInit=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 597: | Line 621: | ||
+ | ===IOSetOutputPin=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 620: | Line 645: | ||
+ | ===ServoSetPosition8=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 643: | Line 669: | ||
+ | ===UARTReceive=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 661: | Line 688: | ||
+ | ===SPIInitialise=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 679: | Line 707: | ||
+ | ===WIFIGetIP=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 692: | Line 721: | ||
+ | ===I2CSend=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 715: | Line 745: | ||
+ | ===UARTSend=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 738: | Line 769: | ||
+ | ===PWMSetPrescaler=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 756: | Line 788: | ||
+ | ===PWMSetDuty8=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 779: | Line 812: | ||
+ | ===PWMEnable=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 797: | Line 831: | ||
+ | ===Initialise=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- |
Revision as of 11:50, 3 February 2023
Author | Matrix TSL |
Version | 1.0 |
Category | API Slave Devices |
Contents
- 1 API (Interface Board) component
- 2 Component Source Code
- 3 Detailed description
- 4 Examples
- 5 Macro reference
- 5.1 I2CInitialise
- 5.2 SPITransferTrans
- 5.3 IOGetInputPin
- 5.4 UARTBaud
- 5.5 ADCSample8
- 5.6 I2CTransReceive
- 5.7 UARTInitialise
- 5.8 UARTCheckRX
- 5.9 I2CRestart
- 5.10 WIFIIsConnected
- 5.11 PWMDisable
- 5.12 I2CStart
- 5.13 SPITransfer
- 5.14 I2CReceive
- 5.15 I2CStop
- 5.16 WIFISetSSID
- 5.17 ServoDisable
- 5.18 SPIPrescaler
- 5.19 ServoEnable
- 5.20 ADCSample10
- 5.21 I2CTransSend
- 5.22 I2CTransInit
- 5.23 IOSetOutputPin
- 5.24 ServoSetPosition8
- 5.25 UARTReceive
- 5.26 SPIInitialise
- 5.27 WIFIGetIP
- 5.28 I2CSend
- 5.29 UARTSend
- 5.30 PWMSetPrescaler
- 5.31 PWMSetDuty8
- 5.32 PWMEnable
- 5.33 Initialise
- 6 Property reference
API (Interface Board) component
Connects to an Interface Board running the API Firmware allowing the board to become a slave to the Flowcode Embedded simulation or Flowcode App Developer. Supports: Digital IO / ADC / I2C / SPI / PWM / UART / DAC / Servo See Instructables for open source project files.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_Interface_Board_Comp.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_Interface_Board_Comp.fcfx
Detailed description
No detailed description exists yet for this component
Examples
Direct Slave Access
Here is a simple demo to switch on and off digital pin 5.
Rapid Development - Virtualised SPI
A feature of the App Developer Slave interface is to use the component for rapid development.
The App Developer Slave hardware can be used to take communications from the Flowcode simulation and transfer them to a real world device allowing for easy code generation and test without having to download to a target microcontroller device.
The CS pin and SPI Prescaler are set via the properties of the Injector component.
The SPI Master component is linked to the Injector component via the Injector property.
The Injector component is linked to the App Developer Slave component via the App Developer Slave property.
Interface Board App Developer Slave SPI Demo
Rapid Development - Virtualised I2C
A feature of the App Developer Slave interface is to use the component for rapid development.
The App Developer Slave hardware can be used to take communications from the Flowcode simulation and transfer them to a real world device allowing for easy code generation and test without having to download to a target microcontroller device.
The I2C Master component is linked to the Injector component via the Injector property.
The Injector component is linked to the App Developer Slave component via the App Developer Slave property.
Interface Board App Developer Slave I2C Demo
Rapid Development - Virtualised UART
A feature of the App Developer Slave interface is to use the component for rapid development.
The App Developer Slave hardware can be used to take communications from the Flowcode simulation and transfer them to a real world device allowing for easy code generation and test without having to download to a target microcontroller device.
The Baud rate and optional RS485 Properties are set via the properties of the Injector component.
The UART component is linked to the Injector component via the Injector property.
The Injector component is linked to the App Developer Slave component via the App Developer Slave property.
Interface Board App Developer Slave UART Demo
Macro reference
I2CInitialise
I2CInitialise | |
Initialsie the I2C module ready for communications | |
- BYTE | Channel |
Channel Index: Range 0 - I2C Bus Count - 1 | |
- BYTE | Baud |
0=100KHz, 1=400KHz, 2=1MHz | |
- VOID | Return |
SPITransferTrans
IOGetInputPin
IOGetInputPin | |
Sets the selected digital pin to an input and reads the input state. | |
- BYTE | Pin |
Range: 0-17 | |
- BOOL | Return |
UARTBaud
ADCSample8
ADCSample8 | |
Reads the voltage present on an Alanog pin as an 8-bit value range 0-255 | |
- BYTE | ADCChannel |
Range: 0-5 | |
- BYTE | Return |
I2CTransReceive
UARTInitialise
UARTInitialise | |
Initialise the UART module ready for communications | |
- BYTE | Channel |
Channel Index: Range 0 - UART Bus Count - 1 | |
- VOID | Return |
UARTCheckRX
UARTCheckRX | |
Check to see if the UART module has received any data | |
- BYTE | Channel |
Channel Index: Range 0 - UART Bus Count - 1 | |
- BYTE | Return |
I2CRestart
I2CRestart | |
Put the I2C Module into Restart mode | |
- BYTE | Channel |
Channel Index: Range 0 - I2C Bus Count - 1 | |
- VOID | Return |
WIFIIsConnected
WIFIIsConnected | |
Checks to see if the WIFI is active and connected | |
- BOOL | Return |
PWMDisable
PWMDisable | |
Disable a PWM output | |
- BYTE | Channel |
Range: 0-1 | |
- VOID | Return |
I2CStart
I2CStart | |
Put the I2C Module into Start mode | |
- BYTE | Channel |
Channel Index: Range 0 - I2C Bus Count - 1 | |
- VOID | Return |
SPITransfer
SPITransfer | |
Transfer a byte using the SPI bus | |
- BYTE | Channel |
Channel Index: Range 0 - SPI Bus Count - 1 | |
- BYTE | DataOut |
- BYTE | Return |
I2CReceive
I2CReceive | |
Receive a byte using the I2C bus | |
- BYTE | Channel |
Channel Index: Range 0 - I2C Bus Count - 1 | |
- BOOL | Last |
Last byte to receive: Range 0-1 | |
- BYTE | Return |
I2CStop
I2CStop | |
Put the I2C Module into Stop mode | |
- BYTE | Channel |
- VOID | Return |
WIFISetSSID
ServoDisable
ServoDisable | |
Disable a Servo output | |
- BYTE | Channel |
Range: 0-5 | |
- VOID | Return |
SPIPrescaler
SPIPrescaler | |
Modify the speed of the SPI bus | |
- BYTE | Channel |
Channel Index: Range 0 - SPI Bus Count - 1 | |
- BYTE | Prescaler |
Range: 0-2 | |
- VOID | Return |
ServoEnable
ServoEnable | |
Enable a Servo output | |
- BYTE | Channel |
Range: 0-5 | |
- VOID | Return |
ADCSample10
ADCSample10 | |
Reads the voltage present on an Alanog pin as an 10-bit value range 0-1023 | |
- BYTE | ADCChannel |
Range: 0-5 | |
- UINT | Return |
I2CTransSend
I2CTransInit
IOSetOutputPin
IOSetOutputPin | |
Sets the selected digital pin to an output and assigns the output state. | |
- BYTE | Pin |
Range: 0-17 | |
- BOOL | State |
Range: 0-1 | |
- VOID | Return |
ServoSetPosition8
ServoSetPosition8 | |
Sets the position as an 8-bit value | |
- BYTE | Channel |
Range: 0-1 | |
- BYTE | Position |
Range: 0-255 | |
- VOID | Return |
UARTReceive
UARTReceive | |
Receives a data byte from the UART. Recommend calling the UARTCheckRx function first to ensure data is available. | |
- BYTE | Channel |
Channel Index: Range 0 - UART Bus Count - 1 | |
- BYTE | Return |
SPIInitialise
SPIInitialise | |
Initialsie the SPI module ready for communications | |
- BYTE | Channel |
Channel Index: Range 0 - SPI Bus Count - 1 | |
- VOID | Return |
WIFIGetIP
WIFIGetIP | |
Gets the IP address of the board. Allows you to setup and get the assigned address via USB before using over WIFI, Use the WIFIIsConnected first to check the WIFI is active. | |
- STRING | Return |
I2CSend
I2CSend | |
Transmit a byte using the I2C bus | |
- BYTE | Channel |
Channel Index: Range 0 - I2C Bus Count - 1 | |
- BYTE | DataOut |
- BOOL | Return |
UARTSend
UARTSend | |
Send a byte via the UART module | |
- BYTE | Channel |
Channel Index: Range 0 - UART Bus Count - 1 | |
- BYTE | Data |
Data Byte to send. Range: 0-255 | |
- VOID | Return |
PWMSetPrescaler
PWMSetPrescaler | |
Sets the prescaler for the PWM output | |
- BYTE | Prescaler |
- VOID | Return |
PWMSetDuty8
PWMSetDuty8 | |
Sets the duty for the PWM output | |
- BYTE | Channel |
Range: 0-1 | |
- BYTE | Duty |
Range: 0-255 | |
- VOID | Return |
PWMEnable
PWMEnable | |
Enable a PWM output | |
- BYTE | Channel |
Range: 0-1 | |
- VOID | Return |
Initialise
Initialise | |
Initialise the comms to the Arduino board ready for commands to be sent. | |
- VOID | Return |