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.

Section 7. Installation<br />

7.8.8.7 Q & A<br />

Q: I am writing a <strong>CR1000</strong> program to transmit a serial command that contains a<br />

null character. The string to transmit is:<br />

CHR(02)+CHR(01)+"CWGT0"+CHR(03)+CHR(00)+CHR(13)+CHR(10)<br />

How does the logger handle the null character<br />

Is there a way that we can get the logger to send this<br />

A: Strings created with CRBasic are NULL terminated. Adding strings together<br />

means the 2nd string will start at the first null it finds in the first string.<br />

Use SerialOutBlock() instruction, which lets you send null characters, as shown<br />

below.<br />

SerialOutBlock(COMRS232, CHR(02) + CHR(01) + "CWGT0" +<br />

CHR(03),8)<br />

SerialOutBlock(COMRS232, CHR(0),1)<br />

SerialOutBlock(COMRS232, CHR(13) + CHR(10),2)<br />

Q: Please explain and summarize when the <strong>CR1000</strong> powers the RS-232 port. I get<br />

that there is an "always on" setting. How about when there are beacons Does the<br />

SerialOpen() instruction cause other power cycles<br />

A: The RS-232 port is left on under the following conditions: 1) when the setting<br />

RS-232Power is set, or 2) when a SerialOpen() with argument COMRS232 is<br />

used in the program. Both of these conditions power up the interface and leave it<br />

on (with no timeout). If SerialClose() is used after SerialOpen(), the port is<br />

powered down and in a state waiting for characters to come in.<br />

Under normal operation the port is powered down waiting for input. After<br />

receiving input, there is a 40-second software timeout that must expire before<br />

shutting down. The 40-second timeout is generally circumvented when<br />

communicating with the datalogger support software (p. 77) because the software<br />

sends information as part of the protocol that lets the <strong>CR1000</strong> know that it can<br />

shut down the port.<br />

When in the "dormant" state with the interface powered down, hardware is<br />

configured to detect activity and wake up, but there is the penalty of losing the<br />

first character of the incoming data stream. PakBus® takes this into consideration<br />

in the "ring packets" that are preceded with extra sync bytes at the start of the<br />

packet. For this reason SerialOpen() leaves the interface powered up so no<br />

incoming bytes are lost.<br />

When the <strong>CR1000</strong> has data to send via the RS-232 port, if the data are not a<br />

response to a received packet, such as sending a beacon, it will power up the<br />

interface, send the data, and return to the "dormant" state with no 40-second<br />

timeout.<br />

Q: How can I reference specific characters in a string<br />

A: Accessing the string using the third dimension allows access to the remainder<br />

of the string that starts at the third dimension specified. For example if<br />

TempData = "STOP",<br />

220

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

Saved successfully!

Ooh no, something went wrong!