![background image](http://html1.mh-extra.com/html/campbell/lws/lws_product-manual_3880750017.webp)
Appendix B. Example Programs
B-2
Scan
(5,Sec,1,0)
'Default Data Logger Battery Voltage measurement 'BattV'
Battery
(BattV)
'Default Wiring Panel Temperature measurement 'PTemp_C'
PanelTemp
(PTemp_C,60)
'LWS Dielectric Leaf Wetness Sensor measurement 'LWmV'
BrHalf
(LWmV,1,mV5000,1,VX1,1,2500,False,10000,60,2500,0)
'Determine Minutes Dry 'LWMDry', Minutes Wet or Contaminated 'LWMCon',
'and Minutes Wet 'LWMWet'. The value 0.08333333 is the scan rate divided by
'60 s (5 s/60 s = 0.08333333).
LWMDry=0
LWMCon=0
LWMWet=0
If
LWmV<274
Then
LWMDry=0.08333333
Else
If
LWmV>=284
Then
LWMWet=0.08333333
Else
LWMCon=0.08333333
EndIf
EndIf
'Call Data Tables and Store Data
CallTable
(Hourly)
CallTable
(Daily)
NextScan
EndProg
B.2 Example CR6 Program
The wiring for the example is shown in TABLE
TABLE B-2. CR6 Example Program Wiring
Color
Function
CR6
Brown or White
Excitation
U1
Orange or Red
Analog Out
U2
Clear
Analog Ground
⏚
CRBasic Example B-2. CR6 Program for Measuring the LWS
'CR6 Series
'Declare Variables and Units
Public
BattV
Public
PTemp_C
Public
LWmV
Public
LWMDry
Public
LWMCon
Public
LWMWet
Units
BattV=Volts
Units
PTemp_C=Deg C
Units
LWmV=mV
Units
LWMDry=Minutes
Units
LWMCon=Minutes
Units
LWMWet=Minutes