Edit: thanks for correction
I had posted here before with a simple Morse code player, which plays a sentence in Morse code. Today I added more functions to the program. Now you can type in a sentence on arduino using the Phi-1 shield's keypad and play it in Morse code. This program allows you to type in letters, numbers, and symbols. Use the arrow up and down to type letters (think old-school arcade game record) use left and right to move cursor back and forward. Use B to enter.
Well, that's pretty easy as long as you get the file content to Arduino. Once you get the content to arduino, instead of calling an input_panel() for input, you can simply send each line of your file with a '\0' in the end to the function the mores_out (sorry my code is spelled wrong. need more time to correct)
Yes. If you modify the period from 90ms to a different value, you get a different speed. The 90ms is about 13.33 words per minute. Frankly I don't knwn Morse code. This is my second attempt to learn it. I think I'll make it to the finish line with this program. ;D
Decoding with this program is impossible. I don't know how. Search the forum, there was one post less than a month old asking for help (offering like $40USD as reward :o).
--. --- --- -.. .-.. ..- -.-. -.-
Quite a few years back, I had a slew of programs written in MBASIC for the IBM PC, for Ham radio, One of which was a simple program that monitored the CD line of COM2, and converted the pulses back to ASCII characters. I converted the program to use on a TRS-80 Model-100 laptop, using the detect pin of the barcode reader port. (used the +5V to power a 567 tone detector circuit.) If I can find a source online, it should be easy enough to convert.. It featured auto-adjusting to the speed, and a fairly short basic program.
There is a few links out there, of a version running under Proton Basic (using a PIC16F...) But, the links are all outdated, using an old defunct website that doesn't exist anymore.. So-far, can't find the correct link..
Mind you, theirs is a all-in-one, sender and decoder.. I don't know if the code is self-adjusting.. Still trying to find that old MBASIC version... :-/
Then I saw the name, a bell rang.. AA4L, Bob Johnson is an old friend from my days in the CP/M OS days.
I stripped a lot of the code, to use with the Model 100.. But, this code was self-adjusting to any speed. After a few missed characters, it would lock onto the exact speed being sent.
What switch do you use to key in the Morse code? I find it hard to use tactile switch for a quick response. BTW your search table is probably very quick but I can't understand too much. I used a list instead. One of the entry would look like "O---". My program omits the O and only looks for "-" or ".". This is a self reminder what each character is in Morse code.
I have a humble suggestion for you. If you could create a button class to handle the debouncing and else your code will be more readable. It's already awesome.
Thanks! I just use a pushbutton that fits nicely on a breadboard. It's no good for serious morse keying, and I don't really know morse other than what I learned while testing the code. The circuit is very simple, using the built-in pullup resistor too. Also I have one of those piezo beepers for an audible feedback.
As for debouncing it already is debounced in that code, but I was a bit vary on the value of the debounce timer, which was set to 20ms. Which probably is a bit small for debouncing. Seems to work for 8wpm speed, and also 13 wpm. I haven't tested it extensively. I guess it depends on the button and circuitry.
As for a button class, I already made one a little while back Google Code Archive - Long-term storage for Google Code Project Hosting.
But I did not use it for this.. I'm not entirely sure how well it would fit with the morse decoder as-is at the moment either. It's primarily used for double-clicks and so on, and a bit cumbersome / unintuitive to use I think.
And for the search table, I was more concerned with memory usage. For a morse coder (not de-coder), I suppose a list is needed. But when I think about it, it should be possible to make a "reverse-dichotomic" (or reverse-binary tree) table lookup algorithm. In fact I think I'll look into that soon-ish, as well as to see how well it actually decodes audible morse (not tested yet, and requires a little modification for the input).
EDIT: To clarify that it's not that I promise anything, it was just a thought I got now and want to follow at some time. Probably soon.ish.
raron,
I'm working on a decoder right now with my super-sized button. You can use PROGMEM if you're concerned with the list being in SRAM. In fact, all my strings are in PROGMEM except for the Morse code list. I did the list before I knew PROGMEM. I'm not promising anything either but I might be able to finish the decoder soon-ish as well.
Same here, except encoder (combined with the decoder). I couldn't let that reverse-binary tree be
And I'm pleased to say the reverse tree path tracer worked, even on first try! (That's not too often) So using the same table for decoding and encoding. What I'm trying to get working now is the simple stuff (but managing to mess it up) - getting Morse audio input!
Starting to get a little practical (and fun) too, as I at last can hear what a properly timed Morse code sounds like that I type myself and practice right away with it. Well...unless my timing in the code is off. I don't have it as a cool stand-alone device, so input/output is via serial (and a beeper + LED). Not that I think I will have much use for it myself (you never know), but I wouldn't have continued this without this thread you started I also want to add it's not my intention of "taking over" your thread or project!
Btw, true, PROGMEN is where tables should go, but I have to admit I haven't actually meddled too much with that yet. I was maybe not as concerned about memory usage (for this particular application at least), as to just try to not use (much) more than needed. That's not to say it can't be further optimized, which I'm sure it can. Also I wanted to try my hand at that binary tree thing (again - since its some old code I made that I converted to C(++?) / Arduino).