Campbell Scientific SDM-IO16 16-Channel Input/Output Expansion Module User Manual
Page 30

SDM-IO16 16 Channel Input/Output Expansion Module
*Table 2 Program
02: 0.0000 Execution
Interval
(seconds)
*Table 3 Subroutines
End Program
7.3 A CR10X Program which Measures Four Frequency Inputs
(Anemometers) and Four Switch Closure Inputs (Rain
Gauges)
This program can also be used with a CR23X datalogger.
;{CR10X}
;An example that shows initial setup with frequency measurement
;on four ports and pulse counting, with switch closure, on the next
;four. In this example the four frequencies are anemometers and
;the switch closures are raingauges that need to be totalised
;
*Table 1 Program
01: 5
Execution
Interval
(seconds)
;First configure the IO16 if not already done
;If flag 1 is not set, i.e. the program has just
;been compiled or datalogger powered up.
;This code is needed primarily to enable switch debounce filtering
;on channels 4..8
1: If Flag/Port (P91)
1: 21
Do if Flag 1 is Low
2: 30
Then
Do
; Call instruction 188 to set the ports up
2: SDM-IO16 (P188)
1: 0
SDM
Address
2: 90
Command
Code
Option
;configure the ports
3: 9999
Ports
16-13
;Leave the last 8 ports as they are
4: 9999
Ports
12-9
5: 3333
Ports
8-5
;Set ports 5..8 as switch closure
6: 2222
Ports
4-1
;Set ports 1..4 as normal inputs
7: 1
Return Code Loc [ ErrCount ]
8: 2
First Loc [ Windspd_1 ]
9: 1.0
Mult
10: 0.0
Offset
;Set flag 1 high to indicate we have run the setup code
3: Do (P86)
1: 11
Set Flag 1 High
4: End (P95)
; of IF block
24