Shop OBEX P1 Docs P2 Docs Learn Events
Comma separated values (CSV) - Into a DAT table — Parallax Forums

Comma separated values (CSV) - Into a DAT table

SnyggisSnyggis Posts: 14
edited 2009-06-14 19:00 in Propeller 1
I am trying to load a comma separated value file into to a DAT table on my propeller chip. I have been trying to use "Variable := Debug.getDec" however this seems to only load one value at a time.

It seems that I have two problems, one is getting the propeller to accept the data in the chunks between the commas, and then putting it into a DAT table.

Does anyone know how this is done, or can direct me to information on this?
Also, does anyone know if hyperterminal, or the parrallax serial terminal, can directly read a CSV file directly, instead of me having to copy and paste?

Thanks!

Comments

  • KyeKye Posts: 2,200
    edited 2009-06-13 16:01
    If the data can be loaded before programing the chip use the "file" command on the spin compilier.

    Otherwise, use hyperterminal to send the file over the serial line at a low baud rate so that the propeller chip has time to process the data.

    What you should do is read one byte in at a time until the comma comes in. At that point turn the comma into a zero and use the numbers library to convert the decimal string into a pure binary number.

    Then load that number into the table and move on.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2009-06-13 16:15
    In hyperterminal preferences you can set delays between bytes etc and leave the Baud rate high. If a high delay value proves succesful then reduce the delays down until it fails again. There may be some information to be got if you know what the delay has to be.
  • SnyggisSnyggis Posts: 14
    edited 2009-06-13 16:15
    Thanks for the help. I will be constantly updating the CSV file, and have the propeller constantly checking it for changes. Sounds like I should use the hyperterminal. I am just learning how to use "FullDuplexSerialPlus" do you know if it has an option to read data one byte at a time?
  • StefanL38StefanL38 Posts: 2,292
    edited 2009-06-14 19:00
    Hello Snygis,

    receiving one byte at a time is exactly what FDX+ does
    with the method rx.

    the fdx+-object has a receivebuffer of 16 bytes.
    this means you can receive 16 bytes at max 115200 baud
    without loosing a byte.

    there are modifications of the fdx-object with bigger buffers

    what baudrate are you using ?
    how many bytes is your csv-file big

    I did not test how fast you can store away received bytes.

    As there exists a serial-object that does ALL the bit banging it SPIN at max 19200 baud
    it should be easy for to store away bytes in SPIN that were received at 19200 baud
    from the assembly-driver used by the fdx+-object

    best regards

    Stefan
Sign In or Register to comment.