Author |
Message |
PHOBoS

Joined: Jan 14, 2010 Posts: 5774 Location: Moon Base
Audio files: 708
|
Posted: Tue Nov 04, 2014 10:39 am Post subject:
Morse Code generator Subject description: -.-- --- ..- -.- -. --- .-- -- --- .-. ... . -.-. --- -.. . |
 |
|
I was listening to Chez Mosc this past sunday which started with something that sounded like morse code.
This made me wonder how hard it would be to design a circuit that generates a random morse code.
I first had a look at the timing between the dots and dashes and I got this from wikipedia:
1. short mark, dot or "dit" (·) — 1
2. longer mark, dash or "dah" (–) — 111
3. intra-character gap (between the dots and dashes within a character) — 0
4. short gap (between letters) — 000
5. medium gap (between words) — 0000000
Which results in the following 6 possible 'sequences'
10 (dot + intra-character gap)
1110 (dash + intra-character gap)
1000 (dot + short gap)
111000 (dash + short gap)
10000000 (dot + medium gap)
1110000000 (dash + medium gap)
The maximum is 10 steps which is very convenient because that makes it possible to use one 10 step counter (U1).
All that needs to be done is to reset it after 2,4,6,8 or 10 steps, which can be done with a mux (U2), and to create a pulse
that's either 1 (dot) or 3 (dash) CLK cycles long.
I decided to use the inputs of the mux as follows
A: dot (0) or dash (1)
B: short gap (0) or medium gap (1) [only when C = 1)
C: intra-character gap (0) or short/medium gap (1)
I was thinking of making it stop when the input is 000/001. And my first idea was to connect I/O0 and I/O1 of the mux to +
so the counter would be reset. The problem with that is that the Q0 output of the counter will stay high, which would result in a
looooooong beep. It would be possible to turn it off with some more logic but there is another problem with it anyway.
Another idea is to use the CLK INH pin, but that would also require some more logic then I'm willing to put in.
Instead I just added a switch. It's connected to Q3 so that the output will always be low when it's put on hold.
The next thing I added is a synchronous input for the ABC control lines in the form of some D-flipflops (U3).
The CD40174 is something I had laying around but you could use a CD4042 (quad flip flop) aswell.
The flipflops are triggered at the end of a 'sequence', this way the timing stays correct no matter what you attach to the inputs.
The only problem was to have it triggered after 10 steps, since there is no reset pulse. Luckely the CD4017 does
have a carry out which goes from low to high after 10 steps, however it stays high for 5 CLK cycles so I had to turn it into a pulse.
To create the actual dots and dashes it would probably be easies to use another mux and select between Q0 (dot)
or Q0+Q1+Q2 (dash). But I didn't want to add another IC, so I used some mickey mouse logic:
Q0,Q1,Q2 are all connected to an OR gate, but Q1 & Q2 are switched on/off with an AND gate.
U4 is used to set the maximum number of dots/dashes which is 4 for standard letters, 5 if you add numbers aswell.
U5 is optional and can be used to turn it into a standalone morse code beeper.
It might be fun to add 1 or 2 shiftregisters with LEDs, so you can see the code
Description: |
Morse Code generator schematic |
|
Filesize: |
82.22 KB |
Viewed: |
882 Time(s) |
This image has been reduced to fit the page. Click on it to enlarge. |

|
Description: |
PHOBoS - Morse Code generator demo (feel free to translate ;)) |
|
 Download (listen) |
Filename: |
PHOBoS - Morse Code generator demo.mp3 |
Filesize: |
616.13 KB |
Downloaded: |
1289 Time(s) |
_________________ "My perf, it's full of holes!"
http://phobos.000space.com/
SoundCloud BandCamp MixCloud Stickney Synthyards Captain Collider Twitch YouTube Last edited by PHOBoS on Mon Nov 10, 2014 1:13 pm; edited 2 times in total |
|
Back to top
|
|
 |
