Author Options:

If I use the serin command where is the serial data stored? Answered

 I am trying to get a GPS module outputting NMEA sentences in ASCII through a serial port to to store it's once per minute output in my picaxe 18X.
From here i hope to read these sentences and using a look up table assign each letter or number that has been read a morse code form. This will then be sent to a 433mhz radio module and received on a scanner.
I have programmed standard pics before but only using standard inputs and don't really understand where or in what form variables are stored on the picaxe chip so am therefore a bit confused as to how to go about using the serin command. Thanks for any help!


How are you programming your PIC ? What language are you using ?

 I'm using PICAXE programming editor.... the free editor which is downloadable from the main PICAXE site. This program uses basic to write the program and has a SERIN command built in. I can see how i can assign each character coming into the chip to a variable. What i'm not really sure of is how many variables there are that i can use. The PICAXE site tells me that the data memory is 256 +2ic but does this mean that i can assign 256 different variables?
The incoming data is in the form of NMEA GPS sentences and could be 80 or 90 characters long.

The other bit that i'm trying to get my head around is how to tell the picaxe chip to look up a variable and turn it into my own version of morse code. ie how to turn the letter A stored in memory into a pulse , a B stored into a longer pulse and a C stored into a short pulse + a longer pulse.
Is a look up table the easiest way to do this for an alphabet and series of numbers or is there a better way?
Apologies for being a bit simple with this but I really appreciate the help!

Yes, you'd have 256 bytes available for variables. If you can make sure your variables are only 8bits long, you'll be OK.

All you need to do is create an array - if you're using BASIC, and its "fully featured" BASIC always had a way of reading fixed data, the "READ" command.

The data will unfortunately then be stored in your RAM space, so that's another 26 bytes shot. Numbers you can write code to generate, letters you'll have to store.

Sometimes its easier to use assembler !

If you get really stuck, I'd change processor and use the 8052 instead. This guy gets an entire basic interpreter into one, so you can write code directly in the chip.


Easier to work with than the PIC, and more internal memory to play with.