Digital Signals
Before we get to a functioning computer, we must assemble its components. Before we assemble its components, we must understand Boolean logic from the computer's perspective. And before we understand the computer's perspective, we must understand what bits are. And to understand what bits are, we must study signals.
What's a Signal?
If we look at the Great Wall of China, we see that it's not just some massive, vertical wall. It has considerable thickness for people to travel along the wall. Every few meters or so, there's a large tower.
These large, protruding structures are called beacon towers. They were used for storing supplies and sheltering soldiers. But more importantly, they were used to transmit messages. When a sentinel saw intruders approaching during the day, the soldier would set smoke (if the threat occurred during the day) or light a fire (if the threat occurred at night). The sentinel in the neighboring tower would see the signal and perform the same, that tower's neighboring tower would see the signal and do the same, and that tower's neighbor, etc.
The message transmitted was simple: Smoke or fire, there was an intruder; else, just another day along the wall. This was a fairly limited form of communication. More complicated messages like
"Running low on water at tower " had to be delivered by messenger. Nevertheless, China's beacon towers present a straightforward introduction to the notion of a signal.
Mathematically, a signal is just a function What separates it from other functions, however, is what it represents: The variation of some physical quantity with respect to some parameter, most commonly time. Because it measure some physical quantity, the key characteristic of a signal is that its range is an interval — a set consisting of real numbers between some real number and a real number
For example, for the soldiers along the Great Wall, the signal can be mathematically modeled as:
We can write this more abstractly. Denote as the existence of a fire or smoke as and the nonexistence of a fire or smoke as
From this definition of a signal, we can see that many kinds of functions qualify as signals. For example, if we took temperature readings on a particular from AM to PM and found that the trendline resembled a graph the function constitutes a signal. Plug in a time, and we get back a variation of the temperature. This is the defining characteristic of a signal: it's a function that returns some object — perhaps a number, or the fact that an intruder is approaching — from an interval.
For electronics, e.g., a computer, a signal is a function representing some variation in a measurement of electricity with respect to time. That measurement could be electrical voltage or a pulse of current. For our purposes, we'll think of the measure in terms of current pulses, but really, it doesn't matter. The important point is that the measurement is one among a finite set of possible measurements.
Analog versus Digital
The terms analog and digital refer to the signal's codomain. For example, the sine function, is an analog signal. Its codomain is the interval We classify it as an analog signal because it can output infinitely many signals — there are infinitely many real numbers between and
A digital signal, however, restricts the codomain to a subset of the analog signal's codomain. For example, consider the function:
Where the frequency, is and is the time. This function results in a square wave whose graph appears as:
Notice that we've now restricted the codomain even further: The signal can only be or This is a key feature of digital signals, and it is what's used by electronic devices to make the measurements of electricity we mentioned earlier. Interpreting the graph above, the -axis is the electrical measurement — perhaps volts (units of voltage) or amperes (units of electric current) — and the -axis is time.
In essence, restricting the domain means we're restricting the number of possible outputs. And by restricting the number of possible outputs to just two — or — we enter a world where pretty much everything is black and white, true or false. This greatly reduces complexity, because now we can model everything with a switch
This single switch is called a bit. Using enough of these bits, we can implement Boolean and arithmetic operations. And from these basic operations, we can emulate memory, all the way up to a full-fledged, functioning computer.