You must be prepared to demonstrate Part 1 of your work during your laboratory session on Tuesday, November 3, and Part 2 of your work during your laboratory session on Thursday, November 5. This part of the assignment is worth 35 points.
Morse code is a representation of the letters, digits and punctuation characters by sequences of short and long bursts of tone. It was originally developed for transmission over telegraph lines, and was later used for radio transmission. Although its use has diminished with time, proficiency is still a requirement for most amateur radio operator's licenses. An interesting sidelight is that Morse code identification is transmitted by radio navigation aids used by aircraft, and until recently Morse code proficiency was required for instrument-rated pilots in Australia.
The basic timing element of Morse code is called a unit, and is the length of the short burst of tone. The long burst of tone has a length of three units, and the silence between tone bursts has a length of one unit. A minimum of three units of silence separates characters, and a minimum of seven units of silence separates words.
Morse code transmission rates are measured in words per minute, with the ``standard'' word being ``Paris''. In other words, a speed of 20 words per minute involves transmitting ``Paris'' 20 times in one minute. In the table below, a short burst of tone is represented by a dot and a long burst of tone is represented by a dash. If we count the units making up the word ``Paris'', including all of the silences, we find that there are 52. Thus a code speed of 20 words per minute involves transmission of 1040 units per minute.
When one is learning Morse code, it is extremely important to realize that it is an audible, not a written form of communication. You cannot achieve any reasonable proficiency by learning the patterns of dots and dashes given in the table below. Instead, you must learn the sound of the character, just as you learn the sound of a song. When learning code, the standard audible presentation of each character is the sound that character would have if the message were being transmitted at 20 words per minute. This standard requires that the length of a unit be about 58 milliseconds (1040 units per minute). The period of silence between characters is adjusted to produce a transmission rate compatible with the student's proficiency.
The frequency of the tone used for the short and long bursts is somewhere in the 800-1000 Hz (cycles per second) range. If the tone were exactly 1000 Hz, then each cycle would require 1 millisecond and a short burst of tone for code practice would consist of 58 cycles.
| A: .- | J: .--- | S: ... |
| B: -... | K: -.- | T: - |
| C: -.-. | L: .-.. | U: ..- |
| D: -.. | M: -- | V: ...- |
| E: . | N: -. | W: .-- |
| F: ..-. | O: --- | X: -..- |
| G: --. | P: .--. | Y: -.-- |
| H: .... | Q: --.- | Z: --.. |
| I: .. | R: .-. |
Your program must accumulate a complete line of text (which might, of course, be only a single character) before doing any translation. It should then output the Morse code for the entire line. You may place a 136-character limit on input line length, and it is up to you whether you allow editing by means of backspace characters.
The Morse code output for a line should conform to the specifications given above with respect to tone frequency and character timing. It must provide the appropriate separation between characters and between words. Remember that the lengths of the silences are tied to length of a unit, which is the time it takes to output a short tone burst. One easy way to create a silence of the appropriate length is to design the output routine to take the D/A converter address as a parameter. When you want to hear a tone, supply the correct D/A converter address as the argument; when you want to hear silence, supply an address that isn't connected to anything.
This part of the assignment requires you to make several important design decisions:
A different approach is to use a counter/timer device to specify when a new sample is to be written to the D/A converter. A counter/timer can be set to periodically interrupt the processor. The counter/timer interrupt handler can then write the next sample to the D/A converter. With this approach, the only constraint is that there be sufficient time between interrupts to execute the handler code.
When you use an interrupt to indicate that a sample should be written to the D/A converter, a relatively large number of instructions must be executed between successive samples: Not only must the interrupt, the handler, and the return be executed, but also there must be some time for the computer to do other work. If the frequency of the output tone is to be preserved, the number of samples making up the sinusoid must be reduced. In fact, we want to minimize the number of samples in order to maximize the time that the computer can spend on other tasks. As noted in the previous assignment, we should be able to reduce the number of samples in a single cycle of the sinusoid to 20 without seriously degrading the quality of the tone.
Detailed information about the behavior and programming of the MB5's
counter/timers can be found by following this
link.
The counter.ah file
defines symbols that reference the counters and the counter command register.
Counter 0 is referenced by the symbol CT0,
counter 1 by CT1, and
counter 2 by CT2.
The counter command register is reference by the symbol
CTCMD.
Task (Part 2)
Change the output module of your Morse code translator to use a
counter/timer interrupt to control output of samples to the D/A converter;
the specifications for the program's behavior remain unchanged.
Click here for a zip file containing file
counter.ah.
You will have to write code to enable and disable interrupts
and install an interrupt handler for whichever counter/timer
you choose to use.
Operations that enable and disable interrupts have similar implementations,
regardless of the particular interrupts involved.
Thus the routines used to enable and disable
UART interrupts can serve as guidelines for the corresponding routines in
this module.
In addition to enabling and disabling interrupts, you must write code
to initialize the counter with a value to obtain the proper
spacing between samples and set the counter's mode of operation.
Questions
None of these questions depends on details of the final code;
you do not have to complete the assignment to answer them.
| Instructor | Revision $Revision: 1.34 $ ($Date: 2007/08/27 00:15:44 $) |