ccp is the camera control program. It runs on a dedicated computer (quest7) that handles all direct communications with the camera and camera shutter. The main function of ccp is to buffer the image data in memory and to send it to the front-end computer (quest16) using a internet socket on a dedicated gigabit fiber connection. The front-end computer handles data storage, analysis, and display. Character commands can be sent to ccp over a second socket conection. The program also uploads the bias configuration for the camera electronics and reads back the ADCs that monitor these voltages.
Startup syntax:
ccp [-v] where -v is an option for verbose messaging.
ccp configuration file - ccp.conf:
On startup, ccp reads file ccp.conf. This initialized important variables, such as the name of the host computer and the name of the computer that will be receiving data. The names of other important files are declared here, also the size of the ring buffer used to store data, and the allowable ranges of important variables.
ccp log file - ccp.log:
File ccp.log is created at startup (erasing any previous file of the
same name). It
records all commands sent to ccp (except STATUS) and the replies that
are returned.
Operating System:
ccp will run under RedHat 6.2. This version supports the hardware driver for the EDT camera (EDTPDV version 2.0) and National Instruments card (comedi-0.7.59 and comedilib-0.7.16) discussed below. A later version of the EDT driver was tested with RedHat 7.1 and failed to function correctly. Simulated operation of ccp will work on later versions of RedHat (e.g. 7.2).
Socket Communication:
ccp communicates over two sockets: one for receiving and replying to commands and one for sending image data (port numbers CCP_COMMAND_PORT and CCP_DATA_PORT declared in file ccp.h). ccp listens for connections on the command port, reads ASCII commands (see listing below) and replies with short ASCII strings ending with a "DONE" message. Whenever a scan or readout of the camera is initiated, there must be a program accepting socket connections on the data port and ready to receive the binary data stream as it is ascquired. The data is sent in fixed blocks of byte length = (CAMERA_PIXELS_PER_LINE / horizontal_binning) + RING_HEADER_SIZE + RING_TRAILER_SIZE, where CAMERA_PIXELS_PER_LINE is declared in file ccp.conf (see below), RING_HEADER_SIZE and RING_TRAILER_SIZE are declared in file ccp.h, and horizontal_binning is variable.
Line format:
[HEADER(8 bytes)] [PIXEL DATA(143360 bytes)] [TRAILER(2 bytes)]
where HEADER = [4-byte line
count] [28-bit dropmask][4-bit binning code]
PIXEL DATA =
640*112 16-bit pixels (BigEndian - hi/lo hi/lo)
TRAILER
= ODOD Hex
dropmask (bits 0 to 27) correspond to the drop state of positions
1 to 28 on the CCD array
(value 0 for no dropped line, 1 for a dropped line).
binning code (bits 0 to 3):
bit 0:
0 for no serial binning, 1 for 2-pixel binning.
1: 0 for normal serial clocking, 1 for no serial clocking.
2: 0 for no parallel binning, 1 for 2-pixel parallel binning.
3: 0 for normal parallel clocking, 1 for no parallel clocking.
(when binning horizontal by 2, 320 binned pixels arrive, followed by 320
dummy pixels)
cammgr and camctl:
Two additional programs, cammgr and camctl, are available to facilitate passing commands to ccp. Typically, ccp runs on a host machine isolated from network traffic and with direct connection to the camera electronics. This host machine is connected by a dedicated high-speed line to a target machine tasked to receive image data. The target machine has a separate network connection for remote access. To submit commands to ccp from any machine on the network, one first launches program camctl on machine that is sending the command. Program cammgr must also be launched on the target machine. Any command received by camctl through standard input is passed through a socket connection to cammgr which then forwards the command to ccp through another socket connection. Replies are sent backwards to camctl through the same route, and printed to standard output.
In normal opertation, it is sufficient to pipe a command to camctl, and to allow it to die after printing the reply.
Simulated operations:
To operate ccp in the absence of the camera, compile the code with "FAKE_CAMERA" and "FAKE_DROPCTR" defined in the definition file ccp.h (see below). Also, several lines must be commented and uncommented in the src Makefile. The functions of the camera will then be simulated. The simulated data consists of ramped signals, with a pattern of vertical bars that are unique to each CCD in the array.
EDT camera interface:
To receive image data from the camera, ccp uses a hardware interface provided by EDT. The hardware consists of a PCI-PDV card witha fiber link to a remote-camera interface (RCI). THe RCI is connected directly to the camera electronics. The edtpdv driver supplied by EDT is used for all communication with the PCI-PDV. THe maximum data rate is 30 MHZ (one 16-but word per cycle), or 50 MBits.
National Instruments electronics interface:
To program and read back the bias voltages applied to the CCDs by the camera electronics, ccp uese a digital IO/timer card (National Instruments 6025E). The device driver is the comedi driver (freeware). This card is also used to time the linestart signals sent to the camera electronics during a scan.
Dropcount Control:
During a scan, all CCDs rows are clocked in the parallel direction at the same time to reduce noise. However, because the clocking rate must vary with north-south position in the array, the parallel clocks are periodically dropped or blocked to increase the mean readout period. A separate, single-board computer (Logiflex) is used to manage the control lines for these drop signals. To control this computer and set drop rates, the ccp communicate with the Logiflex by an serial line connected to one of the host computers comports.
Source code definition file - ccp.h
Most of the static constants used by the ccp program (buffer sizes, socket port numbers, file names, command names, etc) are declared here. Also defined are data structures.
ccp commands:
SHUTDOWN:
Shutdown camera and cammgr and camctl programs.
INIT [period]:
Initialize camera and set scan period (usec).
This is required before each drift scan
RESET:
Reset the camera. This is only required on startup
of the camera hardware, or when there are hardware
problems.
READ [target] [n]:
Read n lines to target machine.
START [target]:
Start a scan to target machine.
STOP:
Stop a scan.
OPEN:
Open the camera shutter.
CLOSE:
Close the camera shutter.
STATUS:
Read camera status.
SET_DROPCOUNT: [col] [cnt0] [cnt] Set drop count (cnt0)
and initial counter
value (cnt) for a given column position (col).
GET_DROPCOUNT:[col]
Read drop count and current counter value for
a given column position (col).
SET_BINNING: [h] [v]
Set horizontal and vertical binning to h and v
GET_BINNING:
Get horizontal and vertical binning
GET_BIAS [fing][col][index]:
Get bias voltage of given index for CCD at fing, col
GET_BIASES [fing][col]:
Get bias voltages for CCD at fing,col