PVCAM  3.9.x
Programmable Virtual Camera Access Method library
Port and Speed Choices

The sensor in a camera will have one or more output nodes from which the pixel stream will be read. These nodes are referred to as "Readout Ports". The signal from a readout port will be passed through an analog to digital converter (ADC) in case of a CCD sensor while it will be digitized internally in case of an sCMOS sensor. The ADC (either internal or external to the sensor) operates at one or more digitization rates and has a set of parameters associated with it. In PVCAM, the choice of speed (digitization rate) and associated ADC parameters are organized into a "speed table". It is actually more a tree than a table. In some cameras, different readout ports will be connected to different analog processing chains and different ADCs. The most general method for setting up the port and speed choices is to make the speed choices dependent upon the port selection.

The table below is an example of a camera with two readout ports. "PORT 1" has one speed associated with it and "PORT 2" has three speeds. Note that the terms "PORT 1" and "PORT 2" are generic and are only being used to illustrate the example.

Please note that with CCD cameras the data bit-depth is tied to speed selection as it depends on ADC converter. With sCMOS cameras, the digitized image could be further processed, e.g. by combining data from internal low and high gains to obtain an HDR image, therefore the final bit-depth may vary. It is recommended to not cache the bit-depth as part of speed table and to always query PVCAM for its current value via PARAM_BIT_DEPTH parameter. Certain cameras may provide different bit-depths on each gain under the same speed option (e.g. Prime BSI camera provides two gains under the 100 MHz speed option where HDR gain returns images with bit-depth 16 and CMS gain returns images with bit-depth 12, see line marked as 'new' in the table below). The original approach (see line marked as 'old') still works for cameras having the same bit-depth on all gains under the same speed.

Please note that setting the port and/or speed may affect the PARAM_TEMP_SETPOINT value as the camera may need to adjust the sensor temperature based on readout configuration. In such cases, the actual sensor temperature, reflected by PARAM_TEMP, may start stabilizing to the new setpoint. Currently, this behavior is implemented for Kinetix camera models, but may also be applied for future camera models and firmware versions. It is advised to read the PARAM_TEMP_SETPOINT ATTR_CURRENT value after a change is made to port or speed configuration and re-adjust the setpoint value if custom setting is desired. If temperature control is critical, it is also recommended to observe the PARAM_TEMP value and wait for the sensor temperature to stabilize to the new setpoint.

PARAM_READOUT_PORT Index0 1
Value10 20
Name "PORT 1" "PORT 2"
PARAM_SPDTAB_INDEX 0 0 1 2
PARAM_PIX_TIME 200 ns/px10 ns/px50 ns/px100 ns/px
Calculated Frequency 5 MHz 100 MHz 20 MHz 10 MHz
PARAM_GAIN_INDEX 1 1 1 2 1 2 3
PARAM_GAIN_NAME "GAIN 1" "GAIN 1""GAIN 1""GAIN 2""GAIN 1""GAIN 2""GAIN 3"
PARAM_BIT_DEPTH (new) 16 12 12 14 12 14 16
PARAM_BIT_DEPTH (old) 16 12 14 16

Setting a unique readout option consists of setting value of PARAM_READOUT_PORT, PARAM_SPDTAB_INDEX and with the 'new' approach also PARAM_GAIN_INDEX parameters, in that exact order. The following code snippet selects the last readout option from the table above (error handling omitted):

const int32 portValue = 20; // "PORT 2"
const int16 speedIndex = 2; // 10 MHz speed
const int16 gainIndex = 3; // 16-bit "GAIN 3"
// Select unique readout option
pl_set_param(hcam, PARAM_READOUT_PORT, (void*)&portValue);
pl_set_param(hcam, PARAM_SPDTAB_INDEX, (void*)&speedIndex);
pl_set_param(hcam, PARAM_GAIN_INDEX, (void*)&gainIndex);
// Get dependent parameter values
char gainName[MAX_GAIN_NAME_LEN];
int16 bitDepth;
uns16 pixTime;
pl_get_param(hcam, PARAM_GAIN_NAME, ATTR_CURRENT, (void*)gainName);
pl_get_param(hcam, PARAM_BIT_DEPTH, ATTR_CURRENT, (void*)&bitDepth);
pl_get_param(hcam, PARAM_PIX_TIME, ATTR_CURRENT, (void*)&pixTime);
const float calcFreq = 1000.0 / pixTime; // MHz

It is the responsibility of the application to remember values associated with port, speed and gain selections. The application must resend gain value whenever user changes the current port or speed. Additionally, the application must resend the desired speed and gain whenever a readout port is changed. Read-only values, such as bit-depth, must be assumed to be unique for each port-speed-gain combination. Once a selection is made, all settings remain in effect until the user resets them or until the camera hardware is powered down or reset.

It is also highly recommended to reset the port, speed and gain to default values right after opening the camera.

Caching the values needed for port/speed/gain setting is preferred in most situations. The following steps should be taken when building a speed table: