Campbell Scientific PS200/CH200 12 V Charging Regulators User Manual

Page 66

Advertising
background image

Appendix A. Advanced Programming Techniques

Public ChargeState As String
'Charging source: None, AC, or Solar

Public ChargeSource As String
'Check battery error: 0=normal, 1=check battery
Public Ck_Batt

'Word or phrase equivalent of check battery error.
Public CheckBattery As String
'Array to hold the names of the battery error information.

Dim CheckBatteryArr(2) As String

'Variables & constants used to write an external battery temperature to the

'PS/CH200 and reset it.
'True - use external battery temp. False - use PS/CH200 temp.

Public SendBattTemp As Boolean
'Command sent to the PS/CH200 to write external battery temperature.
Const WRITE_BATT_TEMP_CMD = "WR_BT("

'Command sent to the PS/CH200 to restore.
Const RESTR_BATT_TEMP_CMD = "RS_INTBT>"
'String storing the formatted ASCII equivalent of the ext battery temp.

Public ExtBatString As String * 5
'String coming back from either the "WR_BT" or "RS_INTBT" command
Public ReturnStr As String * 40

'Number signifying how far into the return string for "RS_INTBT"
'command the "OK" is located.
Dim OK_Loc


'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


'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

'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-4

Advertising