Shop OBEX P1 Docs P2 Docs Learn Events
Code sender — Parallax Forums

Code sender

NewzedNewzed Posts: 2,503
edited 2005-11-23 18:17 in BASIC Stamp
I am trying to write a program to generate Morse code for inclusion in another project.· The code to date is attached.

As the program is written, it's going to take a lot of typing and a lot of EEPROM to get all the numbers and letters in the program.· It occurred to me that there might be a better way to accomplish the same thing more efficiently using DATA statements or perhaps LOOKDOWN, but so far I can't some up with anything the works.

Any suggestions?
Sid

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-11-21 17:04
    http://forums.parallax.com/showthread.php?p=543384

    shows a good method of encoding that can be stored in a table to be fectched before using a single subroutine to send out the ditdahs.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2005-11-22 21:06
    Oldies but goodies Morse code comes from BASIC Stamp 1 application note #8, MORSE.BAS. KC8QNO modified that for the BS2 to create the morse code beacon program found at <http://forums.parallax.com/showthread.php?p=543384>. A very similar program also appears by KB8AOB (Richard Clemens) in the book on Communication Projects collected by Tom Petruzzellis. That code can be cleaned up a lot and generalized using the great PBASIC 2.5 syntax.

    I've attached my own revision of the program. As a demo it sends canned messages from eeprom and the "morSend" subroutine can take ascii characters that come from a keyboard or a measurement. This one includes even obsure punctuation and procedure codes. There is a condensed version of this that sends only numerals to be found in chapter 2 of Appled Sensors (Stamp in Class).

    Enjoy!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com

    Post Edited (Tracy Allen) : 11/27/2005 3:08:58 AM GMT
  • NewzedNewzed Posts: 2,503
    edited 2005-11-23 18:17
    With a little bit of Conditional Compilation help from Tracy and Jon, I finally finished my Code Sender program.· Code Sender is a misnomer - it should really be Code Genertor or Code Trainer.· However..........

    I wrote this program to improve my code speed, which was getting a bit rusty.· However, it works so well I thought I would post it for those who want to learn code or for those who want to increase their speed.· The program contains a Conditional Compilation, so even though it was written for a BS3E, it will work with any Stamp from the BS2 up.· All you have to do is change the directive.

    By changing the value of the constants bspeed and dly, you can run the program anywhere from 5 wpm to better than 20 wpm.· The note frequency is set at 1000Hz and is best left alone.

    The code generated is contained in 5 DATA stements.· Each statement contains 6 groups of 5 characters comprised of letters and/or numbers, and is separated from the preceding statement by a 2 second pause.· The last group of each statement is a 5-letter word.

    Hope someone finds this of use.

    Sid
Sign In or Register to comment.