Component: COM Port (Runtime Tools)

From Flowcode Help
Jump to navigationJump to search
Author Matrix Ltd
Version 3.0
Category Runtime Tools


COM Port component

Serial based simulation component for use with systems such as RS232, Bluetooth and USB Serial.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_COM_Port.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_COM_Port.fcfx

Detailed description

No detailed description exists yet for this component

Examples

Auto Detect Port Number

This example auto detects and opens a COM Port based on preassigned USB Identifiers VID/PID.

For a known device the VID and PID can be found via Windows device manager.

FC6 Icon.png Auto Detect Example







Macro reference

ClosePort

Fc9-comp-macro.png ClosePort
Closes the currently open COM port, ending communications and allowing it to be accessed via another application. 
Fc9-void-icon.png - VOID Return


ConfigureConsole

Fc9-comp-macro.png ConfigureConsole
 
Fc9-u8-icon.png - BYTE Status
 
Fc9-void-icon.png - VOID Return


GetConsoleHandle

Fc9-comp-macro.png GetConsoleHandle
Gets the handle to the console allowing data displaying on the panel etc. 
Fc9-h32-icon.png - HANDLE Return


GetProp

Fc9-comp-macro.png GetProp
Allows the property filter for the COM port list to be copied to a parent component. 
Fc9-string-icon.png - STRING PropName
 
Fc9-string-icon.png - STRING Return


OpenPort

Fc9-comp-macro.png OpenPort
Opens the currently selected COM port, allowing data to be sent and received. 
Fc9-void-icon.png - VOID Return


ReceiveBinary16Bit

Fc9-comp-macro.png ReceiveBinary16Bit
Receives a binary 16-bit value split across two bytes. 
Fc9-bool-icon.png - BOOL MSBfirst
0=Least significant byte first, 1=Most significant byte first 
Fc9-u8-icon.png - BYTE Timeout
Max amount of time in ms to wait between bytes 
Fc9-u16-icon.png - UINT Return


ReceiveBinary32Bit

Fc9-comp-macro.png ReceiveBinary32Bit
Receives a binary 32-bit value split across four bytes. 
Fc9-bool-icon.png - BOOL MSBfirst
0=Least significant byte first, 1=Most significant byte first 
Fc9-u8-icon.png - BYTE Timeout
Max amount of time in ms to wait between bytes 
Fc9-u32-icon.png - ULONG Return


ReceiveBinaryFloat

Fc9-comp-macro.png ReceiveBinaryFloat
Receives a binary 32-bit floating point value split across four bytes. 
Fc9-bool-icon.png - BOOL MSBfirst
0=Least significant byte first, 1=Most significant byte first 
Fc9-u8-icon.png - BYTE Timeout
Max amount of time in ms to wait between bytes 
Fc9-f32-icon.png - FLOAT Return


ReceiveByte

Fc9-comp-macro.png ReceiveByte
Attempts to receive a byte using the COM port No valid return data is provided by the timeout value property. 
Fc9-u16-icon.png - UINT Timeout
Time to wait for incoming data in milliseconds 
Fc9-u16-icon.png - UINT Return


ReceiveByteArray

Fc9-comp-macro.png ReceiveByteArray
Attempts to receive an array of bytes using the COM port Returns the number of bytes received.  
Fc9-u8-icon.png - BYTE Data
 
Fc9-u16-icon.png - UINT MaxLength
Max number of bytes to try and read 
Fc9-u16-icon.png - UINT Timeout
Time to wait for incoming data in milliseconds 
Fc9-u16-icon.png - UINT Return


ReceiveFloat

Fc9-comp-macro.png 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. 
Fc9-u8-icon.png - BYTE Timeout
Max time in ms to wait in between bytes 
Fc9-bool-icon.png - BOOL IgnoreData
0=Dont ignore any data, 1=Ignore any initial none numeric data 
Fc9-f32-icon.png - FLOAT Return


ReceiveHexNumber

Fc9-comp-macro.png 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. 
Fc9-u8-icon.png - BYTE Timeout
Max time in ms to wait in between bytes 
Fc9-bool-icon.png - BOOL IgnoreData
0=Dont ignore any data, 1=Ignore any initial none numeric data 
Fc9-bool-icon.png - BOOL Prefix
Look for prefix before receiving, 1=0xFF, 0=FF 
Fc9-u32-icon.png - ULONG Return


ReceiveINTArray

Fc9-comp-macro.png ReceiveINTArray
Receives an array of 16-bit INT/UINT values and returns the number of values received. 
Fc9-u16-icon.png - UINT Data
Array to store the incoming data 
Fc9-u8-icon.png - BYTE NumValues
Maximum number of values to try and receive 
Fc9-bool-icon.png - BOOL MSBfirst
0=Least significant byte first, 1=Most significant byte first 
Fc9-u8-icon.png - BYTE Timeout
Max amount of time in ms to wait between bytes 
Fc9-u8-icon.png - BYTE Return


ReceiveNumber

Fc9-comp-macro.png 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. 
Fc9-u8-icon.png - BYTE Timeout
Max time in ms to wait in between bytes 
Fc9-bool-icon.png - BOOL IgnoreData
0=Dont ignore any data, 1=Ignore any initial none numeric data 
Fc9-s32-icon.png - LONG Return


ReceiveString

