Input Interpreter Examples - GSE 60 SERIES Technical Reference Manual

Programmable process controllers
Table of Contents

Advertisement

8-46 Chapter 8
GSE Scale Systems
This can be useful for parsing fixed-width data that contains no delimiters,
because the maximum field width can be specified. For example,
"%5f%6f%<pa=VAR1>%<pa=VAR2>" will store the first 5 characters of
data in floating point format into VAR1, and the next six characters in
floating point format into VAR2.
An interesting but not very useful application is to override the format for
an unsigned long parameter with "%lx." This will interpret the incoming
data as hex! "%lo" will interpret it in octal!
Back to more worthwhile things now, an asterisk immediately following the
percent sign will cause a field to be scanned but not stored. So if you know
that there is a floating number in the incoming data that you want to
ignore, use "%*f" to skip over it, or to skip a single character use "%*c."
This is not meant to be a tutorial on the uses of the scan function. Many
resource books available go into much further depth. We have tried to
suggest some possible ways of using its characteristics to good
advantage.
I
I
NPUT
NTERPRETER
The following input interpreter example shows how the indicator can be
programmed to receive a tare followed by a units identifier. A macro, which
tests the transmitted units name and adjusts the data before storing it
away as the new tare value, is invoked. Refer to the next several pages for

input interpreter examples.

Example 1: Units identifier
File Name: TAREINP.SET
100%s23640%i%e Access Setup Modes, Allowing Changes
681%s1%e
VAR instance 1
682%sTare units%e P682.-- NAME1 Tare units
686%s12%e
P686.-- STR size=12
9990%s1%e
P9990 macro (instance 1)
10001%s%c%e
P10001 Macro table
80.1P==lb%%o%e compare
80.1P=2P%%o%e copy register
GOTlbtare!%%P%e pause
%%N%e
if not
80.1P==kg%%o%e compare
80.1P*=0.4535925%%o%e multiply
80.1P=2P%%o%e copy register
E
XAMPLES

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents