A guide to using the Serial Driver
This article describes the capabilities and configuration associated with the Serial driver in Tulip.
Note that this driver differs from the Generic Serial Driver that is currently only available for the Tulip I/O Gateway and Edge IO.
The Serial driver allows Tulip Apps to connect to Serial devices and send and receive messages. This includes all types of USB-Serial devices, serial devices connected via a USB-to-Serial adapter, and serial devices connected using a Virtual Serial (COM) Port. These devices can include Zebra printers, mettler Toldeo scales, and many more.
This driver is only available for the Windows-based Tulip Player and is enabled by default.
The driver supports the following functions:
List Ports - To list the available Serial (COM) ports
Connect - To connect to a Serial port to send and receive messages
Connect with Options - Advanced options for the serial connection such as flow control, parity, data bits and stop bits.
Available since release r252 and requires Desktop Player version 2.2 or higher.
Send - To send a message to a connected device
Disconnect - To disconnect from a connected device
These functions are exposed in the Tulip App Editor as a "Device Function" as shown below:
Connect with Options
All three functions require an "identifier" to be passed as a parameter. This identifier uniquely identifies a connection within the Tulip App and can be used to maintain multiple connections simultaneously.
The other parameters for the Connect function are described below:
- Path - The COM path of the device to which you would like to connect.
- Baud Rate - The baud rate of the device to which you would like to connect. This is typically provided in your device's documentation. If your device has an auto-configuring baud rate, this value will be ignored.
- Message Delimiter - A delimiting string that separates incoming messages. Every time the message delimiter is received from your device, all data received since the last message delimiter will be sent to your App via the Message event. This is commonly a newline ("\n") or a carriage return with a newline ("\r\n").
- Message Terminator - A string that will be sent after each Send function in order to indicate that the message is terminated. This is commonly a newline ("\n") or a carriage return with a newline ("\r\n").
The “Connect with options” trigger action is available from release r252 and requires Windows Desktop Player 2.2 or higher.
The additional options support the following values:
|Option||Allowed Values||Commonly Used Values|
|Data Bits||5, 6, 7, 8||8|
|Stop Bits||1, 1.5, 2||1|
|Parity||none, even, odd, mark, space||none|
|Flow Control||none, rts-cts, xon-xoff||none|
The driver emits two kinds of Events: a "Message" event indicating that a connection has sent a message and an "Error" event that indicates that something has errored within the driver or connection.
No configuration is necessary outside of the Tulip App logic required to connect to a device. While in the above examples we show static values being used for the connection details, it is common to pull these values from variables or Tulip Table records in order to allow for central management of these values.
Did you find what you were looking for?
You can also head to community.tulip.co to post your question or see if others have faced a similar question!