Shop OBEX P1 Docs P2 Docs Learn Events
Writing a 18 bit variable onto an SD card — Parallax Forums

Writing a 18 bit variable onto an SD card

dodgerdodger Posts: 37
edited 2009-03-29 02:21 in Propeller 1
I am trying to write a stored varible onto my SD card.·

I have tried by using

··· sdfat.pwrite(string("torque: ",13),11)
··· sdfat.pwrite(string(@MyStr,13)18)

I am trying to save 18 Characters and delimit it with a return..



Could i get some direction on how I should proceed?

Thanks

Comments

  • mctriviamctrivia Posts: 3,772
    edited 2009-03-29 02:12
    well as a note I believe pc use 13,10 for return and line feed.

    also 18 characters is 18*8 bits. note sure what code is used to write though.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Need to make your prop design easier or secure? Get a PropMod has crystal, eeprom, and programing header in a 40 pin dip 0.7" pitch module with uSD reader, and RTC options.
  • dodgerdodger Posts: 37
    edited 2009-03-29 02:16
    ok i figured it out.. but i have some un expected characters and some missing characters...
  • Mike GreenMike Green Posts: 23,101
    edited 2009-03-29 02:21
    When you ask for help you really have to give more information, like what you're trying to do in some detail. Otherwise, we're guessing.

    In your first statement, you have 'string("torque: ",13)'. This is a 9 character string terminated by a zero byte. The first pwrite needs a matching count of 9.

    In your second statement, you have 'string(@MyStr,13)'. I don't know what you're trying to do, but, if you're using something like Extended FullDuplexSerial and it's storing the input data in an array called 'MyStr', then '@MyStr' is already an address (what pwrite needs). You'd use 'sdfat.pwrite(@MyStr,strlen(@MyStr))'. This doesn't add a return. You could use 'sdfat.pputc(13)' for that.

    If you're using some other routine that produces a string in a supplied byte array, this works the same way.
Sign In or Register to comment.