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

• Size-Table size is the number of records to store in a table before new data<br />

begins overwriting old data. If "10" is entered, 10 records are stored in the<br />

table -- the eleventh record will overwrite the first record. If "-1" is entered,<br />

memory for the table is automatically allocated at the time the program<br />

compiles. Auto allocation is preferred in most applications since the <strong>CR1000</strong><br />

sizes all tables such that they fill (and begin overwriting the oldest data) at<br />

about the same time. Approximately 2 kB of extra data-table space are<br />

allocated to minimize the possibility of new data overwriting the oldest data<br />

in ring memory when support software collects the oldest data at the same<br />

time new data are written. These extra records are not reported in the Status<br />

table and are not reported to the support software and so are not collected.<br />

Rules on table size change if a CardOut() instruction or TableFile()<br />

instruction with Option 64 are included in the table declaration. These<br />

instructions support writing of data to a CF card. Writing data to a CF<br />

card requires additional memory be allocated as a data copy buffer.<br />

The <strong>CR1000</strong> automatically determines the size the buffer needs to be<br />

and increases the data table memory allocation to accommodate the<br />

need (see CF Cards and Records Number (p. 414) ).<br />

CRBasic example Definition and Use of a Data Table (p. 127) creates a data table<br />

named OneMin, stores data once a minute as defined by DataInterval(), and<br />

retains the most recent records in SRAM, up to the automatically allocated<br />

memory limit. DataRecordSize entries in the Status table report allocated<br />

memory in terms of number of records the tables hold.<br />

DataInterval() Instruction<br />

DataInterval() instructs the <strong>CR1000</strong> to both write data records at the specified<br />

interval and to recognize when a record has been skipped. The interval is<br />

independent of the Scan() / NextScan interval; however, it must be a multiple of<br />

the Scan() / NextScan interval.<br />

Sometimes, usually because of a timing issue, program logic prevents a record<br />

from being written. If a record is not written, the <strong>CR1000</strong> recognizes the omission<br />

as a "lapse" and increments the SkippedRecord counter in the Status table.<br />

Lapses waste significant memory in the data table and may cause the data table to<br />

fill sooner than expected. DataInterval() instruction parameter Lapses controls<br />

the <strong>CR1000</strong> response to a lapse. The table DataInterval () Lapse Parameter<br />

Options (p. 130) lists Lapses parameter options and associated functions.<br />

Note Program logic that results in lapses includes scan intervals inadequate to the<br />

length of the program (skipped scans), the use of DataInterval() in event-driven<br />

data tables, logic that directs program execution around the CallTable()<br />

instruction.<br />

A data table consists of successive 1-kB data frames. Each data frame contains a<br />

time stamp, frame number, and one or more records. By default, a time stamp and<br />

record number are not stored with each record. Rather, the data extraction<br />

software uses the frame time stamp and frame number to time stamp and number<br />

each record when it is stored to computer memory. This technique saves<br />

telecommunications bandwidth and 16 bytes of <strong>CR1000</strong> memory per record.<br />

However, when a record is skipped, or several records are skipped contiguously, a<br />

129

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

Saved successfully!

Ooh no, something went wrong!