home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HAM Radio 1
/
HamRadio.cdr
/
cw
/
cw104
/
cw.doc
next >
Wrap
Text File
|
1991-09-21
|
35KB
|
689 lines
██████ █ █
█ █ █ █
█ █ █
█ █ █ █
█ █ █ █
█ █ █ █ █
██████ ███████
Version 1.04
20 September 1991
by
Larry Winslow
W0NFU
1520 E. Verlea Dr.
Tempe, Az.
Disclaimer
There always has to be a disclaimer. This program has been written
to the best of my abilities - I've been programming computers for
27 years now so I should be pretty good at it. The program has been
extensively tested and has been found to cause no damage to files,
memory resident programs, or the computer itself. I assume no
liability if some condition arises which I have not tested for.
A brief note
This program is not free. If, after using it for a few weeks, you
find the program a benefit in your shack, a $10 contribution is
expected. Otherwise, you are expected to remove it and all of its
support files from your system. In return for your contribution, I
will provide support either via mail correspondence or phone call
(as long as you pay for the long distance charges).
Brief Description
"CW" is a versatile program which allows a PC to receive and send
Morse code for the Amateur Radio operator. Some of the more
significant features of "CW" are:
- Automatic tracking of received CW speed.
- User adjustment of parameters defining the length of the
space after a character and after a word.
- User adjustment of a programmatic filter to eliminate false
signals.
- Code transmit speed can be either locked to the speed of the
received code speed or user adjustable.
- Type ahead buffer of 4096 characters allowing user to enter
data to be sent in response to that being received.
- Ten user defined messages which can be sent.
- User definition of user call which can be sent with single
key stroke.
- Maintenance of 2 receive parameters allowing the tracking of
multiple users.
- User definition of user QTH which can be sent with a single
key stroke.
- Random code generator for practice.
- Received data can be captured to user defined file and/or to
the printer.
- User defined input file which can be sent.
- Help screen available with simple keystroke.
- Full featured Iambic keyer with dit and dah memory.
Hardware Requirements
The program requires at least 128k of available memory and 1 serial
communication port which will operate at 9600 baud. The program has
been successfully test on XT clones, AT clones and 16mhz 386SX
systems. The timing function has been designed such that it is
totally independent of the characteristics of the machine that it
is executing on. The only machine that it has failed to function
properly was a very old, true "Big Blue" XT with only a 4.77mhz
clock and that was with a very busy TSR executing; without the TSR,
the program functioned properly
Detailed Description
My interest in a computer interface for CW was prompted by the
article "ROBO-COPY" by Michael Hansen WB9DYI in the October 1990
issue of 73 magazine. The program described in the article does an
excellent job of copying CW but there was no provision for sending
code. Therefore, after obtaining the source file and a file
describing the code receive algorithm from the 73 BBS, I rewrote
the program. The original was written in C but my skills in C are
limited. Therefore, I wrote my program in QuickBasic 4.5 including
the transmit functionality. My receive algorithm is identical to
that in the C program.
The algorithm is described as "The Mean Machine". This name is not
used in a slang manner but rather the method of tracking the
incoming code. I quote Michael Hansen's description of the
algorithm.
"Before we start writing the program, we have to decide on the
algorithm (method) to be used to time the dits and dahs. How does
the computer decide that a "mark" (Mark is the presence of a
signal, either dit or dah - space is absence of the signal) falls
into the dit or dah category?
A good approach to try would be to calculate the average of some
number of marks. The average, or as it is call by statisticians,
the arithmetic mean, is calculated by adding up a number of related
values then dividing that sum by the number of values. The ARRL
tells us that proper Morse timing is that a dah is three times as
long as a dit. This means that the calculated mark average should
be 2 dits, assuming equal numbers of dits and dahs. As you can see
in the figure below, this average is an excellent point of
reference for sorting marks into dits and dahs.
WPM = 2.4/(average of Marks in milliseconds)
therefore, 20wpm => mark of 60ms.
Average
DIT | DAH
|________|________|________|
Time in milliseconds 0ms 60ms 120ms 180ms
Deviation from mean < -60ms >< +60ms >
Time values for 20 wpm cw
The important factor here is the number of marks used to calculate
the average (mean). If that number is too small the average will
become easily skewed by uneven occurrences of either dits or dahs.
An example of this skew can be seen in the phrase "1000 watt"; it
contains 24 dahs but only 3 dits. In this example the average would
quickly converge to the length (time) of a dah.
If we select a very large number (>250) of samples for the
averaging calculation, we can effectively "swamp out" all but the
most absurd of the "pathological" patterns that would significantly
skew the average. An additional benefit to having a large number of
samples in the average would be better noise immunity should an
errant value enter the calculation due to QRM or QRN.
A scheme based on a large sample average would work well if all cw
operators could standardize on a fixed baud rate, much like the way
the asynchronous serial protocols work. Unfortunately, the real
world of cw is anything but standard when it comes to transmission
speed. CW speed not only varies from operator to operator, but it
also changes if the operator fatigues or desires to emphasize
certain portions of the transmission such as signal reports, QTH,
etc.
There are two major disadvantages to the large sample average. The
larger the number of samples used in an average, the less
responsive to change it becomes. When a big change in transmission
rate is encountered, such a system requires an infusion of many
dozens of new mark values before it would have an accurate enough
average to operate properly. During this time, much of the QSO
would have been lost in a sea of garbled characters. Large sample
averages are also computationally intensive, restricting their use
with only the fastest machines.
The MEAN Machine.
ROBO-COPY's algorithm uses a smaller number of samples, 32,
allowing it to "sync up" rapidly to varying transmission rates. The
trick is to manage the entries that are used in the calculation of
the average. First, the errant mark values due to noise are reduced
by the sampling filter that qualifies each mark as it happens. Then
a pre-screening function insures that skew is minimized by
disallowing more than 3 successive marks of the same length, plus
or minus 12.5%, from being entered into the average calculation.
Another type of statistical operation used in ROBO-COPY is the mean
deviation. It is used to detect large changes in the transmission
speed and adjust for dah to dit rations that aren't 3:1. The mean
deviation is the difference between the average and the current
mark value. A record of the past 32 deviations from average is
maintained. The above figure shows that under normal circumstances
the mean deviation of the dit and dah are of equal value but have
different signs. If you add all 32 mean deviations together the
dits and dahs will cancel each other out and the sum will be near
or at zero for "normal" copy.
If the speed of the incoming code should change rapidly however,
like when you change frequency from a 13 wpm QSO to a 50 wpm QSO,
the mean deviation really "kicks in". When the value of the mean
deviation exceeds 25% of the average value, the average is "opened-
up" so that any mark will be included in the calculation of the new
average. The program temporarily suspends the pre-screening of
entries into the average in an effort to purge the average of the
out-of-date values it contains. After the mean deviation recedes
back below 25% of the average value the program will again start
the pre-screening process using the new average as the basis for
qualifications.
Because of these algorithms, ROBO-COY is responsive to changing
copy conditions, yet stable without being computational
cumbersome."
As each mark is completed, the program then starts measuring the
length of the space following it. If the length of the space is
less than or equal to the value of letter space value, then the
space is considered to be part of the current character and the
program starts measuring the length of the next mark. If not, then
the character is considered to be complete and is output to the
"receive" window of the screen. The timing of the space continues
and if it reaches the value of word space, a word is considered
complete and a space is output to the receive window of the screen.
The program then waits for the beginning of the next mark. The
default values of the letter space is initially 2.5 times the dit
length. The default value of the word space is initially 6.7 times
a dit length. Both of these two values can be changed with function
keys.
The Interface
The program uses either COM1 or COM2 to interface to the radio
equipment and to provide timing of the CW received or sent. Because
a comm-port is used, the signals must conform to the RS-232
definition which is normally a -12v to +12v swing. Naturally, the
radio equipment does not normally provide the proper signals and
therefore some type of interface must be developed.
The interface to the "key" input of the rig is simple. Wire a diode
from the DTR pin of the comm-port connector to a very small reed
relay (a good one would be one of the 16 pin DIP types) and then
back to the GND pin of the connector. The polarity of the diode
would be with the cathode connected to the connector.
|\ | |----------|
DTR o-----| \|-----| relay |--------+
| / | |----------| |
|
GND o-----------------------------------+
The contacts of the relay can then be used to key the rig.
However, the interface for the receive side is not quite so simple.
The October 1990 issue of 73 magazine, which contains the original
article describing ROBO-COPY, includes a somewhat simple interface
which does function although it is not very effective.
Back in the early 70s, I received the diagram of an interface
circuit which is impressive in its performance. It is so effective
in digging into the incoming signal and extracting the cw present
that I added a small audio amplifier so that I could use it just as
a simple audio filter. It has recovered a cw signal from the
receiver even when it could not be heard with headphones on.
Unfortunately, I misplaced the diagram when I moved from
Minneapolis to Phoenix in 1980 - if you've ever moved, you will
understand how easy this is to happen. I will have to reverse
engineer the device before it can be provided to the users of CW.
Please forward a SASE envelope to me and I will furnish you with
the schematic as soon as possible.
There are two different types of connectors which can be used on a
PC - DB-9 and DB-25. The following table list only the pins which
are of interest to the user.
DB-9 pin DB-25 pin usage
Ring Indicator 9 22 input from receiver
Data Term Rdy 4 20 "key" signal to rig
GND 5 7 ground
Clear to Send 8 5 Dit paddle
Carrier Detect 1 8 Dah paddle
Electronic keyer
The user can also wire his keyer paddle such that the program will
act as full-featured electronic keyer. This includes iambic action
plus dit and dash memories. For this feature to be active, the user
must include a line in the parameter file of "KEYER=YES". I have
found that a simple 1488 EIA interface chip (used for some of the
other required signals) with the paddle connections to the inputs
of the chip provided a very satisfactory method of interfacing the
keyer paddle to the program.
Parameter file
When the program is started, it reads in a file (which defaults to
the file CW.MSG) which contains parameters defining the user and
also up to 10 "canned" messages. Each record of the file begins
with a keyword followed by the data associated with that keyword.
Keyword Associated data
MSGn= Where "n" can be 0 thru 9 defining 10 "canned"
messages. The content of those messages can be
any valid cw characters. One feature that can be
taken advantage of is the inclusion of #
followed by a "C", "Q", "N" or "I" - the pair
will be replaced with the users Call, the users
Qth, a program maintained Number, or Increment
that number.
GMT= Value necessary to adjust local time to GMT/UCT.
Negative values are represented by a leading -.
PORT= Hex value of the comm-port to be used. If this
parameter is not present, the program will
default to comm-port 1. Comm-port is "2F8".
CALL= User call sign.
QTH= User Qth.
TONE= Frequency of the monitor. If this parameter is
not present, the program defaults to 800hz.
SPEED= The transmit speed to be used initially. If this
parameter is not present, the program defaults
to 20 wpm.
KEYER= This must be "YES" for the electronic keyer
feature to be available.
Program start-up
The program is launched with the command:
CW [filename]
This will start the program executing and if "filename" is
included, that file will be read in place of the default file of
"CW.MSG" (see description of the contents of this file above).
First, the program will announce itself, wait three seconds [this
can be shortened by pressing the <space> key], and then the normal
screen is brought up. The normal screen consists of 4 areas: (1)
the status line, (2) the receive area, (3) the keyboard area, and
(4) the sending area.
The information contained on the status line consists of:
a) The state of the program - either RCVE or XMIT
b) The current value of the receiving speed.
c) The current value of the transmitting speed - this can have
a value of "LK" which indicates that the transmitting speed
locked to the receiving speed (see Alt-L later).
d) The count of the number of characters currently in the
keyboard buffer (to a maximum of 2048 characters).
e) The state of the digital filter.
f) The "letter" space to dit ratio.
g) The "word" space to dit ratio.
h) The monitor frequency.
i) The local and GMT/UCT time.
This is followed by the window for the data received by the program
- while receiving, if the program detects a character which is
invalid, it will be replaced with a @. The name of the receive
window will flash when there is either printer or file capturing of
received data. Also, the upper right corner of the shows which of
the two sets of receive (see alt-U in special keys) is currently
active.
Next comes the window where the keyboard data is display that the
user has entered for transmitting. And the final area is to show
the user what is being sent.
Just a brief warning. Do not have a "background" program such as
print or a TSR running which can actively steal CPU cycles from the
program. This will severely alter the timing mechanisms of the
program.
Operating Tips
When the program is interpreting the incoming signal, it makes
every attempt to properly decode the signal. However, because there
is an infinite number of different "fists", it becomes almost
impossible to adjust for each different operator. Frequently the
user of the program must provide assistance so that the program can
function as the user desires. This assistance if provide thru the
F1, F2, F3 and F4 function keys.
F1 and F2 should be used when the characters are translated into Ts
and Es - for example, "C" becomes "TETE" - or when characters are
combined - such as "AM" becomes "J". These two keys adjust the
length of the space between elements of a character. Too long and
the "AM" becomes "J" and too short results in the "TETE". As you
use F1 and F2, the effect is reflected by the "Ltr=" value on the
status line of the screen. The value reflects the "dit" time that
represents the inter-letter space.
The second assistance is thru the F3 and F4 keys. These keys are
used to help the program determine the end of letters in a word. If
the word "help" is shown as "h e l p" then the F3 key should be
used. And if "help me" is show as "helpme" then F4 should be used.
As with F1 and F2, when you use F3 and F4, the effect is reflected
by the "Word=" value on the status line of the screen. The value
represents the "dit" time that reflects the between-word space.
During the development of the program, it quickly became apparent
that without these function keys, the program would never be able
to cope with the variety of "fists". Use them properly and the
program is fully capable of showing even poor code on the screen.
It is not unusual for the Rx speed on the status line to change a
bit either up or down when the program is copying code solidly.
This is caused by the program recalculating the receive code speed
at the end of each dit or dah. The program should continue to copy
the incoming code with no problem. On the other hand, if the speed
should change by large values, this is an indication that the input
signal is not properly tuned in such that the interface provides a
solid signal to the computer -- another cause can be static
crashes.
"Special Keys"
The program will respond to some keys other than as data to be
sent. A brief explanation of these special keys can be obtained by
entering Alt-H while the program is executing. The following is a
more detailed description of each key.
ESC This key will toggle the program between receive and
transmit modes. The left end of the status line will
show the current mode. Additionally if in transmit
mode, the name of the Sending window will blink.
F1 Adjust length of letter spacing down by .1 times of
the current dit length. This key should be pressed
when the received code is shown as is not separated
into individual characters properly. For example,
"is" is interpreted as "5".
F2 Adjust length of letter spacing up by .1 times of
the current dit length. This key should be pressed
when the received code is shown as a string of Es
and Ts. For example, "B" would be shown as "TEEE".
F3 When the spaces between words are missing, press
this key. This adjusts the length of the "space"
between words down by .1 times the current dit
length.
F4 When every letter is separated by a space, use this
key. Each press of the key, adjust the length of the
"space" between words up by .1 times the current dit
length.
F5 Decreases the send speed by 1 wpm.
alt-F5 Decreases the send speed by 5 wpm.
F6 Increases the send speed by 1 wpm.
alt-F6 Increases the send speed by 5 wpm.
F7 Clear the receive window of the screen
F8 Clear the keyboard window of the screen. Note that
this will also change the "Buff" entry of the status
line to zero.
F9 Toggle the digital filter. There are 4 settings of
the filter. "Low" which limit the maximum received
code speed to 75 wpm but the program will be
sensitive to "noise". "Med" will limit the maximum
speed to 37 wpm but makes the program less sensitive
to noise. "Hi" limits the speed to 18 wpm but makes
the program even more insensitive to noise. And
finally, "Off" which removes limits from the maximum
speed but also makes the program very sensitive to
noise.
F10 This will reset all program receive timing
parameters to their default values.
alt-B This will toggle the monitor on and off. The current
state can be seen on the status line.
alt-H A brief description of each special key will be
shown. The display can be terminated prematurely by
pressing the "ESC" key.
alt-I The user will prompted of the name of a file to be
read and treated as if the data were keyboard input
for transmission. The file will be read until end-
of-file is reached or until the user presses alt-I
a second time. When the file is closed, the user
will be notified with a brief message on the screen.
alt-L This key will lock (or unlock) the transmit code
speed to the value of the receiving code speed. A
brief message is shown the screen. Also, the TxSpeed
of the status line will reflect the current value.
alt-M This will display the value of the Call, Qth, and
the 10 canned messages.
alt-N Allows the user to initialize the value of "number"
alt-O This provides the user with the writing of the
received CW to a file. The user will be prompted for
the file name. The program always opens the file in
"append" mode. The file will remain open until alt-O
is pressed a second time or until the program
terminates. Note that any special cw characters such
as "BT" will be shown in brackets - for example,
[BT] - also, once a minute the date and time will be
written to the file again surrounded with brackets.
alt-P This function is identical to the alt-O described
above except that the output is to the user printer.
alt-Q Terminate program.
alt-R This will cause the program to generate 63 groups of
5 characters of random code. It can be used for code
practice.
alt-S If the user is curious, this key will show the
current state of the mean-deviation and mark tables.
It is present for program debugging.
alt-T Allows the user to adjust the frequency of the
monitor.
alt-U The program has the ability to maintain its receive
algorithm values for 2 different signals. This key
will flip the program from one signal to the other.
This can be useful when you are in a QSO with two
people are not sending identical code. Without this
functionality, there would be the possibility of a
brief period time when the program would receive
"garbage" while it synched up with the other signal.
alt-0 Send message 0.
alt-1 Send message 1.
.
.
.
alt-9 Send message 9.
Insert Send cw character AS
Home Send cw character KN
PgUp Send cw character AR
PgDn Send cw character SK
End Send cw character SN
Delete Send cw character BK and switch program to receive
mode.
<enter> Send cw character BT
UpArrow Send call
DnArrow Send Qth
RtArrow Send "number"
LtArrow Increment "number" by 1.
! Send cw character AA
# Send cw character KA
$ Send cw character IQ
% Send cw character AK
Any character which is not in the above list nor represents a valid
CW character will result in a Beep.
And there is more!
I have an ICOM IC-765 and have developed a computer interface to
it. I then combined this interface with the CW program. This allows
me to first tune the rig with my computer and then with the simple
pressing of the F12 key, I'm in the CW program. Another press of
F12 returns me back to the interface program. If you are interested
in this software and have an ICOM CT-17 CI-V interface (I can
provide you with the diagram of a $12 replacement for the $97.50
that ICOM wants for the CT-17), send me a 5.25 floppy along with a
shareware fee of $20. This interface has proven very effective in
controlling my IC-765 and recognizing when I manually assume
control of it. Based upon the documentation provided to me by ICOM,
the program should be equally effective in controlling other ICOM
HF rigs.
Change history
Rev: 1.01 -- 25 July 1991
Initial release
Rev: 1.02 -- 31 August 1991
Implemented calibration function.
Changed initial value calculations using results
of calibration function.
Blanks and special characters weren't showing adjusted
buffer count.
Initial filter value was getting changed down to "low".
Changed Welcome screen to reflect new rev number.
Corrected Alt-I function - it was not working.
Corrected TellClose - in case current line not at
announcement.
Changed OpenWindow to center message
TxLock wasn t functioning
Rev: 1.03 -- 15 September 1991
The help function (Alt-H) was inadvertantly changed such
that it wouldn't function at all.
Rev: 1.04 -- 20 September 1991
Corrected Farnsworth spacing - it was too short.
Show Farnsworth speed on send area border when active.
Future changes
I'm currently working on a mouse interface for as many
keyboard type functions as possible.
Any and all suggestions are solicitied. In fact, many of
the current features were the result of suggestions from
hams here in the Phoenix area. If you have an idea, let
me know.