CRBasic Editor
Start
New Code
My Snippets
Public Snippets
Templates
Resources
basic ' Define public variables Public LoadCellReading(16) As Float Public DustMonitor1 As Float Public DustMonitor2 As Float ' Constants Const NumLoadCells = 16 Const ExcitationVoltage = 2500 ' mV, Example value for excitation voltage Const Sensitivity = 2.0 ' mV/V, Example sensitivity of Geokon load cell ' SDI-12 Addresses Const DustMonitorAddr1 = "0" Const DustMonitorAddr2 = "1" ' Scan interval Const ScanInterval = 10 ' seconds ' Main Program BeginProg ' Set the measurement interval Scan(ScanInterval, Sec, 0, 0) ' Measure the load cells For i = 1 To NumLoadCells ' Differential measurement of load cell voltage ' Assuming an example where each load cell is connected to sequential analog channels BrHalf(WVoltDiff, 1, LoadCellReading(i), i, i+1, ExcitationVoltage, 1, True, 0, 250, 60, mV2500, True, 0, 250) ' Convert the measurement to engineering units based on the load cell sensitivity LoadCellReading(i) = LoadCellReading(i) / (Sensitivity * ExcitationVoltage / 1000) Next i ' Measure the dust monitors SDI12Recorder(DustMonitor1, "C", DustMonitorAddr1, 0, "") SDI12Recorder(DustMonitor2, "C", DustMonitorAddr2, 0, "") ' Store data every scan interval CallTable DataTable1 NextScan EndProg ' Data table for storing readings DataTable(DataTable1, True, -1) DataInterval(0, ScanInterval, Sec, 10) Average(16, LoadCellReading(), IEEE4) Sample(1, DustMonitor1, IEEE4) Sample(1, DustMonitor2, IEEE4) EndTable
Make snippet public
Use mock deployment
Save & Share
Validate Code
Fix Missing Variables
Explain Code
Get Assistance
Simulate Code
Deploy to Datalogger
Versions
Version 1 (2025-03-12 02:47:37)
Load Selected Version