![Campbell SR50AT Скачать руководство пользователя страница 46](http://html1.mh-extra.com/html/campbell/sr50at/sr50at_instruction-manual_488987046.webp)
Appendix B. Example Programs
B-12
EndIf
Snow_Depth = Inital_Dist - TCDT
'Add up any errors across the day.
Call
Diag
EndIf
EndIf
'Call Data Tables and Store Data
CallTable
Hour
CallTable
Daily
'Clear diagnostic counters after Daily_Status table is stored.
If
Daily.Output(1,1)
Then
ROM_Cntr = 0
SR50AT_WtchDg_Cntr = 0
EndIf
NextScan
EndProg
B.3.2 CR6 RS-485 Programming Example
TABLE B-6. Wiring for CR6 RS-485 Program
Wire Colo
u
r
Sensor Wire Description
CR6 Wire Channels
Red
Power source
12V
Green
A
C1
White
B
C2
Black
Ground
G
Shield
Shield/Earth ground
⏚
CRBasic Example B-5. CR6 RS-485 Programming Example
'CR6
'Program: SR50AT_RS485.CR6
'This program contains a number of features not found in Short Cut.
'
'The initial distance value from the SR50AT head to the ground is
'measured by setting the flag SR50AT_MID to TRUE. Set this flag after
'installing the SR50AT in the field. Setting this flag will initiate
'a measurement cycle and the resulting value stored as the initial
'distance. The initial distance is used to calculate snow depth.
'The PreserveVariables instruction is used to store the initial
'distance in non-volatile memory. If power is lost at the site, the
'initial distance value will be restored.'
'A control flag is used to initiate the SR50AT measurement cycle. This
'allows for manual control in the field to check distances without
'waiting for the correct time interval to occur. It is also used by
'the datalogger to initiate an automated measurement cycle.
'
'Every measurement cycle is composed of 11 individual measurements
'that are spatially sorted to eliminate any low or high values.
'One measurement is made with each scan. This program has a 10
'second scan rate so it will take 100 seconds to do all 11 scans or
'1 minute and 40 seconds.
'Declare Constants
'Default serial address of SR50AT is 33. Polling command consists of
'a lower case 'p' followed by the address and a carriage return.