I am using a P89c51 base microcontroller and I need to store data coming from a GPS device. Questions: 1.Is it possible to save the data coming from the GPS,in the 64k Flash memory? For example 32kytes for the code and 32kbytes to store the data?How?
Hi, I believe the code will not have more than 8 kbytes(I am almost at the end and so far it has 5KB).So I belive that 64KB-8KB=56KB will be enough.But your explanation will be much useful. Now I am facing burst errors.I receive the data via port series at 4800 baud.So far I running and debuging with the keil software.My question is, do you have any idea how to detect automaticaly the baud rate? In real environment the program will run from the micro controller and the GPS migh have any baud rate so I have to find a way of the program be able to detect any baud rate.
You can find some code to do baud rate detecting ("autobaud") at http://www.8052.com/codelib.phtml The basic idea is simply to try to time the width of a bit on the serial port by watching the I/O pin. (You can perhaps help the software out by tying the serial port receive data line to an timer edge capture pin if you have one to spare.) The hard part is knowing how many bits the time between two edges represents. It helps if you know what the transmitted character was supposed to be (for example, carriage return to get a log on prompt) so that you know the received bit pattern. Characters with a least significant bit of 1 are nice, because they cause a transition immediately after the start bit, and so you can try to time the width of the start bit. Another technique is to initialize the serial port to operate a high speed, so that it will oversample data transmitted at slower speeds, and thus generate more characters than are transmitted. Then the receiver examines those characters to see what bit pattern you actually received. Since baud rates are commonly nice multiples, you get repeated bits in the received data, and can just use those characters to determine the actual baud rate. See this article: http://www.iol.ie/~ecarroll/autobaud.html Note that your GPS device will have to be able to send data out without being asked, so that you'll have some characters on which to try to autobaud. I assume it just sends out a constant stream of reports, once per minute, all automatically.