This is an old revision of the document!
Implementation of software on the Campbell Scientific CR6 is done with the use of PC400 Datalogger Support Software and CR Basic Editor. The PC400 Datalogger support software serves several functions. First of all, it enables the user to send program code and retrieve data from the unit via USB interface with a Windows computer. It also lets the user set the internal clock of the CR6 easily. With the Windows program, publicly declared variables can be read in real time from the device via the USB cable to ease the process of debugging. Unfortunately, the software does not support debugging with the use of common tools such as breakpoints and memory access. The lack of such tools does increase development time significantly and should be taken into account when planning development of future system functions.
The CR Basic editor lets the user write programs for the CR6 device. The editor has a built-in compile function that will check for faults such as syntax errors and incorrect memory allocation, but the program is recompiled on the CR6 device after it has been transferred to the device. The file extension of the programs that are sent to the CR6 is “.CR6”. The CR Basic programming language is based on BASIC, which is a programming language that was released in 1964.
The operating system (OS) on the CR6 automatically runs the program when the device is turned on. Only one program can run, and a program can only have one thread. Hence, the OS does not have the characteristics associated with a real-time operating system (RTOS). That does restrict the number of options for implementation of the system functions, but it could be positive for future developers who are not accustomed to the particularities of RTOS. A CR Basic program consists of one file only and has the following form:
1. Definition of constants
2. Declaration of global variables
3. Definition of data tables for logging of data
4. Definition of user functions
5. Program code that runs at power on
6. Program code that runs sequentially at fixed frequency
CR Basic supports programming functionality such as Loops, conditional statements, and functions. The language does not support object-oriented functionality and does not let the user define classes or even structures as found in c++ and c.
It is important to note that there are two different compile modes to choose from: Sequential mode and pipeline mode. In sequential mode, the program runs one thread sequentially. The thread is restarted at a specified time interval. In pipeline mode, the program will sample incoming data at a given interval, as it does in sequential mode. However, if the processing of data cannot be completed within the time frame, it will be stored in a buffer, and an attempt will be made to process after the next data sampling instance.