home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 December
/
simtel1292_SIMTEL_1292_Walnut_Creek.iso
/
msdos
/
hamradio
/
cw.arc
/
CW.DOC
< prev
next >
Wrap
Text File
|
1988-10-22
|
14KB
|
442 lines
AAAA MMMMoooorrrrsssseeee CCCCooooddddeeee SSSSeeeennnnddddiiiinnnngggg aaaannnndddd RRRReeeecccceeeeiiiivvvviiiinnnngggg PPPPrrrrooooggggrrrraaaammmm ffffoooorrrr tttthhhheeee IIIIBBBBMMMM----PPPPCCCC
_K_e_v_i_n _S_c_h_m_i_d_t, _W_9_C_F
_T_h_i_s _i_s _t_h_e _d_o_c_u_m_e_n_t_a_t_i_o_n _f_o_r _C_W._C, _a _p_r_o_g_r_a_m _t_o _s_e_n_d
_a_n_d _r_e_c_e_i_v_e _i_n_t_e_r_n_a_t_i_o_n_a_l _m_o_r_s_e _c_o_d_e _v_i_a _t_h_e
_I_B_M-_P_C _s_e_r_i_a_l _p_o_r_t.
_C_o_p_y_r_i_g_h_t _1_9_8_8 _b_y _K_e_v_i_n _S_c_h_m_i_d_t. _T_h_i_s _d_o_c_u_m_e_n_t _m_a_y _b_e _r_e_p_r_o_d_u_c_e_d
_f_o_r _a_n_y _n_o_n_c_o_m_m_e_r_c_i_a_l _p_u_r_p_o_s_e _a_s _l_o_n_g _a_s _c_r_e_d_i_t _i_s _g_i_v_e_n _t_o _t_h_e _a_u_t_h_o_r.
October 22, 1988
- 2 -
_1. _I_n_t_r_o_d_u_c_t_i_o_n
This documentation is for CW.C a morse code sending and
receiving program written in TURBO-C 1.0 (with bug patches)
for the IBM-PC. You should receive the C source with any
distribution of this documentation.
DISCLAIMER: CW.C bypasses both the BIOS and DOS to
reprogram the serial port hardware and the timer/sound chip.
The author takes no responsibility for what running this
code may do to your system. It is provided AS IS with NO
WARRANTEE whatsoever. Run it at your own risk.
The distribution should contain the files:
1. CW.DOC -- this file
2. CW.C -- the source program
3. CW.INI -- an example initialization file
4. CW.EXE -- (optional) a compiled version of the
code. If not supplied or you want to know what you
are using, compile cw.c using TURBO-C. My command
line to do this is:
tcc -Lc:urbocnclude cw.c
where you need to change -L and -I options to
correspond to the location of your library and
include files.
_2. _S_e_t_u_p _a_n_d _O_p_e_r_a_t_i_o_n
CW functions as two separate programs one for sending
morse from the keyboard and the other for receiving morse
and displaying it on the screen. The two programs are very
loosely coupled. Morse is sent by toggling the request to
send line of the RS-232 serial port. Mark is +12V and space
is -12V. Similarly morse characters are received by looking
at the clear to send line of the RS-232 port.
To get started, put CW.EXE in a subdirectory and put
CW.INI in the same subdirectory. Edit the file CW.INI and
put in any commands that you want executed at startup in
this file. The example file is:
sound off
sound 40
serial 3f8 4
b1 cq cq cq de w9cf w9cf w9cf k
b2 r tnx for call = rst
b3 = qth new york city ny = name kevin = hw?
b4 de w9cf k
October 22, 1988
- 3 -
These commands first turn off the speaker which normally
beeps whenever an input mark is detected. The frequency of
the beep is set to 40HZ. This will be the frequency of the
beep if the sound is turned back on. Next the serial port is
set to com1. Com1 is the default so this line is unneces-
sary. For com2 you would use the command serial 2f8 3. See
the serial command below for more information. There are ten
send buffers. The first 4 are set in the next 4 lines. Each
of these ends with a space so that a space is the last char-
acter sent. However, this space does not show above. Modify
the buffers to hold whatever you like.
To test the code, you can loop back the sender to the
receiver. Do this by shorting the clear to send line of the
RS-232 port to the request to send line. These should be
pins 4 and 5 of a 25 pin connector. Start up CW. The top of
the screen holds help information. The middle of the screen
is the receive display and the bottom portion is the
transmit display. The last line is used as a command line
and will be described later.
Type something at the keyboard. It should be displayed
in the transmit region. Now hit the f9 function key. This
will tell the computer to send the text in the transmit
queue out the serial port. Since this is looped back to the
receiver, it should be displayed in the middle portion of
the screen. If you want to hear the code on the speaker hit
the f1 key. Alternatively, you can leave the sound off line
out of cw.ini or replace it with sound on. Note, the speaker
is connected to the receive section. Transmitted characters
will not sound the speaker unless it is looped back to the
receiver.
_3. _H_e_l_p _S_c_r_e_e_n _a_n_d _f_u_n_c_t_i_o_n _k_e_y_s
The help screen displays the following information:
1. auto or man -- indicating whether the receive
speed is set by the program by analyzing the
incoming morse, or by the operator. Manual mode is
probably necessary if you want to hook this up to
a radio.
2. dot -- this displays the current speed in words
per minute of what the code thinks are incoming
dots.
3. dash -- this displays the current speed in words
per minute of what the code thinks are incoming
dashs.
October 22, 1988
- 4 -
4. el sp -- this displays the current speed in words
per minute of the spaces between dots and dashes.
5. lt sp -- this displays the current speed in words
per minute of the spaces between letters.
6. rcv -- this displays the approximate receive speed
in words per minute if the program is set to auto.
In manual mode, it displays the manually set
receive speed.
7. The other items are a quick reference to what the
function keys do, and how to get command line
help.
The 10 function keys are set up as follows:
f1. -- toggles the speaker on and off.
f2. -- toggles the receive speed from automatic to
manual.
f3. -- in manual mode decreases the receive speed.
f4. -- in manual mode increases the receive speed.
f5. -- increases the transmit speed.
f6. -- decreases the transmit speed.
f7. -- set transmit speed to current receive speed.
f8. -- enter a command in command mode.
f9. -- toggle from send mode to hold mode. In hold
mode, text is entered in the transmit queue but is
not sent until send mode is toggled.
f10. -- exit from CW program.
Shift-f?.
-- i.e. hold down the shift and function key,
where ? is 1 through 10 causes the corresponding
numbered buffer to be appended to the transmit
queue.
CTRL-f?.
-- i.e. hold down the control key and the function
key. This erases the contents of the corresponding
numbered buffer and prompts for new text. It is
usually a good idea to end text with a space. A
October 22, 1988
- 5 -
carriage return (enter key) terminates the text.
ALT-f?.
-- i.e. hold down the alt key and the function
key. This displays the current text in the
corresponding numbered buffer.
_4. _C_o_m_m_a_n_d_s
The following commands are allowed in command mode. Any
command listed here may also be used in the startup file.
read filename -- reads in the filename specified
and sends it.
sound on -- turns on the speaker.
sound off -- turns off the speaker.
sound nnnn -- where nnnn is a number, sets the
sound frequency to nnnn.
receive automatic -- set receive speed to
automatic.
receive manual -- set receive speed to manual.
receive nn -- where nn is a number, sets receive
speed to nn words per minute.
serial hhhh h -- sets the serial port. hhhh is the
serial port base address in hex and h is the
hardware interrupt vector used by the serial port.
Initially, this is set to 3f8 4 which is normal
for com1. Com2 uses 2f8 3. For other serial ports
you will have to fill in the correct values. You
should also check the interrupt handler in the
source code to make sure it does what you want.
stretch nnnn -- where nnnn is a number, reduces
marks and increases spaces by nnnn*840
nanoseconds. This can be helpful to compensate for
pulse stretching in audio filters.
bn text -- where n is a number from 1 to 10, fills
corresponding buffer with text where text is what-
ever is to be sent.
transmit on -- tells program to send text in
transmit queue (see f9 above).
October 22, 1988
- 6 -
transmit off -- tells program to hold text in
transmit queue (see f9 above).
_5. _T_h_e_o_r_y _o_f _O_p_e_r_a_t_i_o_n
Only a very brief theory of operation will be given.
The program can be divided into three parts. The first
part is an interrupt handler for the serial port. The serial
port is set to interrupt on change of the modem status. In
particular, this happens when the clear to send line is
changed. The interrupt handler simply records the status of
the clear to send line in queue.mark and the time since the
clear to send line last changed in queue.mstime and incre-
ments the queue pointer countin. The serial port stuff is
fairly standard and I used the description given by of R.
Jourdain, "Programmer's Problem Solver for the IBM PC,XT,
and AT", (Prentice Hall, 1986, NY) although he gets the
interrupt numbers wrong. The method used for timing the
marks and spaces is adapted from B. Sheppard, "High Perfor-
mance Software Analysis on the IBM PC", BYTE, January 1987.
The second part of the code is a replacement for the
IRQ0 timer interrupt. I change the timer to interrupt
SPEEDUP times faster than original. Every SPEEDUP interrupts
the old interrupt handler is called so that disk operations
and the bios date should be unaffected. The replacement
interrupt handler takes characters from a queue and keys the
request to send line of the serial port. Note if you only
want to receive morse this replacement routine is not neces-
sary since microsecond receive timing accuracy can be
obtained without changing this interrupt. Just change
SPEEDUP to 1. Note SPEEDUP must be a power of 2.
The last part of the code is the human interface, which
looks at the receive queue and displays the result along
with some statistics, and also fills the transmit queue.
The code has been tested on my 6MHZ ibm pc-at running
dos 3.1 with CGA and serial/parallel adaptor and on a zenith
z-181 portable. Any other 80 column or greater display
should work. Since the clock chip is reprogrammed and serial
port interrupts are used, probably only hardware as well as
bios level clones of the IBM PC will run this code. If you
are attempting to run this code on a particularly slow PC,
you may want to set SPEEDUP to 1 to start. After everything
is working correctly, increase speedup to get the desired
set of transmit speeds. The possible transmit speeds are
given by dot length = N*840ns*65536/(SPEEDUP) where N is an
integer, ns stands for nanoseconds, and SPEEDUP must be a
power of 2 for proper operation.
October 22, 1988
- 7 -
Most of the information in this section is contained in
the source code comments, which also give some additional
information.
_6. _C_o_n_c_l_u_s_i_o_n
I originally wrote this code as a tool to help teach
morse. By hooking a code key to toggle the clear to send
line, the student can see what she is sending and get a fair
idea if her spacing is correct. The sending portion was
added when I needed a cw keyboard for my transmitter.
I have connected the PC to my receiver. It is fairly
easy to receive strong signals using machine produced code
like that from W1AW, but much more difficult to deal with
noisy signals and hand sending.
I do not plan to work on this code in the future. How-
ever, if you have questions, I can be contacted at my
address listed in the call book.
October 22, 1988