A.3.2.2 set number of days battery test – sdi12, A.3.2.2 – Campbell Scientific PS200/CH200 12 V Charging Regulators User Manual

Page 84

Advertising
background image

Appendix A. Advanced Programming Techniques

If Check_sum = 0 Then
'Split up the main string from PS/CH200 into separate components.

SplitStr (CH200_MX(),CH200string,COMMA,4,4)
'Sort out the components to specific variables.
BattTargV = CH200_MX(1)

DgtlPotSet = CH200_MX(2)
BattCap = CH200_MX(3)
Qloss = CH200_MX(4)

EndIf
CallTable (DischargeTest)

'write data before zeroing ElapsedHrs

NextScan
EndProg

A.3.2.2 Set Number Of Days Battery Test – SDI12

'CR1000 Series Datalogger

'Program: RS-232_XDays_Battery_Load_Test.CR1
'Date: 1.November.2010
'Ver: A

'
'Notes: This program tests the existing battery for problems by
'setting the target voltage down to 11.5VDC forcing the system to

'run strictly on battery power.
'Test is based on a time interval in days and test duration is in
'hours.

'
'Use Campbell Scientific RS-232 cable part # 25356.
'

'RS-232 CABLE TO CR1000 WIRING
'-----------------------------

'GREEN: C3 (TX)
'WHITE: C4 (RX)
'BLACK: G

'CLEAR: G
'
'This program uses the RS-232 command "BATT_TEST>" to force the

'battery target voltage down to 11.5vdc.

PipeLineMode

'Constants & Public Variables
'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 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

'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

A-22

Advertising