04.01.2015 Views

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Section 7. Installation<br />

'///////////////Serial Time Set Input Section///////////////<br />

'Accept old C command -- [2008:028:10:36:22]C -- parse, process, set<br />

'clock (Note: Chr(91) = "[", Chr(67) = "C")<br />

SerialInRecord(ComRS232,InString,91,0,67,InStringSize,01)<br />

If InStringSize 0 Then<br />

SplitStr(InStringSplit,InString,"",5,0)<br />

Call DOY2MODAY<br />

'Call subroutine to convert day-of-year<br />

'to month & day<br />

ClkSet(1) = Year<br />

ClkSet(2) = Month<br />

ClkSet(3) = Date<br />

ClkSet(4) = Hour<br />

ClkSet(5) = Minute<br />

ClkSet(6) = Second<br />

ClkSet(7) = uSecond<br />

'Note: ClkSet array requires year, month, date, hour, min, sec, msec<br />

ClockSet(ClkSet())<br />

CallTable(ClockSetRecord)<br />

EndIf<br />

'/////////////////Serial Output Section/////////////////////<br />

'Construct old <strong>Campbell</strong> <strong>Scientific</strong> Printable ASCII data format and output to COM1<br />

'Read datalogger clock<br />

RealTime(rTime)<br />

If TimeIntoInterval(0,5,Sec) Then<br />

'Load OneMinData table data for processing into printable ASCII<br />

GetRecord(OneMinData(),OneMinTable,1)<br />

'Assign +/- Sign<br />

For i=1 To 6<br />

If OneMinData(i) < 0 Then<br />

'Note: chr45 is - sign<br />

OutFrag(i)=CHR(45) & FormatFloat(ABS(OneMinData(i)),"%05g")<br />

Else<br />

'Note: chr43 is + sign<br />

OutFrag(i)=CHR(43) & FormatFloat(ABS(OneMinData(i)),"%05g")<br />

EndIf<br />

Next i<br />

'Concatenate Printable ASCII string, then push string out RS-232<br />

'(first 2 fields are ID, hhmm):<br />

OutString = "01+0115." & " 02+" & FormatFloat(rTime(4),"%02.0f") & _<br />

FormatFloat(rTime(5),"%02.0f")<br />

OutString = OutString & " 03" & OutFrag(1) & " 04" & OutFrag(2) & _<br />

" 05" & OutFrag(3)<br />

OutString = OutString & " 06" & OutFrag(4) & " 07" & OutFrag(5) & _<br />

CHR(13) & CHR(10) & "" 'add CR LF null<br />

'Send printable ASCII string out RS-232 port<br />

SerialOut(ComRS232,OutString,"",0,220)<br />

EndIf<br />

NextScan<br />

EndProg<br />

219

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!