04.01.2015 Views

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Appendix A. CRBasic Programming Instructions<br />

• Com310<br />

• ComSDC7<br />

• ComSDC8<br />

• ComSDC10<br />

• ComSDC11<br />

• Com1 (C1,C2)<br />

• Com2 (C3,C4)<br />

• Com3 (C5,C6)<br />

• Com4 (C7,C8)<br />

• Com32 – Com46 (available when using a single-channel expansion<br />

peripheral. See the appendix Serial Input Expansion Modules )<br />

Baud rate on asynchronous ports (ComRS-232, ComME, Com1, Com2, Com3,<br />

Com4, and Com32 - Com46) default to 9600 unless set otherwise in the<br />

SerialOpen() instruction, or if the port is opened by an incoming PakBus ® packet<br />

at some other baud rate. Table Asynchronous Port Baud Rates (p. 514) lists<br />

available baud rates.<br />

In general, PakBus ® instructions write a result code to a variable indicating<br />

success or failure. Success sets the result code to 0. Otherwise, the result code<br />

increments. If communication succeeds, but an error is detected, a negative result<br />

code is set. See CRBasic Editor Help for an explanation of error codes. For<br />

instructions returning a result code, retries can be coded with CRBasic logic as<br />

shown in the GetVariables() example in CRBasic example Retries in PakBus<br />

Communications (p. 514).<br />

The Timeout argument is entered in units of hundredths (0.01) of seconds. If 0 is<br />

used, then the default timeout, defined by the time of the best route, is used. Use<br />

PakBusGraph Hop Metrics to calculate this time (see datalogger support software<br />

(p. 77) ). Because these communication instructions wait for a response or timeout<br />

before the program moves on to the next instruction, they can be used in a<br />

SlowSequence scan. A slow sequence will not interfere with the execution of<br />

other program code. Optionally, the ComPort parameter can be entered preceded<br />

by a dash, such as -ComME, which will cause the instruction not to wait for a<br />

response or timeout. This will make the instruction execute faster; however, any<br />

data that it retrieves, and the result code, will be posted only after the<br />

communication is complete.<br />

AcceptDataRecords<br />

Sets up a <strong>CR1000</strong> to accept and store records from a remote PakBus datalogger.<br />

Syntax<br />

AcceptDataRecords(PakBusAddr, TableNo, DestTableName)<br />

Broadcast<br />

Sends a broadcast message to a PakBus network.<br />

Syntax<br />

Broadcast(ComPort, Message)<br />

511

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

Saved successfully!

Ooh no, something went wrong!