Skip to content

Custom serial devices

Wotever edited this page Dec 14, 2023 · 2 revisions

Introduction

Custom serial devices plugin allows you to drive any serial device by defining it's protocol.

Enabling the plugin

The plugin is not enabled by default, to enable it go into settings/plugins :

The plugin will now appear on the left menu :

Configuration

Serial port settings

Define your port characteristics

  • Serial port : the serial port to be used
  • Baudrate : the baudrate to be used
  • Enable RTS : Enable the "Ready to send" line
  • Enable DTR : Enable the "Data Terminal Ready" line
  • Log incoming data : data sent to the computer is logged in a windows, otherwise it's simply thrown away, this is useful for debugging purpose
  • Automatic reconnect : In case of serial port error (disconnect ...) Simhub will automatically try to reconnect to the device at a regular interval.

Protocol definition

All protocol messages are dynamically built using NCALC or Javascript. The plugin does not send any predefined messages start or terminator characters. You need to add them to you messages.

Message after device connect

Allows you to define a "hello" message. This message will be sent straight after serial port is open.

Message before device disconnect

Allows you to define a "goodbye" message. This message will be sent straight before serial port is closed. NB : In case of serial port error (disconnect, connection loss) it won't be sent.

Update messages

Messages sent to communicate with the device. You can have multiple messages with multiple frequencies. As a general rule of thumb empty messages won't be sent. Messages are encoded in ASCII

  1. Enable switch : When disabled the message will be ignored
  2. Message formula
  3. Update frequency : Define the maximum frequency at which the message must be sent, if you only want to send value changes , you can select Changes only. Free SimHub version is limited to 10Hz.

Import/export freeze settings

You can import and export settings for easy sharing.

Settings freezing allows you to put the device settings in readonly mode. Only the serial port and the setting panel will stay active.

Setting panel

Allows you to build a device control panel. All properties created with the settings panel will be available for use from ncalc or javascript using "insert setting" :

Tips

  • Sending a simple string using ncalc formula
'Hello'
  • Ending a message with line feed
'Hello\n' 
Clone this wiki locally