Fc9-comp-macro.png ReceiveString
Attempts to receive an string using the COM port Returns the number of bytes received.  
Fc9-u16-icon.png - UINT Timeout
Time to wait for incoming data in milliseconds 
Fc9-u16-icon.png - UINT MaxLength
Max number of bytes to try and read 
Fc9-string-icon.png - STRING Return


ScanForDeviceID

Fc9-comp-macro.png ScanForDeviceID
Checks to see if a device VID/PID string is present and returns the COM port number. Returns 0 if device not found. 
Fc9-string-icon.png - STRING HWID
Example: "VID_12BF&PID_0101" 
Fc9-u8-icon.png - BYTE Return


SendBinary16Bit

Fc9-comp-macro.png SendBinary16Bit
Sends out a 16-bit binary value split across two bytes. 
Fc9-u16-icon.png - UINT Value
 
Fc9-bool-icon.png - BOOL MSBfirst
0=Least significant byte first, 1=Most significant byte first 
Fc9-void-icon.png - VOID Return


SendBinary32Bit

Fc9-comp-macro.png SendBinary32Bit
Sends out a 32-bit binary value split across four bytes. 
Fc9-u32-icon.png - ULONG Value
 
Fc9-bool-icon.png - BOOL MSBfirst
0=Least significant byte first, 1=Most significant byte first 
Fc9-void-icon.png - VOID Return


SendBinaryFloat

Fc9-comp-macro.png SendBinaryFloat
Sends out a 32-bit binary floating point value split across four bytes. 
Fc9-f32-icon.png - FLOAT Value
 
Fc9-bool-icon.png - BOOL MSBfirst
0=Least significant byte first, 1=Most significant byte first 
Fc9-void-icon.png - VOID Return


SendByte

Fc9-comp-macro.png SendByte
Sends a single byte to be sent out via the COM port. 
Fc9-u8-icon.png - BYTE Data
 
Fc9-void-icon.png - VOID Return


SendByteArray

Fc9-comp-macro.png SendByteArray
Sends an array of bytes to the COM port. 
Fc9-u8-icon.png - BYTE Data
Data byte array to send 
Fc9-u16-icon.png - UINT Length
Number of bytes to send 
Fc9-void-icon.png - VOID Return


SendFloat

Fc9-comp-macro.png SendFloat
Sends out a floating point number as an ASCII String from the UART interface. 
Fc9-f32-icon.png - FLOAT Number
 
Fc9-void-icon.png - VOID Return


SendHexNumber

Fc9-comp-macro.png SendHexNumber
Sends out a number as an ASCII hexadecimal String from the UART interface. 
Fc9-u32-icon.png - ULONG Number
 
Fc9-u8-icon.png - BYTE NumChars
Number of characters in the string data, 0 for auto, 2 for 0x00, 4 for 0x0000 
Fc9-bool-icon.png - BOOL Prefix
Generate hexadecimal prefix 0x e.g. 1= 0xFF, 0= FF 
Fc9-void-icon.png - VOID Return


SendINTArray

Fc9-comp-macro.png SendINTArray
Transmits an array of 16-bit INT/UINT values via the UART peripheral 
Fc9-u16-icon.png - UINT Data
Data to transmit 
Fc9-u8-icon.png - BYTE NumValues
Number of 16-bit values to send from the array 
Fc9-bool-icon.png - BOOL MSBfirst
0=Least significant byte first, 1=Most significant byte first 
Fc9-void-icon.png - VOID Return


SendNumber

Fc9-comp-macro.png SendNumber
Sends out a number as an ASCII String from the UART interface. 
Fc9-s32-icon.png - LONG Number
 
Fc9-void-icon.png - VOID Return


SendString

Fc9-comp-macro.png SendString
Sends an string of characters to the COM port. 
Fc9-string-icon.png - STRING Data
Data byte array to send 
Fc9-void-icon.png - VOID Return


SetDTRState

Fc9-comp-macro.png SetDTRState
Allows the DTR signal to be enabled or disabled. 
Fc9-u8-icon.png - BYTE State
A value of 0 disables the DTR, 1 or above willl enable the DTR. 
Fc9-void-icon.png - VOID Return


SetFlowControl

Fc9-comp-macro.png SetFlowControl
Allows the Flowcontrol signals to be enabled or disabled. 
Fc9-u8-icon.png - BYTE State
A value of 0 disables flow control, 1 or above willl enable flow control. 
Fc9-void-icon.png - VOID Return


SetProp

Fc9-comp-macro.png SetProp
Allows the COM port property to be set from a parent component. 
Fc9-string-icon.png - STRING PropName
 
Fc9-u32-icon.png - ULONG PropVal
 
Fc9-void-icon.png - VOID Return


Property reference

Fc9-prop-icon.png Properties
Fc9-type-16-icon.png COM Port
Selects which port to communicate with, only lists ports which are currently available.  
Fc9-type-7-icon.png Refresh COM Ports
When set to yes the COM port list is rescanned for newly connected or available ports. Note that refreshing the ports list may take a few seconds depending on the number of connected ports. 
Fc9-type-14-icon.png Baud
Baud rate passed to the COM port to control the rate of data. 
Fc9-type-14-icon.png Timeout Value
Value to specify what is returned when no incoming receive data is present. 
Fc9-type-7-icon.png Console Data
 
Fc9-type-7-icon.png Auto Close
Auto close the port on Sim stop event 
Fc9-type-16-icon.png New Line Format