RS232 Interface E v2xx

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

RS232 Interface

For hand-held gages and multiplexers

Version: 2 / September 2007


Doc-No.: E-PD 22 E

© Copyright 2007

Q-DAS® GmbH & Co. KG Q-DAS® Incorporated


Eisleber Str. 2 2582 Product Drive
D - 69469 Weinheim Rochester Hills
Germany MI 48309, USA

Phone: ++49/6201/3941-0 Phone: ++1/248 299 4910


Fax: ++49/6201/3941-24 Fax: ++1/248 299 4913
E-Mail: q-das@q-das.de E-Mail : q-das@q-das.com
Internet: http://www.q-das.de Internet: http://www.q-das.com

Hotline: Hotline:
Phone: ++49/6201/3941-14 Toll free: ++1/888 412 7327
Fax: ++49/6201/3941-24 Fax: ++1/248 299 4913
E-Mail: hotline@q-das.de E-Mail: hotline@q-das.com
2 RS232 Interface
Table of Contents 3

Table of Contents
Table of Contents ................................................................................... 3
1 Import DLL files ................................................................................ 5
1.1 Implementation of Import DLL files into qs-STAT / procella...... 5
2 Communication flow between procella / qs-STAT
and measurement device for the standard DLL (IMP_000.DLL) ... 6
2.1 Initialization of the device.......................................................... 6
2.2 Receiving the measurement values .......................................... 7
3 Types of measurement devices ...................................................... 8
4 Operating modes of the measurement devices ............................. 8
5 Command syntax in the RS232DEF.INI file .................................... 9
5.1 Commands in the RS232DEF.INI ........................................... 10
6 Decoding of the received data by the IMP_000.DLL.................... 15
6.1 Individual measurement value transfer ................................... 15
6.2 Transfer of multiple parameters in blocks ............................... 17
7 Control of the selection menu in the Characteristics Mask ....... 18
8 Trouble shooting ............................................................................ 18
4 RS232 Interface
Import DLL files 5

1 Import DLL files


1.1 Implementation of Import DLL files into
qs-STAT / procella

IMP_000.DLL Devices that send data as ASCII-signs


IMP_STW32.DLL Steinwald-Multiplexer box
IMP_ORBI.DLL Solartron Orbit System
IMP_IBRDDK.DLL Devices by the company IBRIT (via drivers of
company IBRIT / DDK)
IMP_001.DLL Simulation of measurement values for test
purposes
IMP_SMAO.DLL Devices by the company Marposs via their
driver
IMP_ROTX.DLL
IMP_.... On request / for special implementations

qs-STAT / procella

IMP_-Commands Measured values in transmit structure

IMP_XXX.DLL

Initialization, Measured values


Requirements for
measured values, etc.

external interface
e.g. RS232
6 RS232 Interface

2 Communication flow between procella /


qs-STAT and measurement device for the
standard DLL (IMP_000.DLL)

2.1 Initialization of the device

RS232 device

One-time
device INITSTR
initialization

DEINICH

Characteristic
switch /
Channel selection
INICH

All
configured
channels
initialized?

Start
of the
measurement
Communication flow between procella / qs-STAT and measurement 7
device for the standard DLL (IMP_000.DLL)

2.2 Receiving the measurement values

Request
REQSTR
by software
x

Measured value

Measured
value

Confirmation? REQACK

Wait for the next


measured value or
software request by
the user
8 RS232 Interface

3 Types of measurement devices


Type Connection Purpose
Hand-held Direct connection Measuring
measurement to RS232
device
Multiplexer Multiple channels Bundle different measurement
via one RS232 devices from various
connection manufacturers, hand-held
gages, probes, ...
Complex devices Measuring and pre-processing
of different values, protocol
formats

4 Operating modes of the measurement


devices
1. Activation at the measurement device (Load-button)

2. Activation via foot switch / external trigger

3. Activation by the software (space bar, formally also “Return” key)

4. Automatic sending of the data by the device after completion of the


measurement

REMARK: Not every measurement device / multiplexer supports all


operating modes listed above.
Command syntax in the RS232DEF.INI file 9

5 Command syntax in the RS232DEF.INI file


Generally, all necessary commands and parameters are entered as
strings inside the INI-file. In addition to this, it is possible to add control
characters or internal variables into the strings. These commands are
introduced by a ‘\’ symbol as a prefix.

1. \d
Control character, followed by 3-digit ASCII code for the desired
control character.
Example: \d013 adds a carriage return <CR> at the specified
position

2. \k
Channel number, additional parameters: Fill up characters,
alignment, and number of digits.
Example: \k2r0 adds the channel number at the specified
position, (formatted with 2 digits, right alignment, with
“0” as the fill up character if required).
Parameters following “k”:
1. Parameter: Number of digits in the channel string.
The entry will be formatted to x digits
according to this.
2. Parameter: alignment “r” or “l” for right or left
alignment
3. Parameter: Fill up character “0” or “_”
\k00A, \k00a : Channel number will be sent as capital
letter (channel 1 = A, channel 2 = B...).

3. *
Wildcard (only for responses from the gage, not commands sent)

