##
This **preview** shows page *1-2-3-4*
out of 11 **pages**.

*View Full Document*

End of preview. Want to read all 11 pages?

Upload your study docs or become a GradeBuddy member to access this document.

View Full Document**Unformatted text preview:**

ELEG-212 Signals and Communications Fall 2004 1/11 Lab 5: Digital Communication – FSK Modem 1 Overview The goal of this lab is to understand a simple modem, the Frequency Shift Keying (FSK) Modem, referred to by the International Telecommunications Union (I.T.U.) as V.21. The V.21 modem communicates 1’s and 0’s by sending either a 1650 Hz tone or a 1850 Hz tone, respectively, for 1/300 second. Thus the overall data rate is 300 bits/second (one bit is sent in 1/300-th of a second). Even though 300 bps is quite slow compared with the theoretical maximum of 56 kilobits per second over a phone line, the V.21 format is still used in almost every modem call. This is due to the fact that receiving and decoding it is so simple. A V.21 modem call can be received without using difficult techniques such as equalizers, cancellers and matched filters. Furthermore, it can be received accurately even in the presence of a significant amount of noise. For these reasons, V.21 is used as an initial handshake between two modems, meaning that V.21 is a way to communicate some basic startup/control information between the two modems. You can hear the V.21 modem tones at home when your V.34, V.90, V.92 phone line modem or fax machine starts a phone call. V.21 is also used to transmit caller ID information over the phone line. 1.1 Transmitter 1.1.1 Converting from Text String to Binary String An FSK modem is a digital communication system, so it transmits zeros and ones. In order to transmit messages in an alphabet, there must be a binary representation for each character in the alphabet. The standard for this representation is ASCII where eight bits are used to represent characters, numbers and special punctuation. For example, the upper-case character ’A’ is represented in ASCII with the number 65, which has an 8-bit binary form as 01000001; lower-case ’b’ is 98 in ASCII, or 01100010. Therefore, if we want to encode a message, such as ’Hello World’, for the FSK modem, we must turn the eleven characters of the message into 0’s and 1’s. Since blanks are counted as characters, we would end up with 88 bits. Given a vector of bits, we could generate the appropriate sinusoids by agreeing to the convention that 1650 Hz is used for a “1”, and 1850 Hz is used for “0”. MATLAB has some useful functions for doing ASCII conversion and also for turning decimal numbers into bits. Check out help on the following functions: CHAR Convert numeric values to character array (string) ABS Convert character array (string) to numeric values DEC2BIN Convert decimal integer to a binary string BIN2DEC Convert binary string to decimal integer Run the script char(30:50), please refer to its help to understand the result. Also, try the following MATLAB expression abs([’ABC’;’b01’]), and note that the ASCII equivalents are returned in a matrix1. To test your knowledge at this point, write a MATLAB expression that 1 In MATLAB, a string is actually an array of characters, so [’ABC’;’b01’] is a 2 × 3 array. Use size to verify this fact.ELEG-212 Signals and Communications Fall 2004 2/11 will give the binary representation for the message ’Hi!’. Use the optional argument in dec2bin to get an 8-bit string for each character (with leading zeros). Notice that, when you convert a text string into binary format, you will get a column vector, each row is an 8-bit long binary string. You may want to use MATLAB function reshape to form your binary message into one string, so that it will be easier to generate your FSK signal in the next step. Be aware that the function reshape is based on column-wise operation. By convention, we send the most significant bit of byte first2. For example, ’H’ corresponds to 01001000, and ’i’ 01101001. So, the binary string sent out should be in order 0100100001101001. 1.1.2 Generate an FSK Signal One part of the FSK encoder must take a binary bit stream and create a sinusoid for each bit. The duration of each sinusoid will determine the bit rate, e.g., 300 bits/second (bps) requires a duration of 1/300 sec. You must complete the function below and use it to generate the FSK signal. The functionality of this program is to covert a binary string into a FSK waveform consisting of dual tone sinusoids, given the sampling rate and the bit duration. The only given script in the program is to convert the input binary string to a vector containing 0’s and 1’s. function xx = fsk_gen( bitstr, fs, bdur ) %FSK_GEN generate the FSK sinusoids at 1650 and 1850 Hz % 1650 encodes a "1", 1850 encodes a "0" % % bitstr = STRING of zeros and ones. % fs = sampling rate % bdur = duration of the sinusoid for one bit % (this determine the "bit rate") % xx = synthesized FSK signal % inbits = abs(bitstr) - abs(’0’);%convert bit string to numbers %% %%%%%%%%%%%% put your code here %%%%%%%%%%%%%%%%%%% To test your function, input character ’H’, use a duration of 50 millisec, even though that is only 20 bps, because then it will be easy to identify the tones on a spectrogram. Use a sampling rate of 9000 samples/second. Make a spectrogram of the generated FSK signal in order to show how the individual bits correspond to sinusoids. Use a window length that is the default of 128. Your spectrogram plot should look like Fig. 1. Notice those vertical bars on the spectrogram plot, and try to explain the cause of it. Conceptually, what could be the solution to this problem? 2 This is called the Big-Endian convention. As expected, there is a Little-Endian convention, too. The debate on choosing one over the other has been going on for decades. Check online materials for more details.ELEG-212 Signals and Communications Fall 2004 3/11 Figure 1. The spectrogram of the FSK signal when send letter ‘H’. 1.2 Receiver The receiver for V.21 must determine which of the two tones is present, and must make this decision every 1/300-th of a second. A block diagram of the FSK V.21 demodulator is given in Fig. 2. Each of the main sections will be described in more detail below. Figure 2: Block diagram of the FSK V.21 demodulator. 1.2.1 Mixing A basic operation that most modems need to perform is frequency shifting of the input signal. According to the frequency-shifting property of the Fourier Transform, this can be done by simply multiplying the input signal by a complex exponential. 2() ()cjftwt xteπ−= This effect can best

View Full Document