Copyright © 2007 • MCL Technologies • All Rights Reserved
www.mcl-collection.com
Chapter 5 : Using Processes
5.7.1. Serial In
General introduction The Serial In process allows you to create an input process that waits
for data coming in from an auxiliary device.
The format of the expected data is defined here, and a time out can be
setup to avoid an indefinite wait for the input.
Serial In To receive data from an auxiliary port, proceed as follows:
1 Add the process Serial In to your label program
2 Select the Communication Port that this process will use to receive
data.
3 In the Start with box, click the appropriate start character to
beginning receiving:
None if you do not want to wait for a special start character.
STX if you want to wait for a Start-of-Text character.
4 In the End with box, click the appropriate stop character to signal
the end of the incoming data stream:
ETX if you want an End-of-Text character as the stop
character.
CR if you want a Carriage Return as the stop character.
Number of char if you want to stop receiving after a certain
number of characters has been received. In the associated
box, type a number or use the arrows to indicate the number
of characters to be received from the auxiliary device (after
the ‘Start with’ character has been received).
Choose one of the other available options as appropriate
5 If you want to extract only part of the received data, check the
checkbox beside Extract from Received Data
6 To extract from the received data, indicate the From position and
the To position of the extraction by entering values or using the
arrows to increment or decrement the existing values.
7 In the Timeout box, set the time-out value to be used (in seconds).
This option sets up a time-out duration for this process. When a
time-out occurs, the If Error Goto branch of the process is
executed.
8 Identify the Result Variable in which the received data or
extracted data should be saved.
9 Click to open the Variables dialogue box.
10 Select or create the variable to be used to save the received data
and click OK.
11 In the If Error Goto box, select the action to perform or the
screen to go to if an error occurs.
12 Click OK
Example This example waits for incoming data on serial com port 1. When a
start-of-text character is received, the process will wait until 10
characters have been received. When the 10 characters have been
placed in the input buffer, the serial port is closed and the data is
passed to the application. Any additional characters are discarded.
The data found in positions 5-9 of the received data are extracted and
saved in the variable [D9] Weight.
If a time-out occurs while receiving data, the application goes to screen
12 to display a communications error message.
October 2007 Page
156