4. \L<conductor wire><level><time>
The \L command has to be located at the beginning of the string
always and cannot be used in combination with sending of character
strings! Switches the DTR or RTS conductor wires to 0 or 1 for a
certain period of time.
Example:
\LDTR0250: sets the DTR conductor to level 0 for 250 ms.
<conductor> DTR or RTS
<level> 0 = off , 1 = on
<time> time in ms, 3 digits
10 RS232 Interface

5.1 Commands in the RS232DEF.INI


Command Description Example
ID Number for the unique
identification of the
parameter set
NAME Long device name (40
character)
SHTTXT Short device name (20
characters)
LIB Name of the DLL used for LIB= IMP_000.DLL
recording/conversion
CONFIG Standard interface CONFIG=
parameters (e.g. COM2,9600,N,8,1,02F8,0,0
(Baud 9600, no parity,
manufacturer’s settings)
8 data bits, 1 stop bit)

INITSTR String for one-time device INISTR=D\d013


initialization (sends the “D<CR>” string
as a one-time initialization
to the device)

INICH String for initialization of a INICH=E\k1r0\d013


channel (is sent in cases of (sends the “E1<CR>” string
during the switch to channel
a characteristic switch /
4 as initialization to the
channel switch, for device)
example)
INICHx Listing of all available
channel initializations
(x=consecutive number,
1 <= x <=9)
INICHBEZx Descriptions for the
associated INICHx
DEINICH String that is sent to the
previous channel during a
channel switch
REQSTR Software request string for a REQSTR=\k1r0\d013
reading of the measurement
device
REQSTRx Listing of all available
commands for software
requests (1 <= x <= 9)
REQBEZ Descriptions of the software
requests
Command syntax in the RS232DEF.INI file 11

Command Description Example


REQACK Confirmation string sent to
the measurement device
after receipt of a measured
value
VOLTAGE For devices that require VOLTAGE=yes
power supply through the (sets the logical levels of
the RTS conductor to 0 and
RS232 cable. Sets the
DTR to 1)
conductors RTS=0 and
DTR=1
WAITDATINIT Waiting time after calling up
a device set in ms
WAITDATAGET Waiting time for a measured
VALUE value after the
measurement value request
in ms
TEST Starts the transmission TEST=yes
protocol (protocol file: (turns on the protocol in
c:\qsterm.trc)
C:\QSTERM.TRC)
12 RS232 Interface

Decoding of characters (only for IMP_000.DLL)


Command Description Example

POS1 Start position of the measured


value inside the received
string
POS2 End position of the measured
value inside the received
string (if POS2=0 variable
Length of the measured value,
conversion takes place from
POS1 to the end)
CH1 Start position of the channel
ID within the received string
CH2 End position of a channel ID
within the received string
FAKECH If the data set does not contain FACKECH=3
a channel number, the channel (the 1st received data set is
number will be emulated up to given channel number “1”,
the number set with this the 2nd data set is given
command. The channel channel no. “2”, the 3rd
number is increased by 1 per channel no. “3”. When the
received data set. After the 4th data set is received, the
defined number is reached, channel number starts over
the process starts over again at “1”.)
with channel number “1”.
FAKECHSEP If the data set does not contain
a channel number, the channel
number will be emulated in a
consecutively increasing
manner per separator found in
the string. When the ENDCH or
the ENDSTR is found, the
channel number starts over
again with “1”.
ENDCH Last character in the ENDCH=13
measured value string which (<CR> indicates the end of
starts data decoding the string)
(= Trigger for the data
conversion)
ENDSTR Chain of characters in the ENDSTR=hello
measured value string which (when the “hello” character
starts data decoding chain is found, all
(= Trigger for data previously received data
conversion) will be decoded)
START Removes all characters in START=42
front of the defined sign from
the string (string starts at “”)
Command syntax in the RS232DEF.INI file 13

Decoding of characters (only for IMP_000.DLL)


