“A” lenses have 6 pins, 5 to communicate min/max aperture (actually they tell the wide open aperture and the number of f-stops that can be closed down), and 1 retractable to tell if the lens is in the “A” position. If not in the “A” position then it behaves as a “K” or “M” lens. These pins are binary (contacting or non-contacting) and the bit pattern indicate the values. See this for details
Features and Operation of the Ka Mount
Modern lenses (F, FA and DA) have an additional pin that transmits digital data from the embedded chip in the lens including focal length, focusing distance, lens corrections, etc.
The aperture level on Pentax “A” and later lenses moves linearly with the area of the iris so if a lens has a range of 5 stops, 1/5 movement is one stop. The older lenses (K and M) move the level linearly with the diameter of the iris and will result is exposure errors if converted. On un-crippled mounts, the lens tells the camera through another lever, how far has been closed down from wide open. This level changes position as you rotate the aperture ring. The camera’s exposure system measures always wide-open and uses the info from the secondary level to compensate. There is no need to know the exact wide-open f-stop; just measure and adjust.
While focusing, the body keeps the aperture lever push all the way to keep the lens wide open. When taking the picture, the body’s release mechanism let the level move all the way for K and M lenses or to a predefined position for A, F, FA and DA lenses. Lenses with aperture rings set to a value (not the “A” position) will close down to the set aperture on the lens.
On an “A” lens (50mm F1.7) when you set F8 in the camera, it knows that the lens is F1.7 wide open and can go to F22 for 7.5 f-stop range. F8 is 4.5 f-stops from wide open or 60% in the f-range. The body’s release mechanism will move the aperture lever activator to the 60% position of its range and that will correspond to the correct F-stop on the lens.