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

Table 17. Program Timing Instructions<br />

Instructions General Guidelines Syntax Form<br />

SubScan / NextSubScan<br />

Use when measurements or<br />

processing must run at faster<br />

frequencies than that of the<br />

main program.<br />

BeginProg<br />

Scan()<br />

'.<br />

'.<br />

'.<br />

SubScan()<br />

'.<br />

'.<br />

'.<br />

NextSubScan<br />

NextScan<br />

EndProg<br />

7.7.3.7.1 Scan() / NextScan<br />

Simple <strong>CR1000</strong> programs are often built entirely within a single Scan() /<br />

NextScan structure, with only variable and data-table declarations outside the<br />

Scan() / NextScan structure. In these simple programs, Scan() / NextScan creates<br />

an infinite loop, each periodic pass through the loop being synchronized to the<br />

<strong>CR1000</strong> clock. Scan() parameters allow modification of the period in 10- ms<br />

increments. As shown in CRBasic example BeginProg / Scan() / NextScan /<br />

EndProg Syntax (p. 136), aside from declarations, the CRBasic program may be<br />

relatively short.<br />

CRBasic Example 15.<br />

BeginProg<br />

Scan(1,Sec,3,0)<br />

PanelTemp(RefTemp, 250)<br />

TCDiff(TC(),6,mV2_5C,1,...)<br />

CallTable Temp<br />

NextScan<br />

EndProg<br />

BeginProg / Scan() / NextScan / EndProg Syntax<br />

Scan() determines how frequently instructions in the program are executed, as<br />

shown in CRBasic example Scan Syntax (p. 136):<br />

CRBasic Example 16.<br />

Scan Syntax<br />

'Scan(Interval, Units, BufferSize, Count)<br />

Scan(1,Sec,3,0)<br />

·<br />

·<br />

·<br />

ExitScan<br />

Scan() has four parameters:<br />

• Interval — the interval between scans.<br />

• Units — the time unit for the interval. Interval is 10 ms

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

Saved successfully!

Ooh no, something went wrong!