
274 CHAPTER 16. PROJECT 7: BPSK DIGITAL TRANSMITTERS
6. (Line 6): Declares and initializes the cosine variable that contains all of the possible
LO’s values for a 12 kHz cosine carrier.
7. (Line 7) Declares the BPSK modulator’s output value.
The algorithm section of the code is shown in Listing 16.4.
Listing 16.4: Algorithm portion of the rectangular BPSK project code.
1 // I added my rectangular BPSK routine here
if ( counter == 0 ) { // time for a new bit
3 symbol = rand () & 1; // equivalent to rand () % 2
x = data [ symbol ]; // table lookup of next data value
5 }
7 output = x∗cosine [ counter &3]; // calculate the output value
9 if ( counter == (