07.01.2015 Views

CR200/CR200X Series Dataloggers - Campbell Scientific

CR200/CR200X Series Dataloggers - Campbell Scientific

CR200/CR200X Series Dataloggers - 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 9. Programming<br />

The following commands and logical operators are used to construct logical<br />

expressions. CRBASIC EXAMPLE. Logical Expression Examples p. 89<br />

demonstrate some logical expressions.<br />

• IF<br />

• AND<br />

• OR<br />

• NOT<br />

• XOR<br />

• IIF<br />

Table 11. Logical Expression Examples<br />

If X >= 5 then Y = 0<br />

Sets the variable Y to 0 if the expression "X >= 5" is true, i.e. if X is greater than or equal to 5. The <strong>CR200</strong>(X) evaluates<br />

the expression (X >= 5) and registers in system memory a -1 if the expression is true, or a 0 if the expression is false.<br />

If X >= 5 OR Z = 2 then Y = 0<br />

Sets Y = 0 if either X >= 5 or Z = 2 is true.<br />

If X >= 5 AND Z = 2 then Y = 0<br />

Sets Y = 0 only if both X >= 5 and Z = 2 are true.<br />

If 6 then Y = 0.<br />

"If 6" is true since "6" (a non-zero number) is returned, so Y is set to 0 every time the statement is executed.<br />

If 0 then Y = 0.<br />

"If 0" is false since "0" is returned, so Y will never be set to 0 by this statement.<br />

Z = (X > Y).<br />

Z will equal -1 if X > Y, or Z will equal 0 if X

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

Saved successfully!

Ooh no, something went wrong!