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

 

3

data.

 

 

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.

 

4

ƒ STX if you want to wait for a Start-of-Text character.

 

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).

 

5

ƒ Choose one of the other available options as appropriate

 

If you want to extract only part of the received data, check the

 

6

checkbox beside Extract from Received Data

 

To extract from the received data, indicate the From position and

 

 

the To position of the extraction by entering values or using the

 

7

arrows to increment or decrement the existing values.

 

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

 

8

executed.

 

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

 

11

and click OK.

 

In the If Error Goto box, select the action to perform or the

 

12

screen to go to if an error occurs.

 

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

www.mcl-collection.com

Copyright © 2007 • MCL Technologies • All Rights Reserved

 

 

Page 156
Image 156
Datamax v1.1x user manual Serial, Checkbox beside Extract from Received Data