How to Send "Raw" ASCII Data Using the "Free Protocol" Driver

Introduction:

The instructions below demonstrate how to read-in or write-out “raw” ASCII data using the “Free Protocol” driver.

Software Version:

EasyBuilder Pro 6.03.02.393+

Related Tutorials:

Video - How to use Free Protocol to Control a Device
Video - Free Protocol Example - Read/Write data from Modbus Slave Device w/ Macro

Instructions:

Sending “raw” ASCII characters must be done with the HMI’s “Free Protocol” driver. The “Free Protocol” function “OUTPORT” will send data to a device, while “INPORT” can be used to read data that is returned.

  1. The target COM port is determined by the device “Name” configured in the “Device list”:
    Note: The name of the first “Free Protocol” device is “MT8073iE” which uses an RS232 interface. The second “Free Protocol” device, called "cMT3072XH, " has been set with an RS485 2W interface.

  2. When using the “INPORT” or “OUTPORT” function, you must reference the device’s name:
    Note: This macro will OUTPORT() the designated char array retrieved from LW-0 to both devices listed above using the specified COM ports.


  3. In this example, we OUTPORT an ASCII command that is predefined using quotations:
    Note: Each char element is 8 bits in size. It can be assigned a default value using quotations as in the example below or using curled brackets as in char cmd[5] = {0, 1, 2, 3, 4}.

Note: Functions such as INPORT and OUTPORT can be configured in the macro workspace’s API by selecting the “GET/SET FN…” button

Select the desired function from the “Function name” drop-down list. Function description, usage info, and an example can be found after selection:

Keywords

ascii, raw, read in, read-in, write out, write-out, free, free protocol, outport, inport, com, com port, macro, api, function