beautypg.com

Config com – Remote Processing CAMBASIC User Manual

Page 179

background image

CON FIG C ommands - 6

CONFIG COM$

Tasking Statement

SYNTAX:

CON FIG C OM$ n,terminator, length,XON ,echo

PURPOSE:

To config ure a co mmu nication por t to interr upt when th e progr amm ed conditions a re m et.

REMARK S:

The CO NFIG COM $ statement is used in conjunction with the ON COM $ statement so that the
foreground program is interrupted when either a specific message length has been received or a
specified termination character has been received.

n = legal serial port number.

The terminator is equal to the termination character of the incoming string. This is normally a
carr iage retur n (13) but it ma y be any cha racter from 1 to 127. If you specify 0 , C AM BASIC will
not test for a terminator.

In some cases there is no termination character. The length of the message is always the same. In
this case the length parame ter should be set to the messag e length. T he range is 1 to 127 char acters.
If you specify “0” , C AMBASIC will not check for length.

The XON parameter enables or disables XO N/X OFF protocol checking by the serial port. Setting
this param eter to ” 1” e nables the pr otocol, and setting it to “ 0” d isables the pr otocol.

The echo param eter dete rmine s when the in coming c haracte rs are to be echoed . W hen a “ 1” is
specified, the characters are echoed. Characters ar e not echoed when the parameter is “ 0”.

See the Multitasking Chapters for more inform ation.

RPC-2350 NOTE: The CAM BASIC statement BIT 128,4, 0 may need to be executed before you
will receive any characters. This command enables the CTS line to the sender.

RELATED:

O N C OM $ , C OM $

EXAMPLE:

10 CONFIG COM$ 2,13,0,0,0

This exam ple configur es CO M2 so tha t the term inator is a ca rriag e retur n. T here is no length
checking, XO N/X OFF protocol and no character echo.

ERROR:

<

Data negative

>

– for n,terminator, length,XON ,echo

<

Data out of range

>

– if n i s n o t 1 , 2 or 3 ; terminator or length > 1 2 7;

XON or echo > 1