Search
Start typing to search...

Using Serial Port in Aximmetry

Author:

Introduction

This document provides an overview of how to establish communication through Serial Ports.
A Serial Port is a physical interface used for transferring data between a computer and an external device, transmitting data one bit at a time.
If your computer doesn't have a Serial Port, then you can use a USB-to-serial adapter to add a Serial Port to your computer. Some serial port devices already come with the physical USB interface, once the USB is connected to the Windows computer, these devices will be detected as Serial Ports (COM).
NOTE: Aximmetry has implementations of various protocols that use Serial Ports. For example, if you want to receive or send MIDI protocol you should look up the Using MIDI with Aximmetry documentation instead of using the module in this documentation.

Setup in Windows

Once the device is connected to the computer, it should appear in the Windows Control Panel's Device Manager.
In the Device Manager, you can read the COM port number of the device. For example, in the screenshot below, a COM3 device is listed where '3' represents the port:

If Windows doesn't automatically detect the device, you can attempt to find it by scanning for hardware changes using this button:

Serial Client Module

The Serial Client module is designed to establish a connection with a Serial Port, enabling the sending and receiving of data to and from the connected device.
For easy debugging when setting up your device, we recommend exposing Serial Client as a video with the Text Peeker module:

Pins:

  • Open

    By turning Open to On, the module starts listening for incoming Serial Client data.

  • Port

    The ID of the port. For example, if your device is registered on COM13, then you have to give 13 as the Port.

  • Baud rate

    Determines the speed of communication in bits per second.

  • Parity

    Parity is a method of detecting errors in transmission. The parity bit in each character can be set to one of the following:

    • No (0) means that no parity bit is sent and the transmission is shortened.
    • Odd (1) means that the parity bit is set so that the number of 1 bits is odd.
    • Even (2) means that the parity bit is set so that the number of 1 bits is even.
    • Mark (3) parity means that the parity bit is always set to the mark signal condition (1-bit value).
    • Space (4) parity always sends the parity bit in the space signal condition (0-bit value).

    Change it only when your device specifies it.

  • Stop bits

    Stop bits sent at the end of every character. This allows the receiving signal hardware to detect a character's end and resynchronize with the character stream.
    Change it only when your device specifies it.

  • Binary Mode

    Switches between sending text or byte (binary) data.
  • Terminator and Terminator Bytes

    Terminator indicates the end of a series of bytes or text that constitute a message. Based on this terminator, Aximmetry parses the incoming data and adds this to the end of outgoing data.
    Change it only when your device specifies it.

  • Data and Data Bytes

    The text or bytes of the message that will be sent to the serial port. Use the Binary Mode pin to switch between sending text or byte data.

  • Auto Send and Send

    The sending of the data can be performed in two ways. You can send it at a specific time by triggering it via the Send pin. Alternatively, you can turn On Auto Send, in this case, each time the Data value is changed it is sent automatically.

  • Received and Received Bytes

    The data that is received through the serial port. To use Byte data instead of Text, turn on the Binary Mode pin.
    When sending data, the pin will display the sent data starting with the ">" character, until no data is received.
    NOTE: If the ">" character persists for more than a second, then the device most likely didn't send a response. This is an important consideration when using the Serial Client to issue commands to a device that typically returns a confirmation response, as it may indicate that the sent command was incorrect.

    If you receive more than one message under a frame, then the message is put into a queue and the queue will be played out one by one in the following frames.

    When receiving byte data, these modules can convert the data: Bytes To Text, Bytes To Scalar, Bytes To Vector, and Bytes To Integer.

Structuring Complex Data

When using complex data, you can put the data into a Collection pin data type and convert them to text using a Collection To XML or Collection To JSON module. You can then connect the text to the Data pin of the Serial Client module. When receiving such data, you can parse it into a collection using the JSON Text or XML Text module.

Article content

Loading
Close
Loading spinner icon
1/10