Shop OBEX P1 Docs P2 Docs Learn Events
Need help to log serial stream to SD. — Parallax Forums

Need help to log serial stream to SD.

icecuberydericecuberyder Posts: 6
edited 2011-07-11 11:50 in Propeller 1
Hi All,

I need a bit of programming help.

I want to log a continous stream of serial data to a SD card, the serial data in question is from the ibus signal in my car, all the examples I have seen so far seem to look for a "stop" character like CR/LF/$00 to work with or log blocks of data, but the ibus stream does not have that, it does however use hex 00 to FF and everything inbetween.

I am using the standard OBEX full duplex serial, and rays SD card objects.

(If you have an ibus converter/interpreter, would you please post it to the OBEX?
or to this thread, or email it to me, even if it is incomplete and/or ugly.
I have seen some talk of ibus projects on the forums but nothing came of it.)

I am using Ray's PSM,
but the hardware side is not a problem, only my rusty programming "skills".

Comments

  • StefanL38StefanL38 Posts: 2,292
    edited 2011-07-11 06:25
    so if you just want to write the raw data coming from the ibus you would simply use the rx-method which delivers a single byte from the receivebuffer.

    or do you want to translate the bytes into cleartext-commands?

    keep the questions coming
    best regards

    Stefan


    *grin* hope you use a thermo-seat for riding icecubes. Or do you belong to the jackass-team? They prefer naked riding with frozen-egg-fixing :-)
  • icecuberydericecuberyder Posts: 6
    edited 2011-07-11 09:07
    Initially I would just like to log raw data to the SD card and maybe display it to screen at the same time (the psm can do easy tv mode), while I work out how to parse the ibus commands.

    In the long run I mean to use the psm as a replacement for my dead MID console, as well as GPS logging amongst other things as well.

    Heh, that Icecuberyder nick has been with me for about 25 years now.. invented some cold winter night here in Iceland, whilst dialling BBS's in the UK with my trusty old BBC :-)
  • AribaAriba Posts: 2,690
    edited 2011-07-11 11:50
    Ray normally uses the FSRW object for SD so the logging loop can look like that:
    if \sd.mount(sd_basepin) == 0
        if \sd.popen(string("log.txt"),"w") == 0
          repeat
            \sd.pputc(ser.rx)
          until <stop_condition>
          \pclose
    
    You need something to stop the logging (a buttons or so) I just wrote <stop_condition> in the code above.
    I don't know the SD card pins on the PSM, maybe you need mount_explicite() instead of mount.

    Andy

    P.S. I think ice cube riding and snowboarding as a beginner have much in common...
Sign In or Register to comment.