beautypg.com

2 cr1000, cr800, and cr850 programming – Campbell Scientific AM16/32A Multiplexer User Manual

Page 26

background image

AM16/32A Relay Analog Multiplexer

'CR5000 Example Program to measure 16 100 ohm Platinum Resistance Thermometers ‘connected to an
AM16/32A multiplexer used in the 4x16 configuration. The program also ‘measures 6 copper constantan
'thermocouples.
'The Thermocouples are connected to differential channels 1-6.

'Declare Variables:
Public TRef, TCTemp(6), PRTResist(16), PRTTemp(16)
Dim I

'Counter for setting Array element to correct value for mux measurement


'Declare Output Table for 15 minute averages:
DataTable (Avg15Min,1,-1)
DataInterval

(0,5,Min,10)

Average

(1,TRef,IEEE4,0)

Average

(6,TCTemp(),IEEE4,0)

Average

(16,PRTTemp(),IEEE4,0)

EndTable

BeginProg
Scan

(60,Sec,3,0)

PanelTemp

(TRef,250)

TCDiff (TCTemp(),6,mV20C ,1,TypeT,TRef,True ,0,250,1.0,0)

Portset

(1

,1)

'Set C1 high to Enable Multiplexer

Delay

(0,150,mSec)

I=0

SubScan(0,sec,16)

'Pulse C2 (Set High, Delay, Set Low) to clock multiplexer

Portset

(2,1

)

Delay (0,20,mSec)

Portset

(2,0)

I=I+1

'The Resistance measurement measures the PRT resistance:

Resistance

(PRTResist(I),1,mV50,7,Ix1,1,500,True

,True

,0,250,0.01,0)

'With a multiplier of 0.01 (1/100) the value returned is R/Ro (Resist/Resist @ 0 deg)

'the required input for the PRT temperature calculation instruction.

NextSubScan
Portset

(1

,0)

'Set C1 Low to disable Multiplexer

‘Calculate the Temperature from R/Ro:

PRT

(PRTTemp(1),16,PRTResist(1),1.0,0)

CallTable

Avg15Min

‘Call the DataTable

NextScan
EndProg

5.3.2 CR1000, CR800, and CR850 Programming

Although the following example is a CR1000 program, a similar
program can be used for the CR800 or CR850. This CR1000
program uses the AM16/32A to measure 48 CS616 probes connected
in the 4x16 configuration. The program also measures datalogger
battery voltage and temperature.

20