Component: API (Interface Board) (API Slave Devices)

From Flowcode Help
Jump to navigationJump to search
Author Matrix TSL
Version 1.0
Category API Slave Devices


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

A board designed to allow PC access to embedded style electronic signals at 3V3 or 5V.

Includes: ADC / DAC / I2C / IO / Servo / SPI / UART

USB Firmware allows control via a USB connection. Works with a Windows PC but should also work with other USB master based devices.

WIFI Firmware allows control via a WIFI network connection. Works with any networked device including devices via the internet. WIFI connection requires the use of the UART peripheral and so this is not available for Slave functionality when using the WIFI firmware.

Board supplied with firmware as requested. Firmware can be changed using a PICkit 3 or PICkit 4 device or similar Microchip programmer.

To setup the WIFI to work with your own network you first need to power up the board using a USB connection or by applying a 5V power supply between the 5V and GND pins. Next connect to the WIFI network hosted by the board with the network name InterfaceBoard using password all in lowercase as the Password. Visit the website at page 192.168.4.1 and then enter your WIFI network details into the form provided. On clicking ok the board will store the details in none volatile memory and attempt to connect to your network and establish a local IP address. If all goes ok here then the Interface Board network should dissappear.

Refer to your router configuration page to see the IP address of the device.

If the WIFI network is not available then the board will revert back to it's setup mode allowing the network to be changed. Once network connection is available again the board will automatically reconnect.

The latest updates can be found on github



Examples

Direct Slave Access

Here is a simple demo to switch on and off digital pin 5.


FC6 Icon.png Simple Interface Board Demo








Macro reference

ADCSample10

Fc9-comp-macro.png ADCSample10
Reads the voltage present on an Alanog pin as an 10-bit value range 0-1023 
Fc9-u8-icon.png - BYTE ADCChannel
Range: 0-5 
Fc9-u16-icon.png - UINT Return


ADCSample8

Fc9-comp-macro.png ADCSample8
Reads the voltage present on an Alanog pin as an 8-bit value range 0-255 
Fc9-u8-icon.png - BYTE ADCChannel
Range: 0-5 
Fc9-u8-icon.png - BYTE Return


I2CInitialise

Fc9-comp-macro.png I2CInitialise
Initialsie the I2C module ready for communications 
Fc9-u8-icon.png - BYTE Channel
Channel Index: Range 0 - I2C Bus Count - 1 
Fc9-u8-icon.png - BYTE Baud
0=100KHz, 1=400KHz, 2=1MHz 
Fc9-void-icon.png - VOID Return


I2CReceive

Fc9-comp-macro.png I2CReceive
Receive a byte using the I2C bus 
Fc9-u8-icon.png - BYTE Channel
Channel Index: Range 0 - I2C Bus Count - 1 
Fc9-bool-icon.png - BOOL Last
Last byte to receive: Range 0-1 
Fc9-u8-icon.png - BYTE Return


I2CRestart

Fc9-comp-macro.png I2CRestart
Put the I2C Module into Restart mode 
Fc9-u8-icon.png - BYTE Channel
Channel Index: Range 0 - I2C Bus Count - 1 
Fc9-void-icon.png - VOID Return


I2CSend

Fc9-comp-macro.png I2CSend
Transmit a byte using the I2C bus 
Fc9-u8-icon.png - BYTE Channel
Channel Index: Range 0 - I2C Bus Count - 1 
Fc9-u8-icon.png - BYTE DataOut
 
Fc9-bool-icon.png - BOOL Return


I2CStart

Fc9-comp-macro.png I2CStart
Put the I2C Module into Start mode 
Fc9-u8-icon.png - BYTE Channel
Channel Index: Range 0 - I2C Bus Count - 1 
Fc9-void-icon.png - VOID Return


I2CStop

Fc9-comp-macro.png I2CStop
Put the I2C Module into Stop mode 
Fc9-u8-icon.png - BYTE Channel
 
Fc9-void-icon.png - VOID Return


I2CTransInit

Fc9-comp-macro.png I2CTransInit
Initialises the I2C Transaction mode with the 7-bit device address 
Fc9-u8-icon.png - BYTE Channel
Channel Index: Range 0 - I2C Bus Count - 1 
Fc9-u8-icon.png - BYTE DeviceAddress
7-bit Device Address 
Fc9-u8-icon.png - BYTE Baud
0=100KHz, 1=400KHz, 2=1MHz 
Fc9-void-icon.png - VOID Return


I2CTransReceive

