Campbell Scientific SDM-SW8A 8-Channel Switch Closure Input Module User Manual

Page 16

Advertising
background image

SDM-SW8A Switch Closure Input Module

'Program name: C:\Documents and Settings\nigel\My Documents\Customers\INBO\SDM-SW8A BOMB.CR1
'Date written: 13/07/2010

'
' Declare array of flags
Public Flag(9) As Boolean

'\\\\\\\\\\\\\\\\\\\\\\\\\ DECLARATIONS /////////////////////////

Public state(8)
Public duty(8)
Public counts(8)
Public RESETCNT

'\\\\\\\\\\\\\\\\\\\\\\\\ OUTPUT SECTION ////////////////////////
DataTable(Table003,true,-1)
OpenInterval
DataInterval(0,5,Min,10)

Sample(8, state, FP2)

Average(8, duty, FP2,Flag(9))

EndTable

'\\\\\\\\\\\\\\\\\\\\\\\\\ SUBROUTINES //////////////////////////
Sub Subroutine1
SDMSW8A(state,8,0,0,1,1,0)
SDMSW8A(duty,8,0,1,1,1,0)
SDMSW8A(counts,8,0,2,1,1,0)
EndSub

'\\\\\\\\\\\\\\\\\\\\\\\\\\\ PROGRAM ////////////////////////////
BeginProg

Scan(1,Sec, 3, 0)

Call

Subroutine1

' If SDM-SW8A was just programmed or its processor is bombed, set intermediate processing disable Flag

If Flag(1) = False Then Flag(9) = True

'Set Flag 9

If (state(1) < 0) Then Flag(9) = True

'Set Flag 9

' Output state and average duty cycle every 5mins

CallTable

Table003

' start trapping routines

'

If Flag(9) = True Then

If Flag(1) = True Then

'

reset

routine

Call

Subroutine1

RESETCNT

=

RESETCNT

+

1

Flag(1) = False

Else

Flag(1) = True

EndIf

EndIf
NextScan
EndProg

12

Advertising