beautypg.com

5 flushing the input and output buffers, 6 return error codes – Campbell Scientific SDM-SIO4 4-Channel Serial I/O Interface User Manual

Page 61

background image

Section 5. Programming the Datalogger

5-29

*Table 3 Subroutines

End Program

5.5 Flushing the Input and Output Buffers

One important aspect of the SDM-SIO4 is that it will continue to collect data
and store it in its buffers even if the datalogger program stops running. Care
must be taken to ensure that data does not build up in the buffers and as a result
either a buffer overflows, or data is collected which relates to a different time
than anticipated.

To prevent this, the instruction set includes instructions which either allow the
buffers to be erased or special filter options which allow buffers to be flushed
and data collection to be stopped and started. Please refer to these instructions
for more details.

Unless the filters used specifically flush the input buffer it is advisable to
include instructions to flush the buffers within the configuration section of the
program.

5.6 Return Error Codes

These return error codes are used by the command line and by the datalogger
command 67.

0= No error.
1= String not enclosed in double quotes
2= String > 255 characters long
3= Out of string memory
4= Unknown error
5= String not allocated
6= String pointer corrupt
7= Command not recognized
8= Command index error
9= Bad parameters
10= String > 255 characters long or Out of string memory
11= Filter definition error
12= Filter definition error - number too big
13= Formatter definition error
14= Formatter definition error - number too big
15= No ‘:’ separator between numbers
16= COMMAND LINE is now on port number 1
17= COMMAND LINE is now on port number 2
18= COMMAND LINE is now on port number 3
19= COMMAND LINE is now on port number 4
20= System RAM failure
21= System RAM good
22= SDM-SIO4 busy
23= Command successful