Shop OBEX P1 Docs P2 Docs Learn Events
Can Basic Stamp write output to a PC — Parallax Forums

Can Basic Stamp write output to a PC

SydSyd Posts: 13
edited 2011-11-06 00:28 in General Discussion
Hi Everyone,
I have a Basic Stamp model BS2pe and I would like run the following continuous time program:

1. Use the basic stamp to output frequency measurements (from some given source) every 500ms to a text file on a PC.
2. Use a socket program to continually read the frequency measurements from the text file while it is being written
3. Send the frequency measurements to another PC for real time analysis

Can the basic stamp help with the above mention tasks? Thanks.

Cheers!
Syd

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-11-05 18:46
    Any of the Basic Stamps do communications with an attached PC by sending strings of data over a serial port to the PC. There has to be a program on the PC to receive these and do something with them. Normally for debugging, there's a terminal program, possibly the debug window of the Stamp Editor, used to display what's sent to the PC. There are existing programs, like StampPlot Pro which are designed to display received data (in a particular format) as graphs or to possibly write the data to a text file on the PC. There are other programs that can format the data for use by spreadsheet programs like Microsoft's Excel. Anything else you'd have to write yourself or get someone else to write it.

    There is an external device made by Netburner that can be attached to a Basic Stamp. It acts as a webserver whose webpages (downloaded over the Internet) can contain embedded text provided by the Stamp. When Parallax sold it, it was called the PINK. Netburner still sells the hardware and the special firmware for Stamp use is downloadable from Netburner.

    Parallax also makes a webserver called the Spinneret which uses a Propeller. You could use a Spinneret to put data from a Stamp onto the Internet. You might look at the Spinneret webpage on Parallax's website to see what variety of software is available at present.
  • SydSyd Posts: 13
    edited 2011-11-05 19:31
    Hi Mike,
    Thanks for your prompt reply. On a side note, assuming I have two PCs (A and B), such that PC A is connected to the basic stamp (and collects frequency measurements), I am experimenting with some specialized network devices to transfer the frequency measurements from PC A to PC B (B then performs some analysis). So I intend to use some sort of socket programming to send "frequency packets" across the network.

    In this experiment, the purpose of the basic stamp is to obtain frequency measurements in real time (again, say every 500ms) and log them to a PC. While this data is being logged, I will use my socket program to read the measurements (in real time) and send the "frequency packets" to PC B. The important question is:

    Can I read and write to the same file at the same time (keeping in mind that as the Basic Stamp sends data, I am continually logging this data and also continually using my customized script to read the same file)?

    It appears that StampPlot allows one to log the data, but it does not specify that the file where the data is logged can be accessed simultaneously. Off hand, do you know if StampPlot supports this feature (simultaneous read/write)? If you're not to sure, that's ok. I can download and try it out.

    Thanks,
    -Syd
  • Mike GreenMike Green Posts: 23,101
    edited 2011-11-06 00:28
    You're probably going to get into trouble reading and writing the same file at the same time. Disk I/O is buffered and I don't know if Windows is smart enough to make sure that two different programs can access the same block properly at the same time. In any event, the programs involved have to be written for the task. StampPlot Pro would not be able to do it.

    The Stamp could send the data twice to the PC over two separate serial channels with different formats to the data if you need that. One serial port would be used by something like StampPlot Pro (or other logger) and the other serial port would be used by another program/script which would send the data out over the Internet.
Sign In or Register to comment.