how to read the data in PBASIC to other program? --- help~~
blue yiu
Posts: 5
Hi, I am a new user. But what I want to do is to export the variable in real time
to other program (e.g. Matlab or C or.....). If anyone know how I can export the variable
to a file in real time which I can read from other program. That will be great.
thanks a lot.
to other program (e.g. Matlab or C or.....). If anyone know how I can export the variable
to a file in real time which I can read from other program. That will be great.
thanks a lot.
Comments
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Yesterday is history, tomorrow is a mystery, and today is a gift.
That is why they call it the present.
Don't have VGA?
Newzed@aol.com
·
Can it output to a pure text file? If yes, then other program might be able to share the same data in the file.
Any help would be appreciate! Thanks a lot.
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Yesterday is history, tomorrow is a mystery, and today is a gift.
That is why they call it the present.
Don't have VGA?
Newzed@aol.com
·
Candy, how can you store time if you don't have an RTC?· Did you mean what you wrote in the above statement?
And Happy Valentine day to you!
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Yesterday is history, tomorrow is a mystery, and today is a gift.
That is why they call it the present.
Don't have VGA?
Newzed@aol.com
·
I actually not sure what is RTC ( sorry =( ). But here you go:
time VAR Word
DO
PULSOUT 15, 5
PULSIN 15, 1, time
DEBUG HOME, "time = ", DEC5 time
PAUSE 100
LOOP
www.parallax.com/detail.asp?product_id=604-00005
The Basic Stamp can't keep accurate time by itself, so it needs the help of a real time clock. The RTC keeps the time, and the Basic Stamp reads the time from the RTC. If you need to log that info with Matlab or C, you could write a program that sends a command to the BS2 that tells it to return the time. The BS2 will read the time, and write it to the serial port, where your program reads the value, then writes it to a file.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
-Phil
If I understand you correctly, you wish to get the contents of the "time" variable from the "read the distance sensor" program on your Stamp into the PC for display/processing in "real time". Does this sound correct?
It looks like your program gets continuous readings from the distance sensor. Then your program sends the value of your "time" variable to your PC using the DEBUG statement. Now what you need is a way to "capture" that value on the PC side for processing. As long as your Stamp IDE software is not running, any program on the PC that can read the serial port can receive this value...StampPlot is one way, programming something to listen to the serial port is another. The important thing to remember is that your Stamp programming IDE must be closed so that it does not keep any other program from getting to the serial port.
I think we ran into a little language speed bump which led to discussions about the need for a real-time clock. If you really need to know the time a reading being transmitted to the PC happened (as opposed to the value of the "time" variable that is the "time of flight" of your sonar signal), this is usually handled by the PC when it is being used as the data logger. RTCs become necessary when the data collection is handled by a "stand-alone" system and then later "downloaded" to the PC.
If you really need a "file" to be transmitted, then Phil's suggestion should work for you.
I hope I haven't confused things too much.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Truly Understand the Fundamentals and the Path will be so much easier...