Fc9-comp-macro.png I2CTransReceive
Receives an I2C Transaction on the selected I2C channel. Returns the number of bytes received. 
Fc9-u8-icon.png - BYTE Channel
Channel Index: Range 0 - I2C Bus Count - 1 
Fc9-u8-icon.png - BYTE Data
Data variable to receive into 
Fc9-u16-icon.png - UINT Count
Number of bytes to receive 
Fc9-u16-icon.png - UINT Return


I2CTransSend

Fc9-comp-macro.png I2CTransSend
Sends an I2C Transaction on the selected I2C channel. Returns the number of bytes sent. 
Fc9-u8-icon.png - BYTE Channel
Channel Index: Range 0 - I2C Bus Count - 1 
Fc9-u8-icon.png - BYTE Data
Data to send 
Fc9-u16-icon.png - UINT Count
Number of bytes to send out, MS bit 0x8000 signifies no Stop if set 
Fc9-u16-icon.png - UINT Return


IOGetInputPin

Fc9-comp-macro.png IOGetInputPin
Sets the selected digital pin to an input and reads the input state. 
Fc9-u8-icon.png - BYTE Pin
Range: 0-17 
Fc9-bool-icon.png - BOOL Return


IOSetOutputPin

Fc9-comp-macro.png IOSetOutputPin
Sets the selected digital pin to an output and assigns the output state. 
Fc9-u8-icon.png - BYTE Pin
Range: 0-17 
Fc9-bool-icon.png - BOOL State
Range: 0-1 
Fc9-void-icon.png - VOID Return


Initialise

Fc9-comp-macro.png Initialise
Initialise the comms to the Arduino board ready for commands to be sent. 
Fc9-void-icon.png - VOID Return


PWMDisable

Fc9-comp-macro.png PWMDisable
Disable a PWM output 
Fc9-u8-icon.png - BYTE Channel
Range: 0-1 
Fc9-void-icon.png - VOID Return


PWMEnable

Fc9-comp-macro.png PWMEnable
Enable a PWM output 
Fc9-u8-icon.png - BYTE Channel
Range: 0-1 
Fc9-void-icon.png - VOID Return


PWMSetDuty8

Fc9-comp-macro.png PWMSetDuty8
Sets the duty for the PWM output 
Fc9-u8-icon.png - BYTE Channel
Range: 0-1 
Fc9-u8-icon.png - BYTE Duty
Range: 0-255 
Fc9-void-icon.png - VOID Return


PWMSetPrescaler

Fc9-comp-macro.png PWMSetPrescaler
Sets the prescaler for the PWM output 
Fc9-u8-icon.png - BYTE Prescaler
 
Fc9-void-icon.png - VOID Return


SPIInitialise

Fc9-comp-macro.png SPIInitialise
Initialsie the SPI module ready for communications 
Fc9-u8-icon.png - BYTE Channel
Channel Index: Range 0 - SPI Bus Count - 1 
Fc9-void-icon.png - VOID Return


SPIPrescaler

Fc9-comp-macro.png SPIPrescaler
Modify the speed of the SPI bus 
Fc9-u8-icon.png - BYTE Channel
Channel Index: Range 0 - SPI Bus Count - 1 
Fc9-u8-icon.png - BYTE Prescaler
Range: 0-2 
Fc9-void-icon.png - VOID Return


SPITransfer

Fc9-comp-macro.png SPITransfer
Transfer a byte using the SPI bus 
Fc9-u8-icon.png - BYTE Channel
Channel Index: Range 0 - SPI Bus Count - 1 
Fc9-u8-icon.png - BYTE DataOut
 
Fc9-u8-icon.png - BYTE Return


SPITransferTrans

Fc9-comp-macro.png SPITransferTrans
Transfer an array of bytes using the SPI bus 
Fc9-u8-icon.png - BYTE Channel
Channel Index: Range 0 - SPI Bus Count - 1 
Fc9-u16-icon.png - UINT Count
Number of bytes to send and receive 
Fc9-u8-icon.png - BYTE DataOut
Outgoing data 
Fc9-u8-icon.png - BYTE DataIn
Incoming data 
Fc9-void-icon.png - VOID Return


ServoDisable

Fc9-comp-macro.png ServoDisable
Disable a Servo output 
Fc9-u8-icon.png - BYTE Channel
Range: 0-5 
Fc9-void-icon.png - VOID Return


ServoEnable

