Acquisition Control Software

The Control GUI is written in C++ using the QT framework (see Doxygen documentation) to provide a user interface for control of the data capture process. This has been designed to allow control of individual channels, calibration, programmed data capture (using the ADC Once command) and independent data capture in which the DAU may be disconnected from the PC and reconnected later for data retrieval. Refer to the detailed manual for more information.

If an unprogrammed microcontroller is inserted into the microprocessor module, it must be programmed through the SPI interface with either a bootloader or directly with the DAU firmware. In the former case a serial programmer (see for example the Serial Programmer) must then be used to load the DAU firmware through the serial interface. The DAU is then ready to be configured. When the Control program is run, it first synchronises the serial interface and then checks to see if the DAU has been configured. Different screens are displayed depending on whether or not this is the case.

Microcontroller Module Configuration


The DAU configuration window provides a set of configuration items to identify the microcontroller used, the amount of EEPROM and SRAM and information about the external EEPROM. This is used by the DAU to manage storage of the captured data.  Some of this is filled in automatically depending on the microcontroller type. Settings for the Real Time Clock may also be made. The latter is needed by the DAU to set the clock precision and normally should be left at the default value. The external EEPROM size must reflect the size of the installed chip on the microcontroller board.

The Program button causes a basic Unit Information Block to be written to the DAU. No channels are defined at this point.

This dialogue can be re-entered at a later time from the main window. It includes a Save and Load button for the current configuration, and a Repair button to fix certain configuration problems that can occur.

Main Window


The DAU main window provides access to two Channel Control dialogues and also allows an independent data capture process to be launched. This process is independent of the nature of the channels and so can in principle be used with any type of data capture. If the Unit Information Block has not been programmed with channel information, the Channel buttons lead to a configuration and calibration screen. Note that if no channels are defined, the second channel button is not shown. The above screenshot shows the situation that is seen when only Channel A has been calibrated. It is envisioned that different channels types may be defined.

To launch a
n independent data capture process, open a file for saving the results. If the file selected does not exist, it is created, otherwise it is re-opened for append writes, that is, any further data saved is added to the end of the file.

The channels involved in the data capture are first setup with information about how the data capture is to be done for that channel. Information such as channel gain must be specified in the Channel Control dialogues. If this is not done, then no data capture will occur for the particular channel and any results written to the save file will be zero.

On the main window the amount of averaging to be done is selected, as well as the number of conversions to take place and the interval between the samples in seconds. In the event that the EEPROM in the DAU fills with data, a choice can be made whether the acquisition stops or whether it overwrites earliest data. Two check boxes allow either or both channels to be included, although a channel will only be included if it has been "setup" in the channel control window. Once that has been completed, the launch button may be pressed. This causes the channel control information (including an offset measurement) and the entire Unit Information Block to be written to the save file, as well as the exact time the launch was activated. Once the process has been set running in the DAU, it cannot be relaunched. An abort button is provided to allow this to be stopped if necessary.

The "Get Data" button that allows data to be downloaded will request the EEPROM buffer pointers from the DAU, a command that causes the pointers to be subsequently reset (to free up space in the buffer and so extend the data capture process). Then the data between the start and end pointers is downloaded and saved to the file.

There is a possibility that the DAU may lose power and be reset. In that event the start and end pointers will be invalid and the stored data would be difficult to access. By selecting "Offline Mode", the start and end pointers that had been saved in the DAU at the time of power failure can be retrieved from the EEPROM and used to recover the data.

Channel Calibration Window


If a channel has not been defined in the DAU, a Channel Calibration Window is presented when a channel button is pressed (this can also be accessed from the Channel Control window). This allows the channel characteristics to be placed in the Unit Information Block. For the analogue modules a certain amount of calibration can be done.

To perform a calibration, a fixed and known dc voltage source is connected to the analogue channel inputs (beware of limits set by the hardware). Its value is entered into the "Actual Voltage" box. Then with the attenuator and gain settings selected appropriately, a measurement is performed by pressing the measure button. The result is shown in the "Measured Voltage" box
(the standard deviation is also shown). When this is considered to be reasonably stable the calibrate button is pressed. Pressing the measure button again should show the true voltage measurement. The settings used during the calibration are shown underneath these buttons. The radio buttons allow gain to be selected, while the attenuation radio buttons show the position of the attenuation front panel switch. In between these groups of radio buttons is a set of checkboxes showing what has been successfully calibrated. The unity attenuation switch setting is shown as calibrated by default (this should normally represent no attenuation). For the first calibration the gain setting is calibrated. The gain 1 checkbox is then automatically checked. The front panel switch can be changed to the next setting, or the gain setting can be changed. As long as one of the setting selections has already been calibrated, the other setting will be calibrated by this process. The program will not perform a calibration in the event that both selections have been calibrated, or neither of the selections have been calibrated.

