All the codes mentioned come to a GPS receiver on a modulated carrier; therefore, it is important to understand how a modulated carrier is generated. The signal created by an electronic distance measuring (EDM) device in a total station is a good example of a modulated carrier.
Distance measurement in modern surveying is done electronically. Distance is measured as a function of the speed of light, an electromagnetic signal of stable frequency and elapsed time. Frequencies generated within an electronic distance measuring device (EDM) can be used to determine the elapsed travel time of its signal, because the signal bounces off a reflector (aka corner cube) and returns to where it started. An EDM only needs one oscillator at the point of origin, because its electromagnetic wave travels to a retroprism and is reflected back to its origination. It is a two-way system, but the EDM is both the transmitter and the receiver of the signal. On the signal's return, the EDM can analyze it and determine the distance. In general terms, the instrument can take half the time elapsed between the moment of transmission and the moment of reception, multiply by the speed of light, and find the distance between itself and the retroprism (Distance = Elapsed Time x Rate).
The fundamental elements of the calculation of the distance measured by an EDM, ρ, are the time elapsed between transmission and reception of the signal, Δt, and the speed of light, c.
Distance = ρ
Elapsed Time = Δt
Rate = c