Difference between revisions of "Component: COM Port (Runtime Tools)"
From Flowcode Help
Jump to navigationJump to search| Line 20: | Line 20: | ||
| ==Detailed description== | ==Detailed description== | ||
| + | |||
| + | |||
| Line 38: | Line 40: | ||
| ==Examples== | ==Examples== | ||
| + | |||
| + | |||
Revision as of 14:39, 16 January 2023
| Author | Matrix Ltd | 
| Version | 3.0 | 
| Category | Runtime Tools | 
Contents
COM Port component
Serial based simulation component for use with systems such as RS232, Bluetooth and USB Serial.
Component Source Code
Please click here for the component source code: 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.
Downloadable macro reference
|   | ReceiveByte | 
| Attempts to receive a byte using the COM port No valid return data is provided by the timeout value property. | |
|  - UINT | Timeout | 
| Time to wait for incoming data in milliseconds | |
|  - UINT | Return | 
|   | ConfigureConsole | 
|  - BYTE | Status | 
|  - VOID | Return | 
|   | SendString | 
| Sends an string of characters to the COM port. | |
|  - STRING | Data | 
| Data byte array to send | |
|  - VOID | Return | 
|   | 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 | 
|   | SendNumber | 
| Sends out a number as an ASCII String from the UART interface. | |
|  - LONG | Number | 
|  - VOID | Return | 
|   | ClosePort | 
| Closes the currently open COM port, ending communications and allowing it to be accessed via another application. | |
|  - VOID | Return | 
|   | SendByte | 
| Sends a single byte to be sent out via the COM port. | |
|  - BYTE | Data | 
|  - VOID | Return | 
|   | SetDTRState | 
| Allows the DTR signal to be enabled or disabled. | |
|  - BYTE | State | 
| A value of 0 disables the DTR, 1 or above willl enable the DTR. | |
|  - VOID | Return | 
|   | ScanForDeviceID | 
| Checks to see if a device VID/PID string is present and returns the COM port number. Returns 0 if device not found. | |
|  - STRING | HWID | 
| Example: "VID_12BF&PID_0101" | |
|  - BYTE | Return | 
|   | GetConsoleHandle | 
| Gets the handle to the console allowing data displaying on the panel etc. | |
|  - HANDLE | Return | 
|   | SendByteArray | 
| Sends an array of bytes to the COM port. | |
|  - BYTE | Data | 
| Data byte array to send | |
|  - UINT | Length | 
| Number of bytes to send | |
|  - VOID | Return | 
|   | SendFloat | 
| Sends out a floating point number as an ASCII String from the UART interface. | |
|  - FLOAT | Number | 
|  - VOID | Return | 
|   | SetFlowControl | 
| Allows the Flowcontrol signals to be enabled or disabled. | |
|  - BYTE | State | 
| A value of 0 disables flow control, 1 or above willl enable flow control. | |
|  - VOID | Return | 
|   | OpenPort | 
| Opens the currently selected COM port, allowing data to be sent and received. | |
|  - VOID | Return | 
|   | SetProp | 
| Allows the COM port property to be set from a parent component. | |
|  - STRING | PropName | 
|  - ULONG | PropVal | 
|  - VOID | Return | 
|   | 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 | 
| 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 | 
|   | GetProp | 
| Allows the property filter for the COM port list to be copied to a parent component. | |
|  - STRING | PropName | 
|  - STRING | Return | 





