Campbell Scientific SDM SDM-SW8A 8-Channel Switch Closure Input Module - Page 16

Program name: C:\Documents and Settings\nigel\My Documents\Customers\INBO\SDM-SW8A BOMB.CR1

Page 16 highlights

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

  • 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

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