-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExample Program 1.CR1
More file actions
59 lines (41 loc) · 1.6 KB
/
Example Program 1.CR1
File metadata and controls
59 lines (41 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
' Example Program 1
' David Moore
' August 8th, 2022
' The Explanation
' The goal of this program is to record the panel temperature, the voltage of
' the big 12-V battery, and the voltage of the small, 3.6-V lithium-ion battery
' that's inside the datalogger.
' The Constants
Const Time_Between_Measurements = 5 ' Units: s
Const Data_Interval = 15 ' Units: s
' The Public Variables
Public Panel_Temperature
Public Big_Battery_Voltage
Public Small_Battery_Voltage
' The Data Tables
DataTable (Data_Table_1, 1, -1)
DataInterval (0, Data_Interval, Sec, -1)
' The 'Sample' command stores the most recent value in the data table.
' Another good option for the panel temperature measurements would be the
' 'Average' command.
Sample (1, Panel_Temperature, FP2)
' The 'Minimum' command stores the minimum value in the data table. We are
' typically interested in the minimum battery voltages and not the averages,
' although there are cases where this isn't true.
Minimum (1, Big_Battery_Voltage, FP2, False, False)
Minimum (1, Small_Battery_Voltage, FP2, False, False)
EndTable
' The Main Program
BeginProg
Scan (1, Sec, 0, 0)
' If measurements are to be taken every time the scan happens, you don't
' need to include an 'if' statement to specify how often to take
' measurements.
If (TimeIntoInterval (0, Time_Between_Measurements, Sec)) Then
PanelTemp (Panel_Temperature, _60Hz)
Battery (Big_Battery_Voltage)
Small_Battery_Voltage = Status.LithiumBattery
EndIf
CallTable Data_Table_1
NextScan
EndProg