blue hell
Site Admin

Joined: Apr 03, 2004 Posts: 24373 Location: The Netherlands, Enschede
Audio files: 296
G2 patch files: 320
|
Posted: Tue Nov 04, 2014 10:57 am Post subject:
|
 |
|
Nice one PHOBoS, compact!
I got the same idea at the same time for the same reason .. which for me resulted in
Anyway, your mp3 is in that patch too now :¬) _________________ Jan
also .. could someone please turn down the thermostat a bit.
 |
|
Back to top
|
|
 |
PHOBoS

Joined: Jan 14, 2010 Posts: 5774 Location: Moon Base
Audio files: 708
|
|
Back to top
|
|
 |
blue hell
Site Admin

Joined: Apr 03, 2004 Posts: 24373 Location: The Netherlands, Enschede
Audio files: 296
G2 patch files: 320
|
Posted: Tue Nov 04, 2014 1:16 pm Post subject:
|
 |
|
Yes ... that's easy in a programming language .. can still type random text of course
Code: | function TModMorse.CharToSymbols( aChar: Char): string;
// Using ITU encoding
begin
case UpCase( aChar) of
'A' : Result := '_ ___ '; 'B' : Result := '___ _ _ _ ';
'C' : Result := '___ _ ___ _ '; 'D' : Result := '___ _ _ ';
'E' : Result := '_ '; 'F' : Result := '_ _ ___ _ ';
'G' : Result := '___ ___ _ '; 'H' : Result := '_ _ _ _ ';
'I' : Result := '_ _ '; 'J' : Result := '_ ___ ___ ___ ';
'K' : Result := '___ _ ___ '; 'L' : Result := '_ ___ _ _ ';
'M' : Result := '___ ___ '; 'N' : Result := '___ _ ';
'O' : Result := '___ ___ ___ '; 'P' : Result := '_ ___ ____ ';
'Q' : Result := '___ ___ _ ___ '; 'R' : Result := '_ ___ _ ';
'S' : Result := '_ _ _ '; 'T' : Result := '___ ';
'U' : Result := '_ _ ___ '; 'V' : Result := '_ _ _ ___ ';
'W' : Result := '_ ___ ___ '; 'X' : Result := '___ _ _ ___ ';
'Y' : Result := '___ _ ___ ___ '; 'Z' : Result := '___ ___ _ _ ';
'0' : Result := '___ ___ ___ ___ ___ '; '1' : Result := '_ ___ ___ ___ ___ ';
'2' : Result := '_ _ ___ ___ ___ '; '3' : Result := '_ _ _ ___ ___ ';
'4' : Result := '_ _ _ ____ '; '5' : Result := '_ _ _ _ _ ';
'6' : Result := '____ _ _ _ '; '7' : Result := '___ ___ _ _ _ ';
'8' : Result := '___ ___ ___ _ _ '; '9' : Result := '___ ___ ___ ___ _ ';
'*' : Result := '_ _ _ ___ ___ ___ _ _ _ '; // SOS symbol
else Result := ' '; // Inter word delay, for all unknown chars including a space
end;
end;
|
where a space in Result represents 'tone off' everything else is 'tone on'. _________________ Jan
also .. could someone please turn down the thermostat a bit.
 |
|
Back to top
|
|
 |
blue hell
Site Admin

Joined: Apr 03, 2004 Posts: 24373 Location: The Netherlands, Enschede
Audio files: 296
G2 patch files: 320
|
Posted: Tue Nov 04, 2014 7:24 pm Post subject:
|
 |
|
Some details added in the post above for character to tone sequence.
Basically there are 26 characters, 36 when numbers are in too - but one extra is needed for the space between words (or all unknown characters in the code above).
I added * for the special SOS codingg, there are some more of those a HAM might use those ... but nothing too interesting I think for a generator.
some later code then does
Code: | if not FOldClock and NewClock
then begin
if FSymbols[ FSymbolIndex] = ' '
then FOutputs[ morse_out] := 0
else FOutputs[ morse_out] := 1;
Inc( FSymbolIndex);
end;
|
And the ASCII codes for characters are not too silly for a CMOS implementation I think. _________________ Jan
also .. could someone please turn down the thermostat a bit.
 |