Fc9-comp-macro.png ServoEnable
Enable a Servo output 
Fc9-u8-icon.png - BYTE Channel
Range: 0-5 
Fc9-void-icon.png - VOID Return


ServoSetPosition8

Fc9-comp-macro.png ServoSetPosition8
Sets the position as an 8-bit value 
Fc9-u8-icon.png - BYTE Channel
Range: 0-1 
Fc9-u8-icon.png - BYTE Position
Range: 0-255 
Fc9-void-icon.png - VOID Return


UARTBaud

Fc9-comp-macro.png UARTBaud
Control the communications rate of the UART module 
Fc9-u8-icon.png - BYTE Channel
Channel Index: Range 0 - UART Bus Count - 1 
Fc9-u8-icon.png - BYTE Rate
0=1200, 1=2400, 2=4800, 3=9600, 4=19200, 5=38400, 6=57600, 7=115200 
Fc9-void-icon.png - VOID Return


UARTCheckRX

Fc9-comp-macro.png UARTCheckRX
Check to see if the UART module has received any data 
Fc9-u8-icon.png - BYTE Channel
Channel Index: Range 0 - UART Bus Count - 1 
Fc9-u8-icon.png - BYTE Return


UARTInitialise

Fc9-comp-macro.png UARTInitialise
Initialise the UART module ready for communications 
Fc9-u8-icon.png - BYTE Channel
Channel Index: Range 0 - UART Bus Count - 1 
Fc9-void-icon.png - VOID Return


UARTReceive

Fc9-comp-macro.png UARTReceive
Receives a data byte from the UART. Recommend calling the UARTCheckRx function first to ensure data is available. 
Fc9-u8-icon.png - BYTE Channel
Channel Index: Range 0 - UART Bus Count - 1 
Fc9-u8-icon.png - BYTE Return


UARTSend

Fc9-comp-macro.png UARTSend
Send a byte via the UART module 
Fc9-u8-icon.png - BYTE Channel
Channel Index: Range 0 - UART Bus Count - 1 
Fc9-u8-icon.png - BYTE Data
Data Byte to send. Range: 0-255 
Fc9-void-icon.png - VOID Return


WIFIGetIP

Fc9-comp-macro.png 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.  
Fc9-string-icon.png - STRING Return


WIFIIsConnected

Fc9-comp-macro.png WIFIIsConnected
Checks to see if the WIFI is active and connected 
Fc9-bool-icon.png - BOOL Return


WIFISetSSID

Fc9-comp-macro.png WIFISetSSID
Assign the SSID and password for the network you wish to connect the board to. Stores the parameters into ROM for later USB free setup. 
Fc9-string-icon.png - STRING SSID
Name of the network you wish to connect to 
Fc9-string-icon.png - STRING Password
 
Fc9-void-icon.png - VOID Return


Property reference

Fc9-prop-icon.png Properties
Fc9-type-16-icon.png Connection Type
 
Fc9-conn-icon.png Connection Properties
Fc9-type-7-icon.png Auto Detect Port
Allows the component to auto detect the interface board COM port. Requires the latest Flowcode serial comms DLL to function correctly. 
Fc9-type-16-icon.png Scan Results
Lists the IP addresses found during the last scan, Overwrites the selected WIFI IP property when changed. 
Fc9-type-21-icon.png Scan Start
Address to set the scan start point. For example 10 might generate 192.168.1.10 depending on your IP setting. Scan then proceeds from there so for example 11, 12, 13, ..., 254, 255. Default 0 
Fc9-type-16-icon.png End Scan
Decides how the scan is terminated 
Fc9-conn-icon.png API Peripherals
Fc9-type-21-icon.png Digital IO
 
Fc9-type-21-icon.png Analog Input
 
Fc9-type-21-icon.png Analog Output
 
Fc9-type-21-icon.png PWM Output
 
Fc9-type-21-icon.png I2C Bus
 
Fc9-type-21-icon.png SPI Bus
 
Fc9-type-21-icon.png UART
 
Fc9-type-21-icon.png SERVO
 
Fc9-conn-icon.png Logging
Fc9-type-7-icon.png Console Log
Create an automatic console log of the commands sent to the device 
Fc9-type-16-icon.png Log Mode
Controls how the console data is formatted. Fixed statistics gives an easy to read overview of the IO, Analog and PWM functionality Command Log gives a more in depth analysis of the outgoing commands and incoming returns ASCII mode allows serial data to be shown in raw text form, other commands are shown as in the Command Log mode 
Fc9-type-7-icon.png Show Raw
Shows the raw data stream via a console window