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 />

Table 10. Data Types<br />

Name:<br />

Command<br />

or<br />

Argument<br />

Description /<br />

Word Size<br />

Where Used Notes Resolution / Range<br />

As Boolean<br />

BOOLEAN<br />

Signed Integer /<br />

4 byte<br />

Dim & Public<br />

variables<br />

Final data storage<br />

Use to store TRUE or FALSE states,<br />

such as with flags and control ports. 0 is<br />

always false. -1 is always true.<br />

Depending on the application, any other<br />

number may be interpreted as true or<br />

false. See True = -1, False = 0 (p.<br />

145).To save memory, consider using<br />

UINT2 or BOOL8.<br />

0, -1<br />

BOOL8<br />

Integer /<br />

1 byte<br />

Final data storage<br />

8 bits (0 or 1) of information. Uses less<br />

space than 32-bit BOOLEAN. Holding<br />

the same information in BOOLEAN will<br />

require 256 bits. See Bool8 Data Type<br />

(p. 227).<br />

0, -1<br />

NSEC<br />

Time Stamp /<br />

8 byte<br />

Final data storage<br />

Divided up as four bytes of seconds<br />

since 1990 and four bytes of<br />

nanoseconds into the second. Used to<br />

record and process time data. See NSEC<br />

Data Type (p. 223).<br />

1 nanosecond<br />

As String<br />

STRING<br />

ASCII String /<br />

word size varies<br />

Dim & Public<br />

variables<br />

Final data storage<br />

Size is defined by the <strong>CR1000</strong> operating<br />

system. When converting from<br />

STRING to FLOAT, numerics at the<br />

beginning of a string convert, but<br />

conversion stops when a non-numeric is<br />

encountered. If the string begins with a<br />

non-numeric, the FLOAT will be NAN.<br />

If the string contains multiple numeric<br />

values separated by non-numeric<br />

characters, SplitStr() can be used to<br />

parse out the numeric values. See String<br />

Operations (p. 236) and Serial I/O (p.<br />

200).<br />

Unless declared otherwise, the minimum<br />

string size is 16 bytes or characters. Size<br />

above 16 bytes increases in multiples of<br />

four bytes; for example, String * 18<br />

allocates 20 bytes (19 usable).<br />

CRBasic Example 9.<br />

'Float Variable Examples<br />

Public Z<br />

Public X As Float<br />

'Long Variable Example<br />

Public <strong>CR1000</strong>Time As Long<br />

Public PosCounter As Long<br />

Public PosNegCounter As Long<br />

Data Type Declarations<br />

Boolean Variable Examples<br />

Public Switches(8) As Boolean<br />

Public FLAGS(16) As Boolean<br />

'String Variable Example<br />

Public FirstName As String * 16 'allows a string up to 16 characters long<br />

120

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

Saved successfully!

Ooh no, something went wrong!