|
Back to top
|
|
 |
RingMad

Joined: Jan 15, 2011 Posts: 428 Location: Montreal, Canada
Audio files: 4
|
Posted: Wed Nov 05, 2014 12:19 pm Post subject:
|
 |
|
Cool! Setup a radio beacon broadcasting this stuff 24/7 and drive people nuts trying to decode it!
-- James.
( -. --- .. -.. --- -. - -.- -. --- .-- -- --- .-. ... . -.-. --- -.. . ) |
|
Back to top
|
|
 |
blue hell
Site Admin

Joined: Apr 03, 2004 Posts: 24373 Location: The Netherlands, Enschede
Audio files: 296
G2 patch files: 320
|
Posted: Wed Nov 05, 2014 12:26 pm Post subject:
|
 |
|
RingMad wrote: |
( -. --- .. -.. --- -. - -.- -. --- .-- -- --- .-. ... . -.-. --- -.. . ) |
-.-- . ... -.-- --- ..- -.. --- -.- -. --- .-- -- --- .-. ... . -.-. --- -.. . --- .-. .- - .-.. . .- ... - ..-. --- ..- -. -.. .... - . .-. .. --. .... - --- -. .-.. .. -. . - --- --- .-.. .-- .... . .-. . .- .-. . - .... . ... - _________________ Jan
also .. could someone please turn down the thermostat a bit.
 |
|
Back to top
|
|
 |
PHOBoS

Joined: Jan 14, 2010 Posts: 5774 Location: Moon Base
Audio files: 708
|
Posted: Wed Nov 05, 2014 1:04 pm Post subject:
|
 |
|
Quote: | Cool! Setup a radio beacon broadcasting this stuff 24/7 and drive people nuts trying to decode it! |
I thought about that, make it solar powered and hang it in a tree
- .... .. ... .. ... .--- ..- ... - ... --- -- . .-. .- -. -.. --- -- -.-. --- -.. . .- -. -.-- .-. . ... . -- -... .-.. .- -. -.-. . - --- .- -.-. - ..- .- .-.. - . -..- - .. ... .--. ..- .-. . .-.. -.-- -.-. --- .. -. -.-. .. -.. . -. - .- .-.. _________________ "My perf, it's full of holes!"
http://phobos.000space.com/
SoundCloud BandCamp MixCloud Stickney Synthyards Captain Collider Twitch YouTube |
|
Back to top
|
|
 |
DUBmatze

Joined: Feb 18, 2013 Posts: 150 Location: south Germaica (schwabilon)
|
Posted: Wed Nov 05, 2014 5:06 pm Post subject:
|
 |
|
PHOBoS wrote: | Quote: | Cool! Setup a radio beacon broadcasting this stuff 24/7 and drive people nuts trying to decode it! |
I thought about that, make it solar powered and hang it in a tree
- .... .. ... .. ... .--- ..- ... - ... --- -- . .-. .- -. -.. --- -- -.-. --- -.. . .- -. -.-- .-. . ... . -- -... .-.. .- -. -.-. . - --- .- -.-. - ..- .- .-.. - . -..- - .. ... .--. ..- .-. . .-.. -.-- -.-. --- .. -. -.-. .. -.. . -. - .- .-.. | cool thing...
it brings me to a lot of webpages (text - morse, text - morse - wav/mp3, text - morse - midi). i also checked a few sites like freesound.org for morse snipets and i started to make a dub with morse code....
i like the plan with the radio .... when i was a kid my dream was running a pirate radio ship.... (but there is no water arround here) |
|
Back to top
|
|
 |
|