PDA

View Full Version : Use of programming port from code ?



FFMan
07-26-2005, 08:02 PM
I have a stamp based shift light in my race car, and I want it to record some data which I can then download to a laptop after the race.

From my code, can I detect the connection of a laptop to the serial programming port, and then programmatically download the data (using a simple protocol I can develop), or will I have to utilise other pins and create a serial port specifically for data download ?




Bruce Bates
07-26-2005, 08:41 PM
FFMan -

If you can keep the necessary data that you eventually want to dump in the Stamp RAM variables, or use the scratchpad memory of the Stamp (presuming it has one), great. If not, then you will have to determine whether you can use the internal EEPROM or whether you'd be better off using an external EEPROM. The decision has to do with how often you are writing this data.

There is a finite life to how many times you can write to any given area of an EEPROM, so using the built-in EEPROM has its risks for data that is written quite often. We're speaking here of between 100,000 and 1,000,000 write cycles, so they do have a good deal of endurance under normal circumstances. There are certain types of external EEPROM which have almost infinite write endurance (see RAMTRON's FRAM).

If you SEROUT this saved data to the programming port (pin port 16) like so:

SEROUT 16, Baudmode, [OutputData1, OutputData2, etc ]

and there is nothing connected to the programming port, no harm is done. If there was a DUMP button (just a pushbutton or switch) included in the design, the data dump could be done again later, after a PC was attached to capture the data via Windows Hyperterminal or some other terminal application. Thus, if the PC is there, it will use it without checking for its existance. If not, later a second DUMP ONLY run/function can invoke the internal data dump routine for collection purposes.

Hope that helps your thinking.

Regards,

Bruce Bates

FFMan
07-26-2005, 10:14 PM
thanks - that was exactly what i had in mind. i'll either add a dump button or once the engine is switched off, the stamp could wait on a serin on that port could it, and if i send a character on that port, then it could serout the data ?

hear what you're saying on the eeprom, life shouldn't be a problem if i need to use that (not much ram left so i might have to)

1st real-life test of the project this weekend (Silverstone), so we'll see how basic functionality goes first....

thanks