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?
There's a reply on your earlier thread: http://www.keil.com/forum/docs/thread2787.asp I thought I had one there, too, but I don't see it now. Oh well. As I recall, from glancing at the data sheet earlier, you should be able to use the internal flash on that particular part for both code and data, as it is divided into multiple blocks. So, you can choose a block (or blocks) to devote to storing data instead of code. All the flash is mapped as program space, however, so you'll have to use the Philips routines in the boot ROM to actually program and erase the flash. Also, the flash in the part is specified for only 10,000 erase cycles, which is not a lot by modern standards for data use. (The limit is fine for program store -- are you really going to upgrade the software 10,000 times? -- but depending on your application, it might not be enough lifetime for data logging.)
Thanks for the idea. I intend to save data at each minute.Weekly, I plan and hope, the data will be transfered to a pc so I can still save data.
Well, then, if on a weekly basis you transfer the data to a PC and then erase the flash in preparation for another week's worth of data, the internal flash would last 10,000 / 52 = 192 years. That ought to be enough. On the other hand, the memory will have to store 7 days * 24 hours * 60 minutes = 10080 records in one week. With 32k block of flash, that only gives you 3 bytes per record. You might need a little more room, so an external memory device might still be called for.
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.
I finally finished the program.The code is 6Kbytes and it occupies 3Kbytes on XDATA memory.During the acquisition, as told before, it is necessary to store the data coming from the GPS to the 64kB Flash memory. The problems(doubts) are: 1.How to store( and erase) this information to the flash without my intervention (automaticly) during the remote working? I am thinking about to make a function dedicated to do it,but still dont know exacly how. 2.I read about WinISP, but it seems to be useful only to load the code to the microcontroller.There is also In Application Program but I could not find information on how to call PGM_MTP. 3.How to define the address where I want to start storing information?
You need to read in the device datasheet the section about IAP (In-Application Programming). Under http://www.keil.com/support/docs/2045.htm you can find C interface functions for Philips IAP.
Hi Amil,Where to store the data? You must store insight your RAM 1. The life cycle of your EEPROM or Flash is limited may be 100K or 1M 2. You need some times to write your data to EEPROM or Flash, 3. Receiving GPS under ISR, So you may be face some timinng probelm, The best way you store your data into RAM and periodically update to PC, Other way you can save the data only if you chnage your position simply if you received differnt coordinate from GPS