Shop OBEX P1 Docs P2 Docs Learn Events
cogserial - fullduplex smart serial using interrupt - Page 6 — Parallax Forums

cogserial - fullduplex smart serial using interrupt

12346»

Comments

  • @msrobots

    Please look at the above code. Is there an issue with cogserial at 9600 baud?
    Thanks
  • Hi @pilot0315,

    I have to look into that error, but you might can use my other attempt of a 2-port driver, this one just uses one file and is more in line with FastSpin's drivers.

    Enjoy!

    Mike
  • @msrobots
    Thanks I will look at that.
  • @msrobots

    Thanks for the try but getting the same. Hex spits out hex, dec spits out numbers str spits out gibberish.

    Martin
  • @msrobots

    Same with cogserial
  • pilot0315 wrote: »
    @msrobots

    Thanks for the try but getting the same. Hex spits out hex, dec spits out numbers str spits out gibberish.

    Martin

    you have to do something wrong.

    can you post some code to look at?

    Mike
  • @msrobots


    Sorry for not sending the code sooner. I cannot get anything working at 9600 baud. Tried serveral gps models from parallax all have 9600 baud.
    Have had excellent experience with the P1 doing this in PropC or Spin. I looked at the Cogserial code as well as the fullduplexserial2 and I do not see anything obvious to me. Eventhough I am not an expert in asm language.
    Thanks for the help.

    No rush.
  • as I was thinking it looks like you are using strings wrong.

    Spin does not have types so a string is just a address in memory pointing to some memory location hopefully ending with a byte 0.

    ser.str(string("test",10,13)) should work and output the text "test" followed by a new line.

    It basically defines a 'string' of bytes in memory like

    byte "test",13,10,0 and gives the memory address of that location to the function ser.str(…)

    gpsraw := gpsd.rx
    ser.str(gpsraw)

    can not work

    gpsraw is a long, a memory address where you can access 4 bytes. so your rx receives the lowest byte in gpsraw. As it should do. Say you get a "A" then gpsraw will be the number 65 stored at @gpsraw in memory.

    But this is not a string. It is just a number in one of the 4 bytes described by gpsraw, defined as long.

    ser.tx(gpsraw) will give you the character received...

    Mike



  • @msrobots

    I thank you for your help. I am attempting to port from the code in spin and PropC from P1. So we shall see.
    Again thanks.
    Martin
  • Yeah, if you more familiar with C, use C.

    With fastspin you still can use FullDuplexSerial2.spin, there are examples you define FullDuplexSerial2.spin as a class and can use it from C.

    Enjoy!

    Mike
Sign In or Register to comment.