beautypg.com

20 set port, 21 pulse port with duration, 22 delay with optional excitation – Campbell Scientific CR23X Micrologger User Manual

Page 146

background image

SECTION 9. INPUT/OUTPUT INSTRUCTIONS

9-12

*** 20 SET PORT ***

FUNCTION
This instruction sets or configures specified
control ports (C1-C8). On power-up, ports
default to input configuration (i.e., they are not
driven high or low by the CR23X, and can be
used to read the status of an external signal
using Instruction 25). When a port is set high,
low, pulsed, or toggled by this instruction or a
program control command, the port is
automatically configured as an output.

NOTE: Do not apply voltages greater than
16 VDC to control ports. 5.0 VDC is
preferred.

Ports can also be set using the

6

Mode or

the J and K telecommunications commands.
However, the ports MUST be configured as
outputs before these means of setting them will
work. The option to configure the port as an
output is used when a port must be configured as
an output without changing the state of the port.

Pulse duration, initiated by a program control
instruction, can be set for each control port
(Table 12-2). Instruction 20 does not pulse the
port, it only sets the duration. If Instruction 20 is
not used to set the duration, the pulse
command will result in a 10 ms pulse.

Instruction 20 has two 4 digit parameters. Each
digit represents one control port. The code (0-
9) entered as the digit determines what effect
command 20 has on the corresponding port.

TABLE 9-6. Port Configuration Option Codes

Code

Function

0

Set port low

1

Set port high

2

Toggle port

3

Pulse duration 1 ms

4

Pulse duration 10 ms

5

Pulse duration 100 ms

6

Pulse duration 1 s

7

Configure as output

8

Configure as input

9

Leave unchanged

Duration of pulse on subsequent pulse port
command in Program Control Instruction.

PARAM.

DATA

NUMBER

TYPE

DESCRIPTION

01:

4

C8, C7, C6, C5 option
codes

02:

4

C4, C3, C2, C1 option
codes

Input locations altered: 0

*** 21 PULSE PORT WITH DURATION ***

FUNCTION
Instruction 21 pulses a control port for a
specified amount of time in hundredths of
seconds (0.01 seconds).

The pulse works as a toggle; if the port is high
before the instruction is executed, it will pulse
low and vice versa. Any value less than 1,
including 0, gives a pulse of 10 milliseconds.
The maximum input value is limited to 65,000,
which gives a pulse length of 650 sec.

Parameter 1 is the port number to be pulsed.
Parameter 2 is the input location containing the
pulse length.

PARAM.

DATA

NUMBER

TYPE

DESCRIPTION

01:

2

Control port

02:

4

Input location of pulse
length in hundredths of
a second

Input location altered: 0
Input locations read: 1

*** 22 DELAY WITH OPTIONAL ***

EXCITATION

FUNCTION
This instruction is used to delay program
execution. The excitation on time (parameter 2)
should be set to zero and the off time delay
(parameter 3) set to the desired delay. This
instruction can also be used in conjunction with
others for measuring a response to a timed
excitation using the excitation outputs. It sets
the selected excitation output to a specific
value, waits for the specified time, then turns off
the excitation and waits an additional specified
time before continuing execution of the following
instruction. Analog power is turned off during
delay after excitation to drop power to 3 mA.