Skip to main content

Digital/analog signals, Gray and Excess-3 codes

Short answer

An analog signal is continuous in time and amplitude; a digital signal has discrete values (usually 0,1). Gray code is unweighted, successive values differ by one bit (e.g., binary 1011 → Gray 1110). Excess‑3 code adds 3 to each decimal digit and encodes it in 4 bits; it is self‑complementing (e.g., 27 → 0101 1010).

Define Digital and analog Signal, Explain Gray and Excess 3 code with example.

Analog signal

An analog signal is a continuous signal that can take any value within a range at every instant of time, e.g. a sine wave, voice from a microphone, or temperature from a thermocouple.

Digital signal

A digital signal takes only a finite number of discrete values (usually two: 0 and 1) and changes only at discrete instants, e.g. the clock or data in a computer.

 Analog :   /\    /\        Digital:  _   __    _
           /  \  /  \                | | |  |  | |
          /    \/    \             __| |_|  |__| |__

Gray code

Gray code is an unweighted, reflected binary code in which consecutive numbers differ in only one bit.

DecimalBinaryGray
0000000
1001001
2010011
3011010
4100110
5101111
6110101
7111100

Binary to Gray: keep MSB, then Gi=Bi+1⊕BiG_i = B_{i+1} \oplus B_i. Example: (1011)2(1011)_2 → 1, 1⊕0 = 1, 0⊕1 = 1, 1⊕1 = 0 → (1110)Gray(1110)_{Gray}. Used in shaft encoders and K-maps.

Excess-3 code

Excess-3 is an unweighted BCD code where each decimal digit is coded as the binary of digit + 3.

Decimal01259
XS-300110100010110001100

Example: (27)10(27)_{10} → 2+3 = 5 → 0101, 7+3 = 10 → 1010 → (0101 1010)XS−3(0101\ 1010)_{XS-3}. It is self-complementing: inverting the bits gives the 9's complement (e.g. 2 = 0101 → 1010 = 7 = 9 − 2).

✓ Answer checked by Claude Opus 5.5 (high effort)

All Digital Logic chapter 1 questions →