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 Gateway.

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.

This driver is only available for the Windows-based Tulip Player and is disabled by default. To have this driver made available on your Tulip account, reach out to your Account Representative.

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
  • 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:

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").

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 this answer your question?