Portget (dest, port) – Campbell Scientific CR5000 Measurement and Control Module User Manual

Page 147

Advertising
background image

Section 7. Measurement Instructions

7-21

The back-to-back silicon diodes D1 and D2 provide ESD protection of
capacitor C and the sensor, and also limit the amplitude of large amplitude
sensor signals. These diodes clip large amplitude signals to approximately 1.4
V pk-pk which is within the recommended input signal ranges for all range
codes. Diodes D1 and D2 along with resistor R1 are recommended to limit
large amplitude sensor signals, even when dc blocking capacitor C is not used.
Sensors outputting large voltages may cause large currents to flow through
these back-to-back diodes. A current limiting resistor may be desirable to
minimize these currents in some situations.

The current flow through these clipping diodes may also induce single-ended
offset voltages if it returns into the ground terminals. Single-ended offset
voltages of up to 2

µV/mA of current that flows into the ground terminals

can be induced across the front panel. The back-to-back diodes can be tied into
the G ground terminals, rather than ground terminals, if this is a problem.

Period Average Example

The following program instructions demonstrate the use of the PeriodAvg
function to measure a water content reflectometer that outputs a square wave
that can be measured by the datalogger. The measured period is converted to
volumetric water content using a polynomial.

Dim Time1(9)

'array for the realtime instruction

Public H20period

'declaration

Const H20percent=0

'set value

Public H20percent

'declaration


BeginProg

Scan (5,Sec,3,0)

'set 5 second scan rate

If Time5=0 Then

'if the time is the top of the hour Then DO

Portset (1 ,1 )

'Turn on Sensor by setting port 1 high

PeriodAvg(H20period,1,0,1,0,10,0.05,.001,0)

Portset (1 ,0)

'Turn off sensor by setting port 1 low

'Run through a polynomial to calculate percent

H20percent=(-0.187)+(0.037*H20period)+((0.335*H20period)^2)
EndIf

Time5<>0

'if the time is not the top of the hour, End

NextScan
EndProg

PortGet (Dest, Port)

The PortGet function is used to read the status of one of the eight control ports.

Remarks
This instruction will read the status of the specified port and place the result in
the Dest variable. This instruction is controlled by the task sequencer, which
sets up the measurement order. This results in the PortGet instruction always
occurring directly after the measurement instruction preceding it in the
program, regardless if the PortGet instruction is in a conditional block. If it is
desired to read the status of a port conditionally, the ReadIO instruction should
be utilized.

Advertising