Using the Serial Driver
  • 08 Nov 2023
  • 3 Minutes to read
  • Contributors

Using the Serial Driver


Article summary

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.

Capabilities

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.

Functions

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:

List Ports

Connect

Connect with Options
Serial Driver Connect with Options

Send

Disconnect

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:

OptionAllowed ValuesCommonly Used Values
Data Bits5, 6, 7, 88
Stop Bits1, 1.5, 21
Paritynone, even, odd, mark, spacenone
Flow Controlnone, rts-cts, xon-xoffnone

Events

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.

Configuration

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!


Was this article helpful?