Campbell Scientific PS200/CH200 12 V Charging Regulators User Manual
Page 91

Appendix A. Advanced Programming Techniques
'Command to get extended status information.
Const EXTSTATS_CMD = "RD_SPECIAL>"
'Array to hold extended data from the PS200/CH200
Public CH200_MX(4) As String * 20
'Battery charging target voltage.
Public BattTargV
'Digital potentiometer setting.
Public DgtlPotSet
'Present battery capacity.
Public BattCap
'Battery charge deficit.
Public Qloss
'
'Command to clear out QLoss.
Const QLOSS_RES_CMD = "RESET_QLOSS>"
'Setting the variable Clear_QLoss to true, or on, clears QLoss.
Public Clear_QLoss As Boolean
'Number signifiying how far into the return string for "RESET_QLOSS"
'command the "OK" is located.
Public QL_OK_Loc
'Return string containing the "OK".
Public QL_ReturnStr As String * 40
'Stored hourly data.
DataTable (Hour,1,-1)
DataInterval (0,1,Hr,10)
Minimum (1,VBatt,FP2,0,False)
Minimum (1,IBatt,FP2,0,False)
Minimum (1,ILoad,FP2,0,False)
Minimum (1,V_in_chg,FP2,0,False)
Minimum (1,I_in_chg,FP2,0,False)
Minimum (1,Chg_TmpC,FP2,0,False)
Maximum (1,VBatt,FP2,False,False)
Maximum (1,IBatt,FP2,False,False)
Maximum (1,ILoad,FP2,False,False)
Maximum (1,V_in_chg,FP2,False,False)
Maximum (1,I_in_chg,FP2,False,False)
Maximum (1,Chg_TmpC,FP2,False,False)
Minimum (1,PanelTempC(),FP2,0,False)
Maximum (1,PanelTempC(),FP2,False,False)
EndTable
'Save the old QLoss value and a time when the value was cleared.
DataTable (ClearQLoss,True,48)
Sample (1,Qloss,FP2)
EndTable
'Subroutine sends two back space characters to the PS/CH200 to
'wake it up and switch over to RS-232 mode.
Sub WAKEUP
SerialOut (COMPRT,CHR(&H08),"",1,3)
SerialOut (COMPRT,CHR(&H08),"",1,3)
EndSub
'Main Program
BeginProg
Clear_QLoss = False
'Load arrays with words to associated with the check battery values
'from the PS/CH200.
CheckBatteryArr(1) = "Normal"
CheckBatteryArr(2) = "Check Battery"
Scan (5,Sec,0,0)
PanelTemp(PanelTempC,_60Hz) 'Measure datalogger panel temperature.
CallTable Hour
NextScan
A-29