EE-410L Communication Systems Lab · Lab 13 · read before the labAll labsGo to the lab →

Ones and zeros cannot fly. A carrier carries them.

Ten minutes of reading. Move the sliders, then the two scripts of the lab will read like plain sentences.

01

Shift keying

Digital data is a string of 1s and 0s, but an antenna or a cable can only carry a wave. Shift keying is digital modulation: one property of a sine carrier is switched between two values, one for a 1 and one for a 0. Change the amplitude and it is ASK, change the frequency and it is FSK, change the phase and it is PSK. Each bit lasts one bit time Tb (1 s in the lab code), so the bit rate is 1/Tb.

A torch and Morse code. Switching the light on and off is ASK. A red light for 1 and a green light for 0 is FSK.
02

ASK, FSK and PSK

ASKs(t) = b(t)·√(2/Tb) sin 2πfctthe carrier is on for a 1, off for a 0
FSKf1 for a 1, f0 for a 0constant amplitude
PSKphase 0 for a 1, 180° for a 0the carrier flips sign

In the lab code the ASK signal is a product: the carrier c times the message m_s, which is all ones for a 1 and all zeros for a 0, exactly what a balanced modulator does with a unipolar data stream. The FSK code builds two products, c1 times the message and c2 times the inverted message, and adds them, so exactly one carrier is present in each bit.

Which frequency for a 1? The theory gives the higher frequency to a 1. The FSK listing sends c1 (2 Hz) for a 1 and c2 (5 Hz) for a 0, the opposite. Both work if the transmitter and the receiver use the same rule.
03

The correlator receiver

Correlatorx = Σ c(t)·s(t)one number for each bit
Decisionb = 1 if x > thresholdthe decision device
For a 1x = Σ c² ≈ 100101 samples of 2 sin², in the lab code

The ASK listing demodulates with a correlator: it multiplies each received bit by the carrier and adds the samples. For a 1 the product is c², which is never negative, so the sum is large (about 100 for 101 samples). For a 0 the bit is all zeros and the sum is 0. A decision device then compares x with a threshold: the code uses x > 0. A hardware receiver does the same job by rectifying the signal, low pass filtering it and squaring it up with a comparator. For FSK a receiver correlates each bit with both carriers and chooses the larger result.

04

Noise

The lab code has no noise, so the bits always come back right. Add noise and the correlator output of a 0 is no longer exactly 0. With the threshold at 0, half of the zeros are then read as ones. A threshold half way between the two levels (about 50) is far better. ASK is sensitive to noise because a 0 is just no signal, and a fading channel can make a 1 look like a 0.

Why FSK resists noise better. Its amplitude is constant, so noise that changes the amplitude does not change the bit, and the power amplifier can run in saturation, which saves battery.
05

In the virtual lab

Scripts (.m)
Open the file→Move the sliders→Run→Read the figure→Add to report
the sliders are the boxed numbers in the code; Copy code gives the code with your values for real MATLAB

The only line added to the manual listings is rng(seed) before rand, so the same bits come back on every run and a figure can be compared. Seed default gives the same bits as MATLAB after rng('default'). In guided mode each step ticks itself when it is really done; you can also tick a step yourself with its number box.

06

What you should see

FileSettingsResult
ask.mseed default, N = 10, fc = 10 Hzbits 1 1 0 1 1 0 0 1 1 1; ten carrier cycles in each 1; the demodulated bits are the same
fsk.mseed default, N = 8, 2 Hz and 5 Hzbits 1 1 0 1 1 0 0 1; two cycles in each 1, five cycles in each 0
07

Check yourself

Q1What is shift keying?

Shift keying is digital modulation: one property of a sine carrier (amplitude, frequency or phase) is switched between fixed values according to the data bits, so each bit is sent as a short burst of carrier.

Q2Name different types of shift keying.

Amplitude shift keying (ASK, on-off keying), frequency shift keying (FSK), phase shift keying (PSK, for example BPSK and QPSK), and their combination quadrature amplitude modulation (QAM). Variants include MSK and GFSK.

Q3What is ASK?

Amplitude shift keying changes the amplitude of the carrier with the data. In its simplest form (on-off keying) the carrier is sent for a 1 and nothing is sent for a 0: s(t) = b(t)·A cos 2πfc t with b(t) equal to 0 or 1.

Q4What is FSK?

Frequency shift keying sends one carrier frequency for a 1 and another for a 0, with a constant amplitude. With the default values of the lab code a 1 is sent at 2 Hz and a 0 at 5 Hz.

Q5Explain the principle of ASK.

The unipolar data stream (0 V or 5 V) is multiplied by the carrier in a balanced modulator. A 1 multiplies the carrier by a positive constant and passes it unchanged; a 0 multiplies it by 0 and gives no output. The receiver rectifies, filters and squares up the signal, or, as in the lab code, correlates each bit with the carrier and compares the result with a threshold.

Q6What is PSK?

Phase shift keying keeps the amplitude and frequency and changes the phase of the carrier: in binary PSK the phase is 0 for a 1 and 180° for a 0, so the carrier simply changes sign. It needs a coherent receiver but has the best noise performance of the three when all are detected coherently.

Q7Write a MATLAB code for ASK.

Section 13.3 of the manual: make a carrier c = sqrt(2/Tb)*sin(2*pi*fc*t) over one bit, random bits m = rand(1,N) > 0.5, the ASK signal of each bit as c.*m_s, then demodulate with x = sum(c.*ask_sig(i,:)) and demod(i) = x > 0, and plot the bits, the message, the carrier, the ASK signal and the demodulated bits with subplot and stem.

Q8Write a MATLAB code for FSK.

Section 13.4 of the manual: two carriers c1 (fc1) and c2 (fc2) over one bit, random bits, m_s for the bit and invm_s for its inverse, fsk = c1.*m_s + c2.*invm_s, and plots of the bits, the message, both carriers and the FSK signal.

I am ready, go to the lab →