Appendix A. Controlling Power to the RV50
A-2
CRBasic Example A-2, also created by Short Cut, performs the same function
as the first program (turn on SW12 for 15 minutes every 60 minutes between
9:00 a.m. and 5:00 p.m.) without using the TimeIsBetween instruction. This
method should be used for CR1000, CR300 and CR800 operating systems
prior to version 28.
CRBasic Example A-2. Using If Statements to Turn On and Off SW12
'CR1000
'Created by Short Cut (3.1)
'Declare Variables and Units
Dim MinIntoDay
Public BattV
Public PTemp_C
Public SW12State As Boolean
Units BattV=Volts
Units PTemp_C=Deg C
'Define Data Tables
DataTable(Table2,True,-1)
DataInterval(0,1440,Min,10)
Minimum(1,BattV,FP2,False,False)
EndTable
'Main Program
BeginProg
'Main Scan
Scan(5,Sec,1,0)
'Default Datalogger Battery Voltage measurement 'BattV'
Battery(BattV)
'Default Wiring Panel Temperature measurement 'PTemp_C'
PanelTemp(PTemp_C,_60Hz)
'SW12 Timed Control
'Get minutes into current day
MinIntoDay=Public.TimeStamp(4,1)/60
'Turn ON SW12 between 0900 hours and 1700 hours
'for 15 minutes every 60 minutes
If (MinIntoDay>=540 And MinIntoDay<1020) And ((MinIntoDay-540) Mod 60 < 15) Then
SW12State=True
Else
SW12State=False
EndIf
'Always turn OFF SW12 if battery drops below 11.5 volts
If BattV<11.5 Then SW12State=False
'Set SW12 to the state of 'SW12State' variable
SW12(SW12State)
'Call Data Tables and Store Data
CallTable Table2