'Demonstration program to show how to use the 'Judd Communications depth senor. 'Wiring diagram: 'Wire Purpose Datalogger '____________________________________ 'Clear Shield G 'Black Power - G 'Red Power + +12V 'Green On/Off C1 'White Signal + 3H 'Brown Signal - 3L '\\\\\\\\\\\\\\\\\\\\\\\\\ DECLARATIONS ///////////////////////// Public Battery Public Air_TempC Public Air_TempF Public Depth '\\\\\\\\\\\\\\\\\\\\\\\\ OUTPUT SECTION //////////////////////// 'Output Data to table once a minute DataTable(Table101,true,-1) OpenInterval DataInterval(0,1,Min,10) Average(1, Air_TempF, FP2, 0) Sample(1, Depth, FP2) EndTable '\\\\\\\\\\\\\\\\\\\\\\\\\ SUBROUTINES ////////////////////////// '\\\\\\\\\\\\\\\\\\\\\\\\\\\ PROGRAM //////////////////////////// BeginProg Scan(5,Sec, 3, 0) '------------------------------------------------------- 'Input Processing '------------------------------------------------------- Battery(Battery) 'Turn ON the depth sesor PortSet(1, 1) 'wait 0.8 seconds for the sensor to output the 'Air Temp. Delay(0,800,MSEC) 'Air Temp is output in milliVolts, scaled to Kelvin, 'and then convert to Celsius. VoltDiff(Air_TempC, 1, mV2500, 3, True, 0, 250, 0.2, -273) 'Air Temp is also converted and saved in Fahrenheit Air_TempF = Air_TempC * 1.8 Air_TempF = Air_TempF + 32 'The depth sensor needs another 1.8 seconds to make up 'to 10 measurements and perform error checking and 'temperature compensation. Delay(0,1800,MSEC) 'Distance is output in milliVolts, scaled to inches, and 'then converted to depth by subtracting the distance 'measured from the reference distance. 'Use a multiplier of -.19685 for output in inches 'and -.5 for ouput in centimeters. ' 'The following instruction is configured to output the measured distance in inches 'To reconfigure the instruction to output depth in inches do the following: 'Change the multiplier from .1968 to -.1968 'Change the offset value from 0 to the distance measured VoltDiff(Depth, 1, mV2500, 3, True, 0, 250, 0.1968, 0) 'Turn OFF depth sensor. PortSet(1, 0) CallTable Table101 NextScan EndProg