Shop OBEX P1 Docs P2 Docs Learn Events
[SPIN] receive data from port & write to file — Parallax Forums

[SPIN] receive data from port & write to file

amajoramajor Posts: 3
edited 2013-02-25 11:37 in General Discussion
Hello all,

I am working on a student satellite project where we are sending sensor data (6D inertial data and 2D GPS coordinates) from the satellite through a radio modem and receiving through a radio modem connected to a Propeller chip package. The Propeller chip package is connected to a USB port on a computer. We send a command through the PST to request and receive the sensor data. Next, we will periodically send sensor data (every 30 seconds?) without any commands. We would like to write all of this sensor data to a file. Currently, we do not know how to write to a file using data received by the port. Any ideas on how to access the port with Spin and not the PST :nerd:?

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-02-13 18:47
    So is the file you want to write on the PC hard drive?

    This sounds more like a PC software issue than a Spin issue.

    Here's a couple of links that may help.

    Phil's Propeller to PC .cvs file interface
    AppNote #18
  • Mike GreenMike Green Posts: 23,101
    edited 2013-02-13 19:43
    You might also try to clearly state which data goes where and under control of which device. I assume that PST refers to the Parallax Serial Terminal program. Do you want the Propeller to write to an attached SD card file or do you want the PC to write the data coming into PST to a disk file? If it's the latter, you can't. PST doesn't have that capability. There are a variety of other terminal programs for the PC that will do this for you.

    If you want the Propeller to log the data to an SD card file, look at AppNote #6.
  • amajoramajor Posts: 3
    edited 2013-02-18 11:07
    I want the PC to write the data coming into the PST to a SD card or a disk file; either one is fine. There is data coming into COM 3 (we use that USB port only) from a Xtend Radio and we would like to store all of the data into a csv file. I think Phil's Propeller object will work, but I would still like to know how to store data from the COM port
  • Mike GreenMike Green Posts: 23,101
    edited 2013-02-18 16:02
    It's still not at all clear what you're trying to do, where the data is flowing. What's connected to the PC? What's connected to the Propeller? When you say "data coming into the PST", what do you mean? PST is a terminal program that normally receives data from a program running on a Propeller and it displays the received data on the PC's window. You can also type on the PC's keyboard and PST will send the typed characters to the Propeller. It's not at all clear where the Xtend Radio figures in. A diagram would help. The Application Note describes how to use the SD card library routines to write to a file. Is that what you want?
  • amajoramajor Posts: 3
    edited 2013-02-25 11:25
    Hi Mike. I've attached a PDF witha diagram. Let me know if you need more details. The Propeller is connected to the PC and the program on the Propeller is receiving data from the Xtend Radio, which is connected to the Propeller. A phone transmits data through another radio modem, and the Xtend Radio receives this data every 30 seconds and instead of us copy and pasting the values displayed on the PST PC Window, I want to just write that data to a file.
  • FranklinFranklin Posts: 4,747
    edited 2013-02-25 11:37
    If you want the data stored on the PC you will need to write a program on the PC to do that. You could use any programming language you have access to that allows the input of serial data from a comport and writing to a file. Basic, python and most variants of c will do this.
Sign In or Register to comment.