SX Morse Code Keyer
By Guenther Daubach
Im Eulenflug 25
D-51399 Burscheid, Germany
This application makes use of an SX Controller to build a Morse Code Keyer
with the following features:
Accepts "Paddle-Type" or "Squeeze-Type" input devices
Automatically sends two pre-defined messages,
a repeating message like "cq cq cq de <callsign> <callsign> <callsingn>",
and a terminating message, like "ar pse k".
The tempo can be adjusted via a potentiometer.
The schematic below shows the required external components:
If you are using an SX-Key Demo Board from Parallax,
the required components are already in place.
To read the speed potentiometer,
this application makes use of the bitstream ADC VP published by Ubicom and Parallax.
The LED at RB6 is optional; it gives optical feedback as it is toggled according
to the generated Morse code.
RB6 is also used to drive an external circuit that keys the transmitter.
If connected to RB7, the piezo speaker provides an acoustic feedback.
As most transmitters generate their own monitor tones,
you might consider to not install the speaker.
You may also add a switch to turn the speaker on or off.
RB0 is the "Dot" input, i.e. when this pin is pulled low,
a short "Dot" signal will be generated,
followed by a pause of the same length.
As long as the line is held low,
"Dots" and pauses will be repeated.
When RB1, the "Dash" input is pulled low,
a "Dash" signal will be generated,
that is three times longer than a "Dot".
Again, a pause of one dot-length follows each "Dash".
As long as the line is held low,
"Dashes" and pauses will be repeated.
When you use a "Paddle-Type" input device,
either the "Dot" or the "Dash" input can be low.
If you use a "Squeeze-Type" device instead,
either the "Dot", the "Dash", or both inputs can be low at a time.
When both inputs are low, the "Dot" input has higher priority,
i.e. "Dots" will be generated as long as it is low.
When the line is released while the "Dash" line is still low,
the system will continue sending "Dashes".
If you pull the "Dot" line low,
while the "Dash" line is low,
"Dots" will be generated again.
If you press the "CQ" button, the CQ message,
e.g. "cq cq cq de dk4tt dk4tt dk4tt" will be continuously sent and repeated.
When you press the "AR" button while the CQ message is being sent,
this message will be completed, and then the AR message,
e.g. "ar pse k" will be sent once, before the system enters into idle mode.
Pressing the "AR" button when the CQ message is not currently being sent,
starts the transmission of one AR message before the system goes back to idle.
You can stop any automated message by pulling low the "Dot" or "Dash" lines.
In this case, the message is interrupted after having completed the current character,
the system sends a "Dot" or "Dash" (depending on what line went low),
and returns to idle mode, i.e. it continues monitoring the RB3…0 input lines.
In this application, the mainline program initializes the ports and some registers,
and then enters into a loop that handles sending pre-defined messages.
It also handles the button-down and Morse-key device events
but it does not read the associated input lines.
Instead, it evaluates the states of the flags eventually set
by the ISR which actually reads the input lines.
The ISR runs the ADC VP that is used to read the current setting
of the speed potentiometer.
The ISR also polls the input lines at Port B,
and takes care of the necessary timing to generate "Dots", "Dashes",
pauses, and the audio signal for the piezo speaker.
The timer part of the ISR is designed as a state engine.
Depending on the value of the State variable,
various parts of the ISR code are executed.
As pauses, "Dots", and "Dashes" also require a time delay
with the only difference that "Dots" and "Dashes" must control the output signal,
and also must generate the audio signal for the speaker, bit Status.7 has a
special meaning. If this bit is set, "Dots" or "Dashes" are sent,
i.e. the speaker and output lines will be activated in this case.
The two pre-defined messages (the CQ and the AR message)
are stored in program memory.
The program uses the iread instruction to read items from those tables.
As Morse code characters have variable lengths, the first four bits of a table entry
are used to specify the total number of "Dots" and "Dashes" for each character.
The remaining eight bits contain the Morse code pattern.
Each "Dot" is represented by a 0-bit, and each "Dash" is represented by a 1-bit.
The "Dash" and "Dot" codes are arranged from "left" to "right",
i.e. the first code element is located at bit 7,
the second one at bit 6, etc.
When a Morse character has less than eight "Dashes"
and "Dots", the remaining lower bits are cleared.
To either indicate a pause of five dot-lengths or the end of a message,
the upper four bits of a table entry are cleared.
When the lower eight bits are also cleared,
this means that the end of the table has been reached.
If the lower eight bits contain %00000001,
a pause of five dot-lengths will be generated instead.
The ADC VP used here, returns a result from 0 through 255
for an input voltage between 0 and 5 V.
Using this full range to setup the Speed timer would result
in extremely high and low Morse speeds when the potentiometer is turned to
its two end-positions. In addition, when you use a linear potentiometer,
the speed variation is very sensitive at higher speeds.
Therefore, we use a table in order to convert the ADC value (0…255)
into a range from 32 through 160 and to "flatten" the potentiometer curve
at higher speed values.
|SX28 500KHz DDS 신호발생기|
|SX28 Video OSD Module|