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 845: | Line 847: | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
− | |||
− | |||
Revision as of 12:20, 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 ADCSample10
- 5.2 ADCSample8
- 5.3 I2CInitialise
- 5.4 I2CReceive
- 5.5 I2CRestart
- 5.6 I2CSend
- 5.7 I2CStart
- 5.8 I2CStop
- 5.9 I2CTransInit
- 5.10 I2CTransReceive
- 5.11 I2CTransSend
- 5.12 IOGetInputPin
- 5.13 IOSetOutputPin
- 5.14 Initialise
- 5.15 PWMDisable
- 5.16 PWMEnable
- 5.17 PWMSetDuty8
- 5.18 PWMSetPrescaler
- 5.19 SPIInitialise
- 5.20 SPIPrescaler
- 5.21 SPITransfer
- 5.22 SPITransferTrans
- 5.23 ServoDisable
- 5.24 ServoEnable
- 5.25 ServoSetPosition8
- 5.26 UARTBaud
- 5.27 UARTCheckRX
- 5.28 UARTInitialise
- 5.29 UARTReceive
- 5.30 UARTSend
- 5.31 WIFIGetIP
- 5.32 WIFIIsConnected
- 5.33 WIFISetSSID
- 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_temp/Interface_Board_Comp.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_temp/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
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 |
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 |
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 |
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 |
I2CRestart
I2CRestart | |
Put the I2C Module into Restart mode | |
- BYTE | Channel |
Channel Index: Range 0 - I2C Bus Count - 1 | |
- VOID | Return |
I2CSend
I2CSend | |
Transmit a byte using the I2C bus | |
- BYTE | Channel |
Channel Index: Range 0 - I2C Bus Count - 1 | |
- BYTE | DataOut |
- BOOL | Return |
I2CStart
I2CStart | |
Put the I2C Module into Start mode | |
- BYTE | Channel |
Channel Index: Range 0 - I2C Bus Count - 1 | |
- VOID | Return |
I2CStop
I2CStop | |
Put the I2C Module into Stop mode | |
- BYTE | Channel |
- VOID | Return |
I2CTransInit
I2CTransReceive
I2CTransSend
IOGetInputPin
IOGetInputPin | |
Sets the selected digital pin to an input and reads the input state. | |
- BYTE | Pin |
Range: 0-17 | |
- BOOL | Return |
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 |
Initialise
Initialise | |
Initialise the comms to the Arduino board ready for commands to be sent. | |
- VOID | Return |
PWMDisable
PWMDisable | |
Disable a PWM output | |
- BYTE | Channel |
Range: 0-1 | |
- VOID | Return |
PWMEnable
PWMEnable | |
Enable a PWM output | |
- BYTE | Channel |
Range: 0-1 | |
- VOID | Return |
PWMSetDuty8
PWMSetDuty8 | |
Sets the duty for the PWM output | |
- BYTE | Channel |
Range: 0-1 | |
- BYTE | Duty |
Range: 0-255 | |
- VOID | Return |
PWMSetPrescaler
PWMSetPrescaler | |
Sets the prescaler for the PWM output | |
- BYTE | Prescaler |
- VOID | Return |
SPIInitialise
SPIInitialise | |
Initialsie the SPI module ready for communications | |
- BYTE | Channel |
Channel Index: Range 0 - SPI Bus Count - 1 | |
- 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 |
SPITransfer
SPITransfer | |
Transfer a byte using the SPI bus | |
- BYTE | Channel |
Channel Index: Range 0 - SPI Bus Count - 1 | |
- BYTE | DataOut |
- BYTE | Return |
SPITransferTrans
ServoDisable
ServoDisable | |
Disable a Servo output | |
- BYTE | Channel |
Range: 0-5 | |
- VOID | Return |
ServoEnable
ServoEnable | |
Enable a Servo output | |
- BYTE | Channel |
Range: 0-5 | |
- VOID | Return |
ServoSetPosition8
ServoSetPosition8 | |
Sets the position as an 8-bit value | |
- BYTE | Channel |
Range: 0-1 | |
- BYTE | Position |
Range: 0-255 | |
- VOID | Return |
UARTBaud
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 |
UARTInitialise
UARTInitialise | |
Initialise the UART module ready for communications | |
- BYTE | Channel |
Channel Index: Range 0 - UART Bus Count - 1 | |
- 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 |
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 |
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 |
WIFIIsConnected
WIFIIsConnected | |
Checks to see if the WIFI is active and connected | |
- BOOL | Return |
WIFISetSSID