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

PS200/CH200 12 V Charging Regulators
Below is an example CRBasic program that reads the status information from a
PS200/CH200 via RS-232.
'CR1000 Series Datalogger
'Program: RS-232_Status_Info.CR1
'Date: 1.November.2010
'Ver: A
'
'Notes: Program returns all information from PS200/CH200.
'Connect the PS200/CH200 to RS-232 port COM2 of the CR1000.
'Use Campbell Scientific SDI-12 cable part # 25356.
'
'RS-232 CABLE TO CR1000 WIRING
'-----------------------------
'GREEN: C3 (TX)
'WHITE: C4 (RX)
'BLACK: G
'CLEAR: G
'
'Public Variables
Public PanelTempC 'Datalogger panel temperature: Celsius
'Change this constant if using a different com port on the CR1000.
Const COMPRT = COM2
'Hexadecimal equivalent of a carriage return.
Const CR = CHR(&H0D)
'It's a comma. Used to sort PS/CH200 strings.
Const COMMA = CHR(&H2C)
'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
'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)
47