beautypg.com

94 else, 95 end, 96 activate serial data output – Campbell Scientific CR10X Measurement and Control System User Manual

Page 188

background image

SECTION 12. PROGRAM CONTROL INSTRUCTIONS

12-6

EXAMPLE:

01:

P93

Case

01:

2

Case Loc

02:

P83

If Case Location < F

01:

69.4

F

02:

3

Call Subroutine 3

else

03:

P83

If Case Location < F

01:

72

F

02:

10

Set high Flag 0 (output)

else

04:

P83

If Case Location < F

01:

77.3

F

02:

30

Then Do

05:

P30

Z=F

01:

0

F

02:

0

Exponent of 10

03:

25

Z Loc :

06:

P95

End Then Do

07:

P95

End of Case Statement

*** 94 ELSE ***

FUNCTION
When Command 30 (Then/Else) is used with an
If Instruction, the Else Instruction is used to
mark the start of the instructions to execute if
the test condition is false (Figure 3.8-1). The
Else Instruction is optional; when it is omitted, a
false comparison will result in execution
branching directly to the End Instruction.
Instruction 94 has no parameters.

*** 95 END ***

FUNCTION
Instruction 95 is used to indicate the end/return
of a subroutine (Instruction 85), the end of a
loop (Instruction 87), the end of an If Then/Else
sequence (Instructions 88-92 when used with
command 30), or the end of a Case sequence
(Instruction 93). The End Instruction has no
parameters.

*** 96 ACTIVATE SERIAL DATA OUTPUT ***

FUNCTION
Instruction 96 is used to activate Storage
Module (SM192/SM716 or Card Storage
Module) or serial data (printer) output. Normally
Instruction 96 is placed in the program table

after all Output Instructions have been entered
and is executed each time the Table is
executed. In this situation any data sent to Final
Storage is output as soon as possible.
However, by using Program Control Instructions
to allow execution of Instruction 96 only at
certain times, the user can control when the
output device(s) are active. Instruction 96
allows a choice of serial data format and the
selection of Addressed or Pin Enabled device
for the serial print output.

A single parameter is used to select whether the
instruction is to control the "printer", Storage
Module, or Card Storage Module output, and if
the printer is selected, the format and baud rate.
The Instruction must be entered separately for
each device that is to receive output.

If both Final Storage areas are in use,
Instruction 96 will send data from the area
which is currently active. Final Storage Area 1
is active at the start of each Table. Instruction
80 can be used to change the active area. The
Area set by Instruction 80 remains active until
changed by another Instruction 80 or the Table
ends (at which time Area 1 becomes the active
Area 1). Instruction 80 can also direct output to
Input Storage, in which case Instruction 96
assumes Final Storage Area 1.

If the CR10X is already communicating on the
9-pin connector when Instruction 96 is
executed, the output request is put in a queue
and program execution continues. As the 9-pin
connector becomes available, each device in
the queue will get its turn.

The request is not put in the queue if the same
device is already in the queue. The data
contained in the queue (and which determine a
unique entry) are baud rate (if applicable), and
the Final Storage Area. Instruction 98 to send
characters also uses this queue.

When an entry reaches the top of the queue,
the CR10X sends all data accumulated since
the last transfer to the device up to the location
of the DSP at the time the device became
active (this allows everything in the queue to get
a turn even if data is being stored faster than it
can be transferred to a particular device).

The "other Final Storage Area" device option (the
non-active area) allows a "fast" Final Storage area to
be transferred to the main area on some trigger
condition so there is some history recorded prior to
the trigger condition (Section 8.8). The source of
data is the currently active Final Storage Area set by
Instruction 80 (default = 0 or 1).