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

Appendix A. Advanced Programming Techniques
Const COMPRT = COM2
'Hexadecimal equivalent of a carriage return.
Const CR = CHR(&H0D)
'It is a comma. Sort the string from the PS/CH200 using commas.
Const COMMA = CHR(&H2C)
'I like to use the words "on" and "off" vs. "true" and "false".
Const On = True
Const Off = False
Public PanelTempC 'Datalogger panel temperature: Celsius
'Array holding all the three Amp-hour calculations
Public Amp_Hour(3)
'Amp-hours used by the entire system.
Alias Amp_Hour(1) = Sys_Amp_hr
'Amp-hours used by the datalogger, sensors and any communication options.
Alias Amp_Hour(2) = Load_Amp_hr
'Amp-hours going into the battery. Current coming out of the battery is
'part of the Load_Amp_hr value.
Alias Amp_Hour(3) = Batt_Amp_hr
Dim n 'Used as a counter.
'Variables and constants used to get status information from the PS/CH200
'Command sent to the PS/CH200 to get status information.
Const CH200STATS_CMD = "RD_STAT>"
'Holds the check sum value of the received PS/CH200 string.
Public Check_sum
'Used to catch clutter from the PS/CH200
Dim xmit_str As String
'Holds the entire status string coming from the PS/CH200.
Dim CH200string As String * 140
'Holds parsed string values.
Dim CH200_M0(9) As String * 20
'Battery voltage: VDC
Public VBatt
'Current going into, or out of, the battery: Amps
Public IBatt
'Current going to the load: Amps
Public ILoad
'Voltage coming into the charger: VDC
Public V_in_chg
'Current coming into the charger: Amps
Public I_in_chg
'Charger temperature: Celsius
Public Chg_TmpC
'Charging state: Cycle, Float, Current Limited, or None
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
'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
A-34