Thursday, August 27, 2015

General purpose drivers

The HMI has two new drivers.

The first driver is a general purpose serial port driver.
The second driver is a general purpose TCP/IP driver.

A general purpose driver does not implement a protocol. For example: MODBUS RTU or MODBUS TCP/IP. The driver provides direct access to the “port” and the raw data received/transmitted.

To utilize the driver, scripting is used. Both drivers provide two methods to control the “port”.

Method one: Callback

This method provides a script executed by the driver, is self-contained and provides “callbacks” to handle the port. For example a callback would occur when a byte(s) is received (OnRxChar), the port is opened (OnOpen), etc..

Method two: Polling

This method is executed in a normal script and controls the port via script commands. Callbacks do not occur and port control can be in one or more regular scripts.

Included with the release are four example projects. All example projects read one word of data from a MODBUS slave/server. The examples include a “callback” and “polling” method example for both the serial and TCP/IP port types.