[GreenKeys] Computing The Speed Of CW

Chris Elmquist chrise at pobox.com
Wed Aug 12 10:24:44 EDT 2009


On Tuesday (08/11/2009 at 08:34PM -0700), hunybuny at eskimo.com wrote:
> 
> I've written a program (in C) to take my incoming e-mail and
> send it over the comm port to a code practice oscillator so I
> can listen to it in morse code. :-)
> 
> Works fine at any speed I hard-code it for.
> 
> Now I want to be able to tell the program to send at a specific
> speed in WPM but I've found that the speed difference
> from 35-30-25-20-15-10 WPM is not linear when done using a
> system clock interrupt. There must be some formula because of all
> the transceivers that have keyers built in and show you the speed
> on their LCD.
> 
> Here is a rough example of the speed -vs- the clock times. The higher
> speeds may be off because the way I'm finding the clock speed is to
> key "dits" on my rig's keyer and then changing the interrupt speed on
> the computer until they match.
> 
> WPM  -  Clock time
> 
> 10 - 110000
> 13 -  90000
> 15 -  85000
> 18 -  64000
> 20 -  50000
> 25 -  40000
> 30 -  30000
> 
> Any ideas?

If I understand your question correctly-- you are wondering why 10
WPM takes 110000 ticks and 20 WPM takes 50000 ticks and not 110000/2
or 55000...  and why 30 WPM is 30000 and not 110000/3 or 36666, etc.
is that correct?

I think you are seeing the non-linear behavior because something in your
code is not scalable--  ie, it has a fixed cost for each invocation.
Typically things like I/O or memory accesses will have a fixed time cost
and become the real bottleneck in the function-- essentially swamping
the rest of the code in the function when it is called.

You need to determine what this thing is and compute the # of ticks
with an algorithm something like,

	ticks = WPM * n + m

where m is the fixed time for the non-scalable thing and n is the
scalable stuff. 

Chris N0JCF
-- 
Chris Elmquist



More information about the GreenKeys mailing list