Creating text files using PBASIC...
robo04
Posts: 7
Is it possible to create text files using other programming lanuages and somehow merge the two languages together?
Comments
Do you have an example of what you would hope to do?
Strictly speaking, the Stamp Editor doesn't do any merging. There's no include facilty for example. You could use some other program to do the work like a scriptable text editor or a language like AWK designed to manipulate text files. The Stamp Editor (and the Stamp) can store text data in its EEPROM and a program in the Stamp can access the text and do something with it. I'm not sure if this is what you're talking about.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Craig Eid
www.TriadRD.com
Post Edited (Craig Eid) : 3/4/2009 12:09:45 AM GMT
thanks for your answer. Here what I want to do
I have a program on my Basic Stamp 2 module. I have two word-sized variables, named "latitude" and "longitude", in this program on the RAM which belongs to Basic Stamp 2 module.
The Basic Stamp 2 module is connected to the PC using COM port #7.
I want to create a text file on PC (using for example JAVA or C++), named "test.txt", and save the contents of my two variables in pbasic program (latitude and longitude) on that text file.
So my question will be how can I get this to programs communicate with each other?
how can I send serial data (or in other word content of a variable) from a pbasic program to another program on PC using a specific COM port using SEROUT command?
your guess is pretty close to what I had in mind I guess. I'll appreciate if you can explain a little bit more.
DEBUG SDEC latitude," ",SDEC longitude,CR
or
SEROUT 16,16468,[noparse][[/noparse]SDEC latitude," ",SDEC longitude,CR]
See the Stamp Basic Manual for an explanation of these statements.
This will send a signed value. If you're using unsigned values, use DEC instead of SDEC.
On the PC side you'll need some kind of program in some convenient programming language that allows you to open a COM port and receive characters from it. The DEBUG statement transmits at 9600 Baud with 8 data bits and 1 stop bit. Your PC COM port will have to be configured for that.
Your program will have to convert the received digits to a numeric value. If the number ends with a space, it's the latitude. If it ends with a return (13), it's the longitude.
thank you for the response. I found it quite helpful.
I am probably going to use JAVA or C++ on the PC side.
do you think you can help me with finding the appropriate command (in C++ or JAVA) that allows me to open a COM port and receive characters from it?
"PLX-DAQ Real-Time Data Acquisition for Microsoft Excel
The Parallax Data Acquisition tool (PLX-DAQ) software add-in for Microsoft Excel acquires up to 26 channels of data from any Parallax microcontrollers and drops the numbers into columns as they arrive. PLX-DAQ provides easy spreadsheet analysis of data collected in the field, laboratory analysis of sensors and real-time equipment monitoring."
-Phil
I used PLX-DAQ and I sent the contents of two word-sized variables ("latitude" and "longitude" in PBasic program) to the PLX-DAQ macro on PC.
I have this problem now. in PLX-DAQ it always draws "latitude" versus "time" OR "longitude" versus "time" or you can even have "latitude" and "longitude" in one diagram, both versus "time" though (in two separate graphs).
I need to have "latitude" versus "longitude" in just one graph. can anybody help me with that