Jump to content

Component: Serial Monitor (Runtime Tools)

From Flowcode Help
Revision as of 16:24, 7 January 2022 by Wiki bot (talk | contribs) (Created page with "{| style="width:50%" |- | width="20%" style="color:gray;" | Author | Matrix Ltd |- | width="20%" style="color:gray;" | Version | 1.0 |- | width="20%" style="color:gray...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Author Matrix Ltd
Version 1.0
Category Runtime Tools


Serial Monitor component

Allows data from a COM port to be piped through to the console window for easy program status and debugging.

Component Pack

FREE

Detailed description

No detailed description exists yet for this component

Examples

Here is a simple example showing how to pass data from a device such as an Arduino back into Flowcode for debugging purposes. The example is designed to run on an Arduino Uno R3 with an LED connected to pin D2 and a potentiometer connected to pin A0. The program loops switching the LED on and off and reporting the status to the console, the ADC is also sampled as a voltage string and this is also passed back to the console.

Serial Monitor Demo

The incoming data can be seen on the Flowcode console even when the simulation is not running.

Outgoing data can be sent back to the embedded hardware by typing data directly into the RX Queue tab of the console.

Downloadable macro reference

ReceiveByte
Attempts to receive a byte using the COM port No valid return data is provided by the return value 256. 0 - 255 indicates valid data.  
- BYTE Timeout
 
- UINT 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


GetConsoleHandle
Gets the handle to the console allowing data displaying on the panel etc. 
- HANDLE 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


GetProp
Allows the property filter for the COM port list to be copied to a parent component. 
- STRING PropName
 
- STRING Return



Property reference

Properties
COM Port
Selects which port to communicate with, only lists ports which are currently available.  
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. 
Baud
Baud rate passed to the COM port to control the rate of data. 
Connection Type
Decides how to work with the COM port. Manual - Port needs to be manually opened and closed by the user. Port may become locked if left open. Port is automatically closed when programming. Automatic - Port handling is automatic but port may be left open when closing the project. Port is automatically closed when programming and reopened after 20 seconds. 
Connection
Port connection status. Closed - Port is unavailable and not in use. Open - Port is available for data communications. 
Connections
Simulations