Hi friends, I use a cr1000 for solar radiation measurement. I want to create a new datatable for sensor calibration use only, so the data storage will be sporadic. I thought about create a datatable with a variable trigger and change the trigger thru terminal emulator.
below part of the program code.
'----crbasic-------
'variable trigger
Public Cal_Trigger
'-----------------MENU-------------------------
DisplayMenu( "Calibration Menu" , 1)
SubMenu("Current Trigger Value")
MenuItem("Cal_Trigger",Cal_Trigger)
MenuPick(TRUE,FALSE)
EndSubMenu
EndMenu
'-----------Calibration------------------------
DataTable( Calibration, Cal_Trigger, 1000)
Sample(1,DiffVolt(2),IEEE4)
Sample(1,DiffVolt(3),IEEE4)
EndTable
'-------'Main Program------------------------
BeginProg
Scan(1,Sec,1,0)
'------- Differential Voltage measurements-----------------
VoltDiff(DiffVolt(1),1,mV25,1,True,0,_50Hz,1,0.0)'Channel 1
VoltDiff(DiffVolt(2),1,mV25,2,True,0,_50Hz,1,0.0)'Channel 2
VoltDiff(DiffVolt(3),1,mV25,3,True,0,_50Hz,1,0.0)'Channel 3
VoltDiff(DiffVolt(4),1,mV2500,4,True,0,_50Hz,0.01,0.0)'Channel 4
VoltDiff(DiffVolt(5),4,mV25,5,True,0,_50Hz,1,0.0)'Channel 5 al 8
'-------Call Data Tables and Store Data
CallTable(Cr1000Output)
CallTable(Calibration)
NextScan
EndProg
Is the code OK?
There are e better way?
Thanks, Adrian.
Program looks good. Do you care if your calibration data is also included in your main table, Cr1000Output?
I don't find the datatable Cr1000Output!
'----crbasic-------
'variable trigger
Public Cal_Trigger, DiffVolt(8)
'-----------------MENU-------------------------
DisplayMenu( "Calibration Menu" , 1)
SubMenu("Current Trigger")
MenuItem("Cal_Trigger",Cal_Trigger)
MenuPick(TRUE,FALSE)
EndSubMenu
EndMenu
'-----------Calibration------------------------
DataTable( Calibration, Cal_Trigger, 1000)
Sample(1,DiffVolt(2),IEEE4)
Sample(1,DiffVolt(3),IEEE4)
EndTable
'-------'Main Program------------------------
BeginProg
Scan(1,Sec,1,0)
'------- Differential Voltage measurements-----------------
VoltDiff(DiffVolt(1),1,mV25,1,True,0,_50Hz,1,0.0)'Channel 1
VoltDiff(DiffVolt(2),1,mV25,2,True,0,_50Hz,1,0.0)'Channel 2
VoltDiff(DiffVolt(3),1,mV25,3,True,0,_50Hz,1,0.0)'Channel 3
VoltDiff(DiffVolt(4),1,mV2500,4,True,0,_50Hz,0.01,0.0)'Channel 4
VoltDiff(DiffVolt(5),4,mV25,5,True,0,_50Hz,1,0.0)'Channel 5 al 8
'-------Call Data Tables and Store Data
CallTable(Calibration)
NextScan
EndProg
Thanks for your answers!!!
A reference sensor is in channel 2, and in channel 3, I change sensors for comparison with the reference.
the entirely program is here:
'CR1000
'January 2010.
'Adrian.
'-----------------------------
'Declare Constants, Variables and Units
Const Cte = 0.0081
Const RadMax = 1100
Const StartCalibration = TRUE
Const StopCalibration = FALSE
Public Cal_Trigger
Public Batt_Volt
Public DiffVolt(8)
Units Batt_Volt=Volts
Units DiffVolt=mV
'-----------------MENU-------------------------
DisplayMenu( "Calibration Menu" , 1)
SubMenu("Current Trigger Value")
MenuItem("Cal_Trigger",Cal_Trigger)
MenuPick(TRUE,FALSE)
EndSubMenu
EndMenu
'---------------Tables-------------------------
'Define Data Tables
'----------Cr1000Output------------
DataTable(Cr1000Output,True,-1)
DataInterval(0,10,Min,10)
Totalize(1,DiffVolt(1),FP2,False)
FieldNames("PSP")
Totalize(1,DiffVolt(2),FP2,False)
FieldNames("Channel2")
Totalize(1,DiffVolt(3),FP2,False)
FieldNames("Channel3")
Totalize(1,DiffVolt(4),FP2,False)
FieldNames("Channel4")
Totalize(1,DiffVolt(5),FP2,False)
FieldNames("Channel5")
Totalize(1,DiffVolt(6),FP2,False)
FieldNames("Channel6")
Totalize(1,DiffVolt(7),FP2,False)
FieldNames("Channel7")
Totalize(1,DiffVolt(8),FP2,False)
FieldNames("Channel8")
EndTable
'----------------------------------
'---------BatteryTest-----------------
DataTable(BatteryTest,True,30)
DataInterval(0,1440,Min,10)
Minimum(1,Batt_Volt,FP2,False,False)
EndTable
'-------------------------------------
'-----------SparkTracker------------------------
DataTable( SparkTracker, True, 100)
DataEvent (2,DiffVolt(1)/Cte>RadMax,DiffVolt(1)/Cte<RadMax,1)
Sample(1,DiffVolt(1),IEEE4)
EndTable
'-----------------------------------------------
'-----------Calibration------------------------
DataTable( Calibration, Cal_Trigger, 1000)
Sample(1,DiffVolt(2),IEEE4)
Sample(1,DiffVolt(3),IEEE4)
EndTable
'----------------EndTables----------------------
'-------'Main Program-----------------------------
BeginProg
Scan(1,Sec,1,0)
'Default Datalogger Battery Voltage measurement Batt_Volt:
Battery(Batt_Volt)
' Differential Voltage measurements
VoltDiff(DiffVolt(1),1,mV25,1,True,0,_50Hz,1,0.0)'Channel 1
VoltDiff(DiffVolt(2),1,mV25,2,True,0,_50Hz,1,0.0)'Channel 2
VoltDiff(DiffVolt(3),1,mV25,3,True,0,_50Hz,1,0.0)'Channel 3
VoltDiff(DiffVolt(4),1,mV2500,4,True,0,_50Hz,0.01,0.0)'Channel 4
VoltDiff(DiffVolt(5),4,mV25,5,True,0,_50Hz,1,0.0)'Channel 5 al 8
'Call Data Tables and Store Data
CallTable(Cr1000Output)
CallTable(BatteryTest)
CallTable(SparkTracker)
CallTable(Calibration)
'---------------------------------
NextScan
EndProg
'-----------EndMainProgram-----------------------
Hi , I am having problems with the menu. It doesn't appear at all!
I was expecting it like a submenu of principal menu because I used a number diferent to zero in the definition
DisplayMenu( "Calibration Menu" , 1)
Do you see an error in the program? or I misunderstood the manual (cr1000 manual, page 10-2).
Thanks.
Adrian,
You need a -1 in the instruction.
Here's a simplified menu:
DisplayMenu( "Calibration Menu" ,-1)
MenuItem("Cal_Trigger",Cal_Trigger)
MenuPick(True,False)
EndMenu
Also change
Public Cal_Trigger to Public Cal_Trigger As Boolean
With this code:
DisplayMenu( "Calibration Menu" ,-1)
The Calibration Menu should be part of the main menu that way?
Should be here?
No.
The CustomMenu instruction applies to the CR1000KD and CR850 display. Custom menus are NOT displayed/passed through the terminal interface.
http://www.campbellsci.com/cr1000kd
http://www.campbellsci.com/cr850
However ConstTable is exposed through the terminal interface and accessible with the "C" option/command.
ConstTable
Const A = 10
Const B = 20
EndConstTable
* Last updated by: Sam on 1/26/2011 @ 4:00 PM *