Using analog-to-digital inputs with TV6

A. C. Finnefrock

Jan 17, 2001
version 0.1

This document describes how to use load arbitrary analog voltage inputs into TV6, read them from the command prompt, and then how to find them from the TIFF headers later.

1  Hardware Setup

You need two hardware components: the internal data acquisition card, and a patch panel box. The internal card is a Advantech PCL 818 D/A, A/D card that reads at rates up to 100kHz. (Note: this card has now been superseded by the PCL 818H, which seems to retain the same functionality and programming commands.)

The outputs of the card are connected through two PC-slots to four serial-type connectors labelled I, II, III, IV. These connect to the corresponding ports in the back of the rack-mountable patch-panel. This feeds through to BNC connectors on the front. Although there is only panel in existence, another could be easily constructed.

2  TV6 Setup

Before running TV6, check the file in the TV6 directory (C:\TV62K presently) named default.tbl.

It should contain the lines:

  FIXME (ACF 2001-01-17)

3  Within TV6

Within TV6, you can interactively check the voltage levels and set the appropriate ranges for the analog-to-digital conversion. Full information can be found by typing help atod. The two modes are

atod channel_number range_number

to set the voltage ranges, and

atod channel_number

to read a voltage value. The correlation between voltage ranges and range_number is given in the help file.

At the CHESS D1 station, the connections are presently set for I0, I1, Imono, Iprot in channels 0 ... 3, respectively. You should check these, because they could be changed by another user. You are also welcome to switch them for your own nefarious purposes. If possible, please label the patch cables for your and the next users' convenience.

The VtoF (voltage to frequency) CAMAC modules at CHESS typically accept a 0-10V range, which then becomes TTL pulses. So the ion chambers will be set up to give no more than a 10V signal. For this reason, the default range for atod is also set at 0-10V (range_number = 4)

Samples are taken approximately every second. The output of the atod command will show ``mon'' (monitor) and ``avg'' (average) values, which are respectively the most recent value and the average value.

4  TIFF headers

None of this is terribly useful, except that TV6 records the same A/D values in each image file. TV6 image files are TIFF files with the data given by 16-bit (unsigned or signed) integers. Additional information about each exposure is given by TIFF ``tags'' in the header, following the standard TIFF specification. Besides the usual tags, TIFF also uses extra tags for information specific to taking data from a CCD. These are given in the following excerpt of C code. Standalone C source code is also available from the Gruner group (see me or Gil Toombes) for parsing these extra tags.


// Non-standard Tiff Tag Numbers.  Standard in struct tagname
#define NUM_EXPOSURE_TAG         0x9001  // long
#define NUM_BACKGROUND_TAG       0x9002  // long
#define EXPOSURE_TIME_TAG        0x9003  // long
#define BACKGROUND_TIME_TAG      0x9004  // long
#define SUB_BPP_TAG              0x9009  // long
#define SUB_WIDE_TAG             0x900a  // long
#define SUB_HIGH_TAG             0x900b  // long
#define BLACK_LEVEL_TAG          0x900c  // float
#define DARK_CURRENT_TAG         0x900d  // float
#define READ_NOISE_TAG           0x900e  // float 
#define DARK_CURRENT_NOISE_TAG   0x900f  // float
#define BEAM_MONITOR_TAG         0x9010  // float
#define USER_VARIABLES_TAG       0x9100  // long array

The A/D values are stored as consecutive long integers in the USER_VARIABLES_TAG field.

5  Acknowledgements

TV6 was written by Sol Gruner, Eric Eikenberry, and Mark Tate. Mark demonstrated to me all the TV6 steps in this document. Any errors are my responsibility.


File translated from TEX by TTH, version 2.60.
On 17 Jan 2001, 00:43.