Shop OBEX P1 Docs P2 Docs Learn Events
FullDuplexSerial.spin — Parallax Forums

FullDuplexSerial.spin

JTCJTC Posts: 60
edited 2007-04-14 17:28 in Propeller 1
· How do you make more than one instantance of the FullDuplexSerial.spin object.
I tried an array and used different RX and TX pins but it would only see on of them.
I don't have my code with me as I am out of town but thought I would ask.
Thanks
Jim

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-04-14 17:23
    An array works just fine. You simply declare:

    OBJ serial[noparse][[/noparse] 2 ] : "FullDuplexSerial"

    You have to initialize each one like:

    serial[noparse][[/noparse] 0 ].start(31,30,%0000,9600)
    serial[noparse][[/noparse] 1 ].start(27,26,%0000,9600)

    The Baud and mode bits can be different if you want. To transmit out each do:

    serial[noparse][[/noparse] 0 ].str(string("Test string",13,10))
    serial[noparse][[/noparse] 1 ].str(string("Duplicate string",13,10))

    You could also use two different names rather than an array like:

    OBJ
    console : "FullDuplexSerial"
    device : "FullDuplexSerial"
  • JTCJTC Posts: 60
    edited 2007-04-14 17:28
    Thanks Mike,

    I Will give that a shot. I thought I had tried it this way but ..... Guess not.
    Thanks
    Jim
Sign In or Register to comment.