The "Base Attenuation" edit box allows a scaling factor to be incorporated into the gain and attenuation calibrations so that they line up more closely with the nominal values shown in the headings. The value of 12 shown corresponds to the built-in attenuation in the module that converts the 30V range out of the instrumentation amplifer to the 2.5V range of the A/D converter. The "Scale Factor" edit box has the voltage range that corresponds to the full scale of the A/D converter.

The "Set Nominal Value" edit box allows the nominal values of the gains and attenuations to be set. These values are stored in the DAU Unit Information Block, and are used to set the headings on the gain and attenuation checkboxes. The buttons "Set Gain" and "Set Atten" are used to set these values for the given selection of gain and attenuation switch.

Channel Control Window


This window allows the user to perform direct A/D conversions, either singly (averaged) through the "Acquire" button, or with a series of timed conversions similar to the independent acquisition process launched in the main window. In this case however the program performs the timing and uses single conversions to capture the data. Data is written directly to the save file as it is processed. The averaging is defined at the top of the screen. The meanings of the different buttons are the same as those described above for the independent data capture process.

The setup button is used to define the nature of the channel control to be used during an independent data capture process. The only controls provided here are the gain setting and a checkbox to specify that an offset calibration be performed before the process begins. These settings must be selected before the Setup button is clicked, although they may be changed later by pressing the Setup button again.

Advanced Module Configuration


From the Main Window the Module Configuration dialogue may be re-entered at any time. Once the channels have been calibrated, it is  good idea to save the configuration in case it later becomes corrupted or wiped from the DAU (which can happen after new firmware has been uploaded). The configuration is saved in a local file .acqinfoblock.txt If the program detects that this file is present, a Load button will appear.

If the EEPROM becomes corrupt for any reason a set of line edits will appear that will allow the length of each defined channel to be specified. Also the number of channels can be changed. A Repair button will appear to allow a corrected Information Block to be written to the DAU. Note that the Save button has disappeared as it is inappropriate where the Information Block is corrupted. This feature requires a knowledge of the structure of the Information Block and will probably never be needed, but it was found useful in certain cases of EEPROM corruption. It is much simpler to use the Save/Load buttons to ensure that the configuration is available for reloading at any time.

This dialogue is part of the acquisition libraries and is available to other applications.

Save File Data Format

The save file format used in the independent data capture is an ASCII format representing the DAU EEPROM capture data in its raw binary form. This was chosen because the type of channel and hence the meaning of the data may differ from the particular analogue implementation used here. Note that the save file created from the Channel Control window has a fully interpreted format, giving data in the form of time of capture followed by average and standard deviation in volts.

At the top of the file is the time that the conversion process was launched, given as a date and time separated by "T". Then follows:
  1. the channel control word in which bits 0-1 represent the gain setting (0-3). The other bits should be masked out.
  2. The least significant byte of the voltage offset.
  3. The most significant byte of the voltage offset.
This is repeated for each channel. The raw offset is computed by multiplying the second byte by 256 and adding the first.

The next line has the real time clock interval in milliseconds, and the number of samples requested.

Following this line is the entire Unit Information Block that contains details on gain and attenuation used for each channel, and the real time clock scaling factor. Details of this are given in the full document.

The data is represented as a count of real time clock ticks, and the raw averaged A/D conversion result for each of the two channels.

The actual time for each conversion is computed by multiplying the conversion time with the milliseconds per clock tick and adding to the start time. The channel voltage measurement is found by multiplying the difference between the measured raw value and the offset, with a scaling factor:

scale*attenuation/1024/gain

Where scale is the voltage scale that gives full scale output from the A/D converter (30V in our example). Note we are assuming the use of a 10 bit A/D converter here. This and attenuation and gain are obtained directly from the Unit Information Block. The attenuation and gain are expressed as a 16 bit floating point number with the following form. The top four bits represent a positive exponent power of 10, and the lower 12 bits are a mantissa. Simply form the mantissa by masking out the upper four bits, and dividing by 4096, then multiply by 10 to the exponent power.

Installation

To install the software, unpack into a directory which by default will be acquisition-pc. Also unpack acquisition-lib into the same top level directory as acquisition-pc. The serial device used (/dev/ttyUSB0 in Linux) is specified in acqunit.h and refers to a USB port for use with a USB to serial converter. Install the serial programmer software as described, including qextserialport, making sure that all the source directories are under the same top directory (otherwise the .pro files will need to be changed). This will provide the firmware upload features of the program.

Change into the acquisition-pc directory and execute:

$ qmake-qt4
$ make clean
$ make

This will build the application. Copy the binary to a suitable place and invoke with:

$sudo acquisitioncontrol

Changes

To be able to reuse some of the code with other projects, extensive changes were made to the DAU class libraries and the API. A channel class was defined as a separate class, subclassed from the basic unit class, and from which customised channel types can be subclassed. Most common operations have been placed in the basic channel class. Also some additional parameters were defined for some of the AVR interface functions to generalise them. An application specific function was defined to allow internal variables to be passed back to the PC control program. This function enforces a format for communication of variables, but the meaning and number of variables passed is not defined.


First created
21 July 2007
Last Modified 24 April 2010