Programming the PIC Microcontroller with MBasic

Although hand-sent Morse code may be archaic, it's still an interesting and important part of the hobby of Amateur Radio. We're going to build an electronic keyer to simplify the task of sending Morse code. Even if you have no interest in Morse code, don't skip this chapter, as we'll delve into decoding variable length codes using a binary weighted tree and learn a few other useful techniques as well.
A keyer translates contact closures from a paddle into perfectly formed and spaced dots, dashes and spaces. Spaces? Yes, spaces. Spaces the idle time between dots and dashes and between letters and words are as important as the dot and dash elements in sending and receiving Morse.
A paddle, as illustrated in Figure 26-1 is nothing more than a pair of single-pole, single throw switches, operated by pressing one lever or the other. And, since the switches of the Figure 26-1 paddle are independent, both may be closed at once. Pressing one lever sends dots, pressing the other sends dashes and pressing both sends alternating dots and dashes. (The first lever closed determines whether the first element sent is a dot or a dash.) The ability to automatically send alternating dots and dashes by squeezing both paddle levers is known in ham radio terminology as iambic keying and the paddle of Figure 26-1 is an iambic paddle. The term iambic comes from the word iamb used to describe alternating short and long syllables in poetry. From eighth grade...