Campbell Scientific PS200/CH200 12 V Charging Regulators User Manual

Page 99

Advertising
background image

Appendix A. Advanced Programming Techniques

A.6 Changing the SDI-12 Address Programming

Example

The CR1000 program example below shows how to change the SDI-12 address
in PS200/CH200 using SDI-12 port 3 (C3). The Campbell Scientific
programming software, CRBasic, would be used to set the variable
“new_sdi12_address” initially to a desired value but the value can be changed
“on the fly” while monitoring the data by changing the variable to a new value.
The CR1000 communicates with the PS200/CH200 via SDI-12 to change the
PS200/CH200’s SDI-12 address and then reads all the measurements from the
PS200/CH200 as a test.

'CR1000 Series Datalogger
'Program: Change_SDI12_Address.CR1
'Date: 1.September.2010

'Ver: A
'
'Notes: Program sets the SDI-12 address of a PS200/CH200 and tests

'the SDI-12 interface. Changes to the SDI-12 address can be made
'"on the fly" by changing the variable "new_sdi12_address"!

'
'SDI-12 addresses must be numbered 0 through 9, a through z, or A
'through Z.

'Connect the PS200/CH200 to SDI-12 port C3 of the CR1000.
'Use Campbell Scientific SDI-12 cable part # 20769.
'

'SDI-12 CABLE TO CR1000 WIRING
'-----------------------------
'WHITE: C3

'BLACK: G
'CLEAR: G
'

'CAUTION: ONLY ONE SDI-12 DEVICE MUST BE CONNECTED TO THE
'SDI-12 CONTROL PORT 3 OR THIS WILL NOT WORK:

'
'Public Variables
'Datalogger panel temperature: Celsius

Public PanelTempC
'Existing SDI-12 address in the PS/CH200
Public sdi12_address As String

'New SDI-12 address.
Public new_sdi12_address As String
Dim SDI_Addr_Chng As String


'Array to hold all the data coming from the PS200/CH200
Public CH200_M0(9)

'Alias names for array elements.
'Battery voltage: VDC

Alias CH200_M0(1)=VBatt
'Current going into, or out of, the battery: Amps
Alias CH200_M0(2)=IBatt

'Current going to the load: Amps
Alias CH200_M0(3)=ILoad
'Voltage coming into the charger: VDC

Alias CH200_M0(4)=V_in_chg
'Current coming into the charger: Amps
Alias CH200_M0(5)=I_in_chg

'Charger temperature: Celsius

A-37

Advertising