-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEcoTriplet-Continous.CR1X
72 lines (56 loc) · 2.16 KB
/
EcoTriplet-Continous.CR1X
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
60
61
62
63
64
65
66
67
68
69
70
71
72
'CR1000X Series Datalogger
'The datalogger type listed on line 1 determines the default instruction set,
'compiler, and help files used for a program that uses the .DLD or .CRB program
'extension. These options can also be set using the Set Datalogger Type dialog box
'(CRBasic Editor|Tools|Set Datalogger Type).
'For programming tips, copy this address to your browser
'search window:https://www.campbellsci.com/videos/datalogger-programming
'To create a different opening program template, type in new
'instructions and select Template | Save as Default Template
'Date: 2023-08-15
'Program author: Eric Rehm, Sea-Bird Scientific
'
' ECO: 44 bytes/line * ECO 1 line/s * CR1000x 1 s/scan = 44 bytes received/scan
' 44 bytes + 44 (allow for extra record) = 88 butes --> 90 byte BufferSize
'Declare Constants
Const PortEco = ComC5
'Declare Public Variables
'Example:
Public RawString As String * 100, SplitStrings(9) As String * 32
Public Chl470 As Long, Beta700 As Long, FDOM As Long
Public NBytesReturned
Units Chl470=counts
Units Beta700=counts
Units FDOM=counts
'Declare Private Variables
'Example:
'Dim Counter
'Define Data Tables
DataTable (EcoTriplet,NBytesReturned,-1) 'Set table size to # of records, or -1 to autoallocate.
Sample (1,Chl470,Long)
Sample (1,Beta700,Long)
Sample (1,FDOM,Long)
Sample (1,RawString,String)
EndTable
'Define Subroutines
'Sub
'EnterSub instructions here
'EndSub
'Main Program
BeginProg
SerialOpen (PortEco,19200,0,0,200,0)
Scan (1,Sec,3,0)
'Each Eco record is a tab-delimited string of 42-48 bytes plus <cr><lf>:
'<lf>99/99/99 99:99:99 695 xx38 700 xx49 460 xx41 999<cr>
SerialInRecord (PortEco,RawString,&h0A,0,&h0D,NBytesReturned,01)
' If NBytesReturned >= 42 Then
'Get counts for each measurement by splitingt string at tabs CHR(09)
SplitStr (SplitStrings(1),RawString,CHR(09),9,5)
Chl470=SplitStrings(4) 'xx38, where xx are additional digits
Beta700=SplitStrings(6) 'xx49
FDOM=SplitStrings(8) 'xx41
'Update table
CallTable EcoTriplet
'EndIf
NextScan
EndProg