Command Description Example
IGNORECHAR Number of characters that are IGNORECHAR=7
ignored at first when receiving (the first 7 characters of the
the string (compare START) sent string will be ignored)
SEP1 Separator in case multiple SEP1=32
parameters are sent in the (empty space as separator)
same string
CH_UEB1 Start position of trigger
recognition
CH_UEB2 End position of trigger
recognition
UEBERNSTR String for the trigger UEBERNSTR=F9
recognition (measured value will be recorded
if the “F9” string is output
between CH_UEB1 and
CH_UEB2. Otherwise, the value
will only be displayed in the bar
display)
FILTERSTR String for filtering of data FILTERSTR=Filter
blocks (measured value will be recorded
if the “Filter” string is output in the
data block. POS1=1 is the first
character after “Filter”.
WAITDATAPOR Waiting time after the interface
TOPEN was opened in ms
WAITDATAPOR Waiting time after the interface
TCLOSE was closed in ms
TEST Starts recording the transfer TEST=yes
protocol (protocol file: (transfer protocol in
C:\QSTERM.TRC) c:\qsterm.trc)
14 RS232 Interface

Only for Steinwald in IMP_STW32.DLL and Solartron in IMP_ORBI:DLL


Command Description Example

REQTIME Time interval for cyclic REQTIME=400


measurement value request in (every 400 ms a measured
ms value is requested from the
Steinwald-Box)
MUSTINI Determines whether and error MUSTINI=no
message is output if the (Steinwald-Box is not
device is not operational. initialized, e.g. for setup
mode)
KanalUebStrg Determines whether QS_STAT KanalUebStrg=yes
or the DLL controls the DLL is responsible for the
takeover channels control of the takeover
channels

Special commands

FUSSREQ Setting of the operation mode FUSSREQ=1


via foot switch (Activates the sequence
FUSSTASTSTR and
FUSSREQSTR for
measured value triggering)
FUSSTASTSTR String that is sent from the
device as a trigger in case the
foot switch is operated.
FUSSREQSTR String that is sent as a request
for measured values after the
FUSSTASTSTR (foot switch
trigger) has been received

Menu control

CH_START Lowest selectable channel


number
CH_END Highest selectable channel
number
CH_UEB Activates the option to
automatically and
consecutively record multiple
channels/characteristics after
a measured value has been
requested for the defined
channel.
Decoding of the received data by the IMP_000.DLL 15

6 Decoding of the received data by the


IMP_000.DLL
6.1 Individual measurement value transfer
After the DLL has received a character string, the data decoding process
takes place according to the following schema:

CH_UEB1 CH1 POS1 ENDCH

CH_UEB2 CH2 POS2

1. Decoding starts after the last sign of a data transfer has been
received. The last sign has to be defined using the ENDCH parameter
(-> trigger sign).

2. Now the measured value is determined from within the string between
POS1 and POS2. Setting POS2 to 0 has the effect that all characters
between POS1 and ENDCH are used.

3. After this, the channel number is determined from within the string
between CH1 and CH2. This determination is optional that means the
parameters can be set to 0 which will deactivate the channel decoding
(default setting).

4. Now the external trigger sign between CH_UEB1 and CH_UEB2 is


determined. If the character string between CH_UEB1 and CH_UEB2
matches with the under UEBERNSTR defined character string, the
DLL will interpret this as a signal that the measured value is to be
recorded for the statistics. If the characters from the string do not
match the defined trigger string, the measured value is simply
displayed. This parameter set is option as well, by default the option s
deactivated. This has the effect that all received measurement values
are recorded for the statistics.
16 RS232 Interface

Example:

Received character string

<SP> <SP> <SP> T <SP> 0 1 <SP> 1 . 2 3 4 <SP> <CR>

CH_UEB1 CH1 POS1


ENDCH

CH_UEB2 CH2 POS2

CH_UEB1=4 The DLL looks for a trigger signal at position 4 in


CH_UEB2=4 the received character string. If the “T” character
UEBERNSTR=T can be found at this position, the measured value
will be recorded for the statistics.
CH1=6 The DLL searches and finds the channel number
CH2=7 between the 6th and the 7th character in the string
(channel=”01”).
POS1=9 The system searches and finds the measurement
POS2=13 value between the 9th and the 13th character
(“1.234”). The value is copied from the string and
transferred to the statistical evaluation as the
trigger signal had been detected (see above).
ENDCH=\d013 As soon as the DLL detects the <CR> sign
(decimal 13), it starts processing the character
string that has been received until then.
Decoding of the received data by the IMP_000.DLL 17

6.2 Transfer of multiple parameters in blocks


The same principles also apply for this transfer type, but the blocks have
to be separated by a unique character. Within one block, the same logic
as described above is valid for decoding.

Block 1 .... Block n

SEP1 SEP1 ENDCH

1. Decoding starts as soon as the ENDCH character has been received.

2. The character string that has been received until now is now
separated into blocks. The separation takes place wherever in the
string the separator sign as defined with the SEP1 parameter is found
(after the last block, the separator sign can be omitted).

3. Within each block, the same decoding logic as described in chapter


6.1 is applied.
18 RS232 Interface

7 Control of the selection menu in the


Characteristics Mask
0. SHTTXT; Device description
1. CH_START:1. selectable channel
2. CH_END: Last selectable channel
3. CH_UEB: Check box for automatic measurement value recording
for part measurements. Check the box for that
characteristic that indicates the start of the part
measurement. Characteristics for which the box is not
checked will be skipped by the user interface and data
is recorded automatically.
4. REQSTRx: The software request string can be setup specifically
for each characteristic
5. REQBEZ: Optional description for item 4.)
6. INICHx: The channel initialization can be setup per
characteristic
7. INICHBEZx: Optional description for item 6.)
8. ART=1 Activates the selection option for dynamic
measurements *

8 Trouble shooting
1. Enter test=YES in the RS232DEF.INI file:
The data transfer will be protocolled in the C:\QSTERMX.TRC file
(X= number of the used interface, e.g. OSTERM2.TRC if the device
is connected to COM2) (ASCII file).

2. Sending the strings in the sequence above using a terminal


program.

3. Interface tester.

(*) Functionality is not available for all devices

You might also like