Shop OBEX P1 Docs P2 Docs Learn Events
Binary files with FAT16 driver from objext excange? — Parallax Forums

Binary files with FAT16 driver from objext excange?

RubberduckRubberduck Posts: 11
edited 2008-02-14 15:10 in Propeller 1
I wonder if it is possible to change the driver to be able to write binary files (diffrent from the original ascii-files)? Or is there an easier way of doing this? Please give a hint on how to proceed.

I will store only numbers from an ADC.·I would like to be able to skip the conversion from a digital number to a ASCII-formated text.


Hope you can make sense of my writing?

/Andreas

Comments

  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-02-12 21:24
    Just use the pwrite or pputc functions. If you want to write longs just use pwrite(@long,4).
  • RubberduckRubberduck Posts: 11
    edited 2008-02-13 17:04
    Thx steven for your reply.

    I'am using pwrite [noparse]:)[/noparse]. If the value from ADC is 3650 this will be stored in the file as ascii: (DC4 - a control byte) and B. I would like to have the number 3650 directly in the text file. Yes, I can use a hex dump- program (or simular) to see the number but me want to import the txt file that propeller creates in to another program to draw a nice graph.

    Any idea on doing this easy?

    /AK
  • Mike GreenMike Green Posts: 23,101
    edited 2008-02-13 17:14
    Download and look at the "Format" object from the Propeller Object Exchange. This is a general purpose text input and output package that you can use to format a nice line of text with any conversions you may need, then you can use pwrite to write the text to the file.

    You can also take the hex and decimal output formatting routines (hex and dec) from FullDuplexSerial (which comes with the Propeller Tool) and modify them trivially to write using pputc instead of tx and that will let you do what you want.
  • RubberduckRubberduck Posts: 11
    edited 2008-02-14 15:10
    Thx Mike!

    I will look in to that.

    /AK
Sign In or Register to comment.