Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

need for two commands in SDI12 string


Shanks.J Apr 24, 2020 02:55 AM

I am measuring 3 variable within a soil probe.
the probe has 8 sensors, which means there are 3 sets of 8 values to pull.

comands (with an adress of 5) are
%  = C!   or (5C! in transparent)
Salinity = C1! (or 5C1! in transparent)
Temp = C2! (or 5C2! in transparent)
and
retrieve = 5D05!

when interested in only one varible set, (%) there is no issue, I can repeat the C! command and the values are given back on the second request, ie fist scan at 1minute =Nans , second scan gives values of the first scan (i think)

Now i am attemptint to write all three sets to the table by Making you my array dimensioned to 24 & define the start variable position in the array ie 1-8 , 9 - 16, 16 - 24.  details of this query in the following ticket: https://www.campbellsci.com/forum?l=thread&forum=1&tid=16293


this requires a scan to force the retrieval of each value set  before it gets the next one. 
what I’m thinking is  to  put two commands into the request for each set.
ie, read the value (5C!) then retrieve the values (5D0!) and then move on to the next value.

how would i place the second comand into the string?
5C! is (Soil_SDI12(1),C1,"5","C!",1,0,-1)
or would i have a second string?

any help would be fantastic thank you

below is the full code. at the moment i am getting nans for all 24 alias.

##########  Declare Variables  ###########

Public LoggerName As String * 24 'allows each logger to have a unique site code or name

Public Batt_volt(4) 'the loggers reading of battery voltages

Public PTemp_degC 'the loggers reading of its own internal temp

Public Soil_SDI12(24) 'probe #2, Address = 6 , Port C1


'##########  Output string from internal battery measurements  ##########

Alias Batt_volt(1) = SupplyVoltsAlias Batt_volt(2) = ChargeInAlias Batt_volt(3) = ChargeOutAlias Batt_volt(4) = LithiumVolts


'##########  output string from Soil moisture probe  ##########
'soil moisture
Alias Soil_SDI12(1)= Soil_Moisture_10cm
Alias Soil_SDI12(2)= Soil_Moisture_20cm
Alias Soil_SDI12(3)= Soil_Moisture_30cm
Alias Soil_SDI12(4)= Soil_Moisture_40cm
Alias Soil_SDI12(5)= Soil_Moisture_50cm
Alias Soil_SDI12(6)= Soil_Moisture_60cm
Alias Soil_SDI12(7)= Soil_Moisture_70cm
Alias Soil_SDI12(8)= Soil_Moisture_80cm
'soil temperature
Alias Soil_SDI12(9)= Soil_Temperature_10cm
Alias Soil_SDI12(10)= Soil_Temperature_20cm
Alias Soil_SDI12(11)= Soil_Temperature_30cm
Alias Soil_SDI12(12)= Soil_Temperature_40cm
Alias Soil_SDI12(13)= Soil_Temperature_50cm
Alias Soil_SDI12(14)= Soil_Temperature_60cm
Alias Soil_SDI12(15)= Soil_Temperature_70cm
Alias Soil_SDI12(16)= Soil_Temperature_80cm
'soil salinity
Alias Soil_SDI12(17)= Soil_Salinity_10cm
Alias Soil_SDI12(18)= Soil_Salinity_20cm
Alias Soil_SDI12(19)= Soil_Salinity_30cm
Alias Soil_SDI12(20)= Soil_Salinity_40cm
Alias Soil_SDI12(21)= Soil_Salinity_50cm
Alias Soil_SDI12(22)= Soil_Salinity_60cm
Alias Soil_SDI12(23)= Soil_Salinity_70cm
Alias Soil_SDI12(24)= Soil_Salinity_80cm


'##########  Define Data Tables  ##########
DataTable(Table1,True,-1)  DataInterval(0,10,Min,10) 'write table every 10 minutes 
Sample (1,LoggerName,String)
 
Sample (1,SupplyVolts,FP2)
 
Sample (1,LithiumVolts,FP2)
 
Sample (1,PTemp_degC,FP2)
  
Sample (24,Soil_SDI12(),FP2)

EndTable

'##########  Main Program  ###########
BeginProg  LoggerName="soiltestbench" 'ie a unique name for this logger/  
'Main Scan  Scan(30,sec,1,0) 'Scan once every 30seconds   
Battery(Batt_volt())'Read the supply and lithium voltages
   
PanelTemp(PTemp_degC,50) 'Read CR6 internal temp

'PROBE     
SDI12Recorder (Soil_SDI12(1),C1,"5","C!",1,0,-1) 'take measuremt (soil moisture)
       
Delay(0,2,Sec)
     
SDI12Recorder (Soil_SDI12(9),C1,"5","C2!",1,0,-1) 'take measuremt (soil temp)
       
Delay(0,2,Sec)
     
SDI12Recorder(Soil_SDI12(17),C1,"5","C1!",1,0,-1) 'take measuremt (soil salinity)
                
CallTable Table1  'Call Data Table and Store Data
 
NextScan

        



JDavis Apr 24, 2020 03:14 PM

I believe you need to use the WaitOnTimeout parameter of SDI12Recorder(). You should not need the Delay() instructions either.

Scan(30,sec,1,0) 'Scan once every 30seconds
Battery(Batt_volt())'Read the supply and lithium voltages
PanelTemp(PTemp_degC,50) 'Read CR6 internal temp
'PROBE
SDI12Recorder (Soil_SDI12(1),C1,"5","C!",1,0,8,1) 'take measuremt (soil moisture)
SDI12Recorder (Soil_SDI12(9),C1,"5","C2!",1,0,8,1) 'take measuremt (soil temp)
SDI12Recorder(Soil_SDI12(17),C1,"5","C1!",1,0,8,1) 'take measuremt (soil salinity)
CallTable Table1 'Call Data Table and Store Data
NextScan


Shanks.J Apr 27, 2020 08:44 PM

thanks for you response JDavis,
where should the WaitOnTimeout be placed in the code?


JDavis Apr 28, 2020 07:41 PM

WaitOnTimeout is a parameter of the SDI12Recorder instruction.

Log in or register to post/reply in the forum.