UM-0085-B09
DT80 Range User Manual
Page 356
RG
Triggering Schedules
Sometimes the serial device connected to the Serial Channel returns data unsolicited, and so the program must be
capable of responding to the device at any time. As discussed in
Trigger on External Event (P53)
, any schedule (
R
a
) can
be defined to trigger on the receipt of the specified string on the Serial Channel as follows:
R
an
SERIAL"
text
"
where a is the schedule identifier (A-K, X) and n is the serial channel port number (1 or 2)
The text string may also be blank:
R
an
SERIAL""
in which case any character received into the Serial Channel produces a trigger.
Whenever the Serial Channel produces a trigger by either of these methods, the receive buffer will contain the string that
caused the trigger, ready to be processed by an
n
SERIAL
command.
In the following example a serial device transmits whitespace separated temperature readings at irregular intervals. The
following job will read and log readings when they are received:
BEGIN
RA1SERIAL"" 1SERIAL("%f","SS Temp~degC")
LOGON
END
Note:
1SERIAL"
text
" schedule trigger does not consume (i.e. remove from the receive buffer) any received characters that did not
match
text
. This means that there may be other characters in the receive buffer preceding the
text
string. An input action should
therefore normally be included to discard any characters that do not match
text
. For example:
RA1SERIAL"abc:" 1SERIAL("\m[abc:]%f")
which will read and discard characters until the exact string abc: is seen.
Re-triggering
The DT80 checks any serial schedule triggers:
•
on receipt of data on the serial sensor port, and
•
following execution of any schedule containing an
n
SERIAL
channel
This means that if multiple messages are received in quick succession then all will be processed in turn. For example,
suppose the following schedule is entered:
RA1SERIAL"x:" 1SERIAL("\m[x:]%d")
and then the following serial data string is received:
x:1298 x:1265 x:0772
Receipt of this data will trigger the A schedule, and the 1SERIAL channel will then parse the first value, leaving "
x:1265
x:0772
" in the receive buffer. This string still matches the schedule trigger (i.e. it contains "
x:
"), so the A schedule will
be immediately re-triggered.
Serial Sensor Direct Mode
It is sometimes necessary to interactively set up or test a serial sensor device. This can be done without disconnecting
the device from the serial port using the DT80's
serial sensor direct
mode.
The following command:
SSDIRECT
n
causes the communications port on which the command was sent (host port, USB, TCP/IP) to enter
SSDIRECT
mode.
Whilst in this mode:
•
all subsequent commands that you enter on that port will not be processed by the DT80 and will instead be
transmitted out the specified serial channel port – the serial sensor port if
n
= 1 (which is the default), or the host
port if
n
= 2, or the USB port if
n
= 3. The one exception is
ENDSSDIRECT
, which is used to cancel SSDIRECT
mode.
•
all data received from the specified serial channel port will be returned to the host PC via the comms port that is
in SSDIRECT mode.
•
all transmit data (i.e. output actions) generated by the evaluation of
n
SERIAL
channels will be discarded.
•
all normal output data from the logger (e.g. real time data, status and error messages, etc) will not be returned
to the SSDIRECT-mode comms port. It will still be returned to any connected TCP/IP ports (see
), or to another comms port if you make it the active comms port by sending a command to it.
Serial sensor direct mode remains in effect until the
ENDSSDIRECT
command is received. The
ENDSSDIRECT
command may be issued on the SSDIRECT-mode comms port, or on any other comms port.