| Author
|
Matrix Ltd
|
| Version
|
3.0
|
| Category
|
E-blocks 3
|
E-Blocks 3 (USB Comms) component
Low level routines for connecting the E-blocks 3 hardware to the computer using a USB COM port serial data connection.
Detailed description
No detailed description exists yet for this component
Examples
No additional examples
Macro reference
ChangeHWBaud
|
ChangeHWBaud
|
| Changes the hardware UART baud rate allowing for dynamic speed changes.
|
- BYTE
|
NewBaud
|
| 0=1200, 1=2400, 2=4800, 3=9600, 4=19200, 5=38400, 6=57600, 7=115200, 8=250000
|
- VOID
|
Return
|
Initialise
|
Initialise
|
| Sets up the RS232 peripheral, must be called at the start of your program or at least before you start calling any other RS232 macros.
|
- VOID
|
Return
|
ReceiveBinary16Bit
|
ReceiveBinary16Bit
|
| Receives a binary 16-bit value split across two bytes.
|
- BOOL
|
MSBfirst
|
| 0=Least significant byte first, 1=Most significant byte first
|
- BYTE
|
Timeout
|
| Max amount of time in ms to wait between bytes
|
- UINT
|
Return
|
ReceiveBinary32Bit
|
ReceiveBinary32Bit
|
| Receives a binary 32-bit value split across four bytes.
|
- BOOL
|
MSBfirst
|
| 0=Least significant byte first, 1=Most significant byte first
|
- BYTE
|
Timeout
|
| Max amount of time in ms to wait between bytes
|
- ULONG
|
Return
|
ReceiveBinaryFloat
|
ReceiveBinaryFloat
|
| Receives a binary 32-bit floating point value split across four bytes.
|
- BOOL
|
MSBfirst
|
| 0=Least significant byte first, 1=Most significant byte first
|
- BYTE
|
Timeout
|
| Max amount of time in ms to wait between bytes
|
- FLOAT
|
Return
|
ReceiveByteArray
|
ReceiveByteArray
|
| Receives an array of bytes and returns the number of bytes received.
|
- BYTE
|
Data
|
| Array to store the incoming data
|
- UINT
|
NumBytes
|
| Maximum number of bytes to try and receive
|
- BYTE
|
Timeout
|
| Max amount of time in ms to wait between bytes
|
- BYTE
|
Return
|
ReceiveChar
|
ReceiveChar
|
| Attempts to receive a single packet from the UART interface.
|
- BYTE
|
Timeout
|
| Time to wait in milliseconds for valid data before returning, 0=Dont wait, 255=Wait forever.
|
- INT
|
Return
|
ReceiveFloat
|
ReceiveFloat
|
| Attempts to receive a floating point number as ASCII characters and convert back into a numeric value. Note this function will receive until a timeout or a none numeric char is received, the none numeric char will be lost.
|
- BYTE
|
Timeout
|
| Max time in ms to wait in between bytes
|
- BOOL
|
IgnoreData
|
| 0=Dont ignore any data, 1=Ignore any initial none numeric data
|
- FLOAT
|
Return
|
ReceiveHexNumber
|
ReceiveHexNumber
|
| Attempts to receive a hex number as ASCII characters and convert back into a numeric value. Note this function will receive until a timeout or a none hexadecimal char is received, the none numeric char will be lost.
|
- BYTE
|
Timeout
|
| Max time in ms to wait in between bytes
|
- BOOL
|
IgnoreData
|
| 0=Dont ignore any data, 1=Ignore any initial none numeric data
|
- BOOL
|
Prefix
|
| Look for prefix before receiving, 1=0xFF, 0=FF
|
- ULONG
|
Return
|
ReceiveINTArray
|
ReceiveINTArray
|
| Receives an array of 16-bit INT/UINT values and returns the number of values received.
|
- UINT
|
Data
|
| Array to store the incoming data
|
- UINT
|
NumValues
|
| Maximum number of values to try and receive
|
- BOOL
|
MSBfirst
|
| 0=Least significant byte first, 1=Most significant byte first
|
- BYTE
|
Timeout
|
| Max amount of time in ms to wait between bytes
|
- BYTE
|
Return
|
ReceiveNumber
|
ReceiveNumber
|
| Attempts to receive a number as ASCII characters and convert back into a numeric value. Note this function will receive until a timeout or a none numeric char is received, the none numeric char will be lost.
|
- BYTE
|
Timeout
|
| Max time in ms to wait in between bytes
|
- BOOL
|
IgnoreData
|
| 0=Dont ignore any data, 1=Ignore any initial none numeric data
|
- LONG
|
Return
|
ReceiveString
|
ReceiveString
|
| Attempts to receive a string of bytes from the UART interface.
|
- BYTE
|
Timeout
|
| Time to wait in milliseconds for valid data before returning, 0=Dont wait, 255=Wait forever.
|
- UINT
|
NumBytes
|
| The number of bytes to try and receive, ideally your string variable should have at least 1 more byte to store the null termination byte
|
- STRING
|
Return
|
SendBinary16Bit
|
SendBinary16Bit
|
| Sends out a 16-bit binary value split across two bytes.
|
- UINT
|
Value
|
|
|
- BOOL
|
MSBfirst
|
| 0=Least significant byte first, 1=Most significant byte first
|
- VOID
|
Return
|
SendBinary32Bit
|
SendBinary32Bit
|
| Sends out a 32-bit binary value split across four bytes.
|
- ULONG
|
Value
|
|
|
- BOOL
|
MSBfirst
|
| 0=Least significant byte first, 1=Most significant byte first
|
- VOID
|
Return
|
SendBinaryFloat
|
SendBinaryFloat
|
| Sends out a 32-bit binary floating point value split across four bytes.
|
- FLOAT
|
Value
|
|
|
- BOOL
|
MSBfirst
|
| 0=Least significant byte first, 1=Most significant byte first
|
- VOID
|
Return
|
SendByteArray
|
SendByteArray
|
| Transmits an array of bytes via the UART peripheral
|
- BYTE
|
Data
|
| Data to transmit
|
- UINT
|
NumBytes
|
| Number of bytes to send from the array
|
- VOID
|
Return
|
SendChar
|
SendChar
|
| Sends out a single packet from the UART interface.
|
- INT
|
Char
|
|
|
- VOID
|
Return
|
SendFloat
|
SendFloat
|
| Sends out a floating point number as an ASCII String from the UART interface.
|
- FLOAT
|
Number
|
|
|
- VOID
|
Return
|
SendHexNumber
|
SendHexNumber
|
| Sends out a number as an ASCII hexadecimal String from the UART interface.
|
- ULONG
|
Number
|
|
|
- BYTE
|
NumChars
|
| Number of characters in the string data, 0 for auto, 2 for 0x00, 4 for 0x0000
|
- BOOL
|
Prefix
|
| Generate hexadecimal prefix 0x e.g. 1= 0xFF, 0= FF
|
- VOID
|
Return
|
SendINTArray
|
SendINTArray
|
| Transmits an array of 16-bit INT/UINT values via the UART peripheral
|
- UINT
|
Data
|
| Data to transmit
|
- UINT
|
NumValues
|
| Number of 16-bit values to send from the array
|
- BOOL
|
MSBfirst
|
| 0=Least significant byte first, 1=Most significant byte first
|
- VOID
|
Return
|
SendNumber
|
SendNumber
|
| Sends out a number as an ASCII String from the UART interface.
|
- LONG
|
Number
|
|
|
- VOID
|
Return
|
SendString
|
SendString
|
| Sends out a string of bytes from the UART interface.
|
- STRING
|
Data
|
|
|
- VOID
|
Return
|
Property reference
|
Properties
|
|
Comms Settings
|
|
Channel
|
| UART Channel selector Software channels are bit banged using generic I/O pins but are not as reliable as hardware channels. Hardware channels use the selected peripheral on-board the target microcontroller.
|
|
Baud Rate
|
|
|
|
Connections
|
|
TX
|
| Pin to be used for Transmit data
|
|
RX
|
| Pin to be used for Receive data
|
|
Simulation
|
|
Label
|
| Textual label shown on the component I/O flasher
|
|
Scope Traces
|
| Selects if the scope traces are automatically added to the data recorder window or not. Simulation - draws an approximation of the UART data onto the scope trace. ICT - sets up the scope trace for incoming data and adds UART packet decoding at the correct BAUD.
|
|
Console Data
|
| Selects if the console data is automatically generated or not
|
|
Console Format
|
| Controls if the data is shown as a log with time and date stamps or just as raw data
|
|
Console Columns
|
| Number of characters that can be displayed on a single line of the console.
|
|
Data Source
|
| Simulation data source used to allow the component to connect to various remote devices Nothing - Simulation data is ignored COM port - Routes the communication data to and from a physical or virtual COM port API - Routes the communication data via a data API component on the Panel.
|
Component Source Code
Please click here to download the component source project: FC_Comp_Source_EB3_USB_COM.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_EB3_USB_COM.fcfx