the "counts" value:  how it's measured and what it means

The CCD is essentially a device that converts incoming photons to electrons that remain temporarily attached to the pixel until the exposure to light ends.  At this point a process which systematically measures the electric charge confined to each pixel begins.  Each pixel in the CCD array has associated with it a "counts" value that represents the number of electrons produced on that pixel during the charge-measuring process.  In an ideal CCD, each incoming photon would produce one electron.  Present-day CCDs are close to realizing this ideal, with quantum efficiencies that range from 0.5 to nearly
1 in the visible range of wavelengths.

The process of converting the photons to electrons and then counting the charge is complicated, although the explanation is often simplified by calling it an example of the "photoelectric effect."  It is not the classical  photoelectric effect (wherein a photon incident on the surface of a metal released an electron from the metal through an exchange of energy), although there are some similarities.

A CCD is composed of a MOS (metal oxide semiconductor).
Voltage gates are used to trap these electrons on the pixel element until it is time to measure the charge.

measuring the charge

At the bottom of a CCD array is a horizontal register; it is a row of pixels (with as many columns as in the CCD) which facilitates the charge measurement.  At the end of this row is special pixel (let's say at the right end of the row) where the charge is actually measured.  By changing the voltage differences across the boundaries of the rows and columns of pixels in the CCD, each pixel's charge is moved, as a unit, until it ends up at this special pixel where the charge is counted.  First the bottom row of the CCD array is moved to the register row, with the column position of each pixel's charge remaining the same.  (Subsequently, each row's line array of pixel charges is moved down by one row, with the column position of each pixel's charge remaining the same.)  At the right end of the register row is a special cell pixel on which all charge measuring is done.  (This measuring cell contains a capacitor of known capacitance, C.  As each pixel packet of charge is deposited on the capacitor, the voltage difference DV across the capacitor is measured.  The charge can be calculated from Q =  C DV.)  Each pixel charge in the register row is moved, as a unit, rightward until it ends up on this special measuring pixel.  This system of moving rows of charge units vertically downward, and then horizontally can be likened to a system of conveyor belts.  After each new pixel packet of charge is moved to the measuring cell and measured, the value of the charge (in units of the electron charge, and therefore, always an integer) is sent to a memory storage device.

The number of counts registered in a pixel can be written as

    C    =    fphotonp Rlc2  QE  texp


 fphoton    =  the photon flux (photons per square area per time) received by the pixel;
                   this "received" photon flux if proportional to the luminosity of the astronomical
                   object divided by 4 p d2  (where d  is the distance of the telescope from the
                   astronomical object) divided by the average energy of the photon that makes
                   it through the filter used in the telescope

p Rlc2       =  the area of the light collector in the telescope (often called the objective);
                   an 8-inch telescope has a light collector (typically a mirror) that has a radius
                   of 8 inches

QE           =  is the quantum efficiency of the CCD at the wavelengths appropriate to the
                   filter being used with the telescope/CCD; it represents the ratio of the
                   number of electrons produced to the number of incoming photons

texp         =  is the exposure time