Difference between revisions of "Component: API (ECIO28P) (API Slave Devices)"
Line 20: | Line 20: | ||
==Detailed description== | ==Detailed description== | ||
+ | |||
+ | |||
Line 58: | Line 60: | ||
==Examples== | ==Examples== | ||
+ | |||
+ | |||
Line 236: | Line 240: | ||
{{Fcfile|ECIO_SCADASlave_UART.fcfx|ECIO App Developer Slave UART Demo}} | {{Fcfile|ECIO_SCADASlave_UART.fcfx|ECIO App Developer Slave UART Demo}} | ||
− | == | + | ==Macro reference== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
Revision as of 14:10, 20 January 2023
Author | Matrix TSL |
Version | 2.0 |
Category | API Slave Devices |
Contents
API (ECIO28P) component
Connects to an ECIO28P 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 See Flowcode Help Wiki for firmware.
Component Source Code
Please click here for the component source code: FC_Comp_Source_ECIO28P_API_Comp.fcfx
Detailed description
The App Developer (ECIO28P) component allows an ECIO28P board to be controlled from within the Flowcode simulation runtime.
To allow Flowcode to communicate and control the ECIO28P hardware the board must first be pre-programmed with dedicated firmware.
The firmware hex file and Flowcode source project can be downloaded from here.
ECIO28P App Developer Firmware
More information about the workings of the firmware project can be found on the FiniteStateMachine page.
The COM port to the ECIO hardware is selected via the SCADA_ECIO28P component COM port property.
When building the component into a App Developer project remember to expose the COM port property to allow the end user to select the correct port for the hardware.
The console window can display data in two modes which is set via a component property.
- fixed statistics showing IO / ADC inputs / PWM
- scrolling log showing all commands and returns
Examples
Pin Mapping
Here is a table showing how the App Developer Slave digital pins are mapped on the device.
App Developer Slave Digital Pin | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
Device Port Pin | A0 | A1 | A2 | A3 | A4 | A5 | B0 | B1 | B2 | B3 | B4 | B5 | B6 | B7 | C0 | C1 | C2 | C6 | C7 |
Here is a table showing how the App Developer Slave analogue pins are mapped on the device.
App Developer Slave Analogue Pin | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
Device Port Pin | A0 | A1 | A2 | A3 | A5 | B2 | B3 | B1 | B4 | B0 |
Here is a table showing how the App Developer Slave peripheral pins are mapped on the device.
App Developer Slave Peripheral Pin | I2C SDA | I2C SCL | SPI MOSI | SPI MISO | SPI SCK | UART RX | UART TX | PWM 0 | PWM 1 |
Device Port Pin | B0 | B1 | C7 | B0 | B1 | C7 | C6 | C2 | C1 |
Direct Slave Access
Here is a simple demo to switch on and off digital pin 5 (the LED pin).
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.
ECIO 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.
ECIO 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.
ECIO App Developer Slave UART Demo
Macro reference
![]() |
I2CInitialise |
Initialsie the I2C module ready for communications | |
![]() |
Channel |
Channel Index: Range 0 - I2C Bus Count - 1 | |
![]() |
Baud |
0=100KHz, 1=400KHz, 2=1MHz | |
![]() |
Return |
![]() |
IOGetInputPin |
Sets the selected digital pin to an input and reads the input state. | |
![]() |
Pin |
Range: 0-18 | |
![]() |
Return |
![]() |
ADCSample8 |
Reads the voltage present on an Alanog pin as an 8-bit value range 0-255 | |
![]() |
ADCChannel |
Range: 0-12 | |
![]() |
Return |
![]() |
UARTInitialise |
Initialise the UART module ready for communications | |
![]() |
Channel |
Channel Index: Range 0 - UART Bus Count - 1 | |
![]() |
Return |
![]() |
UARTCheckRX |
Check to see if the UART module has received any data | |
![]() |
Channel |
Channel Index: Range 0 - UART Bus Count - 1 | |
![]() |
Return |
![]() |
RegisterWrite |
Writes to one of the registers on-board the device | |
![]() |
RegisterAddress |
The address of the register | |
![]() |
Data |
The data value to assign to the register | |
![]() |
Return |
![]() |
RegisterRead |
Read one of the registers on-board the device | |
![]() |
RegisterAddress |
The address of the register | |
![]() |
Return |
![]() |
I2CRestart |
Put the I2C Module into Restart mode | |
![]() |
Channel |
Channel Index: Range 0 - I2C Bus Count - 1 | |
![]() |
Return |
![]() |
PWMDisable |
Disable a PWM output | |
![]() |
Channel |
Range: 0-1 | |
![]() |
Return |
![]() |
I2CStart |
Put the I2C Module into Start mode | |
![]() |
Channel |
Channel Index: Range 0 - I2C Bus Count - 1 | |
![]() |
Return |
![]() |
SPITransfer |
Transfer a byte using the SPI bus | |
![]() |
Channel |
Channel Index: Range 0 - SPI Bus Count - 1 | |
![]() |
DataOut |
![]() |
Return |
![]() |
I2CReceive |
Receive a byte using the I2C bus | |
![]() |
Channel |
Channel Index: Range 0 - I2C Bus Count - 1 | |
![]() |
Last |
Last byte to receive: Range 0-1 | |
![]() |
Return |
![]() |
I2CStop |
Put the I2C Module into Stop mode | |
![]() |
Channel |
![]() |
Return |
![]() |
ADCSetReferenceVoltage |
Specified the reference setting for ADC reads. | |
![]() |
RefType |
0=AREF, 1=VCC, 3=Internal 1.1V | |
![]() |
Return |
![]() |
SPIPrescaler |
Modify the speed of the SPI bus | |
![]() |
Channel |
Channel Index: Range 0 - SPI Bus Count - 1 | |
![]() |
Prescaler |
Range: 0-2 | |
![]() |
Return |
![]() |
PWMSetDuty |
Sets the duty for the PWM output | |
![]() |
Channel |
Range: 0-5 | |
![]() |
Duty |
![]() |
Return |
![]() |
ADCSample10 |
Reads the voltage present on an Alanog pin as an 10-bit value range 0-1023 | |
![]() |
ADCChannel |
Range: 0-12 | |
![]() |
Return |
![]() |
IOSetOutputPin |
Sets the selected digital pin to an output and assigns the output state. | |
![]() |
Pin |
Range: 0-18 | |
![]() |
State |
Range: 0-1 | |
![]() |
Return |
![]() |
UARTReceive |
Receives a data byte from the UART. Recommend calling the UARTCheckRx function first to ensure data is available. | |
![]() |
Channel |
Channel Index: Range 0 - UART Bus Count - 1 | |
![]() |
Return |
![]() |
SPIInitialise |
Initialsie the SPI module ready for communications | |
![]() |
Channel |
Channel Index: Range 0 - SPI Bus Count - 1 | |
![]() |
Return |
![]() |
I2CSend |
Transmit a byte using the I2C bus | |
![]() |
Channel |
Channel Index: Range 0 - I2C Bus Count - 1 | |
![]() |
DataOut |
![]() |
Return |
![]() |
UARTSend |
Send a byte via the UART module | |
![]() |
Channel |
Channel Index: Range 0 - UART Bus Count - 1 | |
![]() |
Data |
Data Byte to send. Range: 0-255 | |
![]() |
Return |
![]() |
PWMSetPrescaler |
Sets the prescaler for the PWM output | |
![]() |
Channel |
![]() |
Prescaler |
![]() |
Period |
Default 255 | |
![]() |
Return |
![]() |
PWMEnable |
Enable a PWM output | |
![]() |
Channel |
Range: 0-1 | |
![]() |
Return |
![]() |
Initialise |
Initialise the comms to the Arduino board ready for commands to be sent. | |
![]() |
Return |