
Appendix B. Example Programs
B-5
CRBasic Example B-3. Differential Voltage Measurements Using MuxSelect()
'Multiplexer in 2X32 mode
'Declare Variables and Units
Public
DiffV(3)
Public
Mult(3)={9,1,8}
Public
Offs(3)={5,4,9}
Units
DiffV=mV
'Define Data Tables
DataTable
(Hourly,True,-1)
DataInterval
(0,60,Min,10)
Sample
(3,DiffV(),FP2)
EndTable
DataTable
(Daily,True,-1)
DataInterval
(0,1440,Min,10)
Average
(3,DiffV(),FP2,False)
EndTable
'Main Program'
BeginProg
SW12
(1 )
'provide power to AM16/32B
'Main Scan
Scan
(30,Sec,1,0)
'>>>>>> Set 1
'Turn AM16/32B Multiplexer On, start measurements on mux channel 1
MuxSelect
(C1,C2 ,20,1,1)
'1 repetition, writing to DiffV(1)
'1 repetition, measuring 1 H/L on mux
VoltDiff
(DiffV(1),1,mv34,1,True,0,_60Hz, Mult(1),Offs(1))
'>>>>>> Set 2
PulsePort
(C1 ,10000)
'move to Set 2
'1 repetition, writing to DiffV(2)
'1 repetitions, measuring 2 H/L on mux
VoltDiff
(DiffV(2),1,mv34,1,True,0,_60Hz, Mult(2),Offs(2))
'>>>>>> Set 3
PulsePort
(C1 ,10000)
'move to Set 3
'1 repetition, writing to DiffV(3)
'1 repetitions, measuring 3 H/L on mux
VoltDiff
(DiffV(3),1,mv34,1,True,0,_60Hz, Mult(3),Offs(3))
'Turn AM16/32B Multplexer Off
PortSet
(C2,0)
'Call Data Tables and Store Data
CallTable
Hourly
CallTable
Daily
NextScan
EndProg
The following example is a CR1000X program. With minor adjustments, this
program can be used with the CR6 series, CR800 series, CR1000, or CR3000.
The AM16/32B must be in 2x32 mode.
CRBasic Example B-4. Differential Voltage Measurements
'Declare Variables and Units
Public
BattV
Public
Ptemp_C
Public
LCount
Public
DiffV(32)
Public
Mult(32)={9,1,8,8,8,1,5,2,8,5,3,6,2,6,5,5,2,9,1,7,8,8,2,3,9,2,8,1,7,2,7,4}
Public
Offs(32)={5,4,9,8,4,1,1,1,7,4,8,2,6,9,7,5,9,2,3,5,2,1,9,3,8,4,3,6,5,9,3,3}
Units
BattV=Volts
Units
Ptemp_C=Deg C
Units
DiffV=mV
'Define Data Tables