Shop OBEX P1 Docs P2 Docs Learn Events
Multiple serial ports on propeller? — Parallax Forums

Multiple serial ports on propeller?

WhelzornWhelzorn Posts: 256
edited 2007-10-31 03:00 in Propeller 1
I'm trying to gather data from a device on a serial port, so I use FullDuplexSerialExtended.
Then I need to have the propeller alter that data, then send it out a different serial port to my computer. but in my code I've got the object definition (SER : "FullDuplexSerialExtended") but for obvious reasons I can't do a SER.start(1, 2, %0000, 115200) and a SER.start(3, 4, %0000, 115200), because then I can't select which port I want to read to/write from (and it probably wouldn't work anyway).
So how do I set up two separate serial ports using the same serial object?
thanks, Justin

Comments

  • deSilvadeSilva Posts: 2,967
    edited 2007-10-31 00:21
    You do it the same way as instantiating any two objects:
    ser[noparse][[/noparse] 2 ]: "FullDuplexSerialExtended"
    


    or
    SIN: "FullDuplexSerialExtended"
    SOUT: "FullDuplexSerialExtended"
    


    Make sure the driver IS written for multiple instantiation (DAT section conformity) There is a tendency nowadays to frown upon this and request "singletons"....

    Post Edited (deSilva) : 10/31/2007 12:28:02 AM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2007-10-31 00:24
    To do the start:
    ser[noparse][[/noparse] 0 ].start(1,2,%0000,115200)
    ser[noparse][[/noparse] 1 ].start(3,4,%0000,115200)
    
    


    Similarly, you reference all the methods with ser[noparse][[/noparse] 0 ]. or ser[noparse][[/noparse] 1 ].
  • parts-man73parts-man73 Posts: 830
    edited 2007-10-31 00:43
    This discussion gives me an idea. I assume the above mentioned method will work with most any object? Even perhaps VGA?

    I thought about attaching 2 VGA monitors to 1 Propeller, and create some simple demo, like a bouncing ball that travels from screen to screen.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Brian

    uController.com - home of SpinStudio

    PropNIC - Add ethernet ability to your Propeller!

    SD card Adapter
  • Mike GreenMike Green Posts: 23,101
    edited 2007-10-31 00:55
    Yes, you can have multiples of most objects including the TV and VGA drivers. The only caution with these is that the screen buffers take a lot of memory, but I've used the TV text and VGA text drivers simultaneously with the TV used for debugging, works great!
  • deSilvadeSilva Posts: 2,967
    edited 2007-10-31 01:15
    This is the main and only reason for this idiotic duplication of the video control block.

    To my greatest chagrain many persons here take it for granted that you define a dozen VAR cells and make a copy of the DAT... nevertouch working code... This was the first thing deSilva removed from his drivers ... Sigh...
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2007-10-31 01:16
    Hey that would make some interesting multiplayer stuff...

    How about using the mouse/keyboard connections for two keyboards. (it's the same circuit) and
    two copies of the composite video driver (one for each monitor) for a little head-to-head gaming
    from one prop. I wonder if after all that one would have enough resources for a game of battleship?

    (Need more hours in the day....)

    Oldbitcollector

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Buttons . . . check. Dials . . . check. Switches . . . check. Little colored lights . . . check.

    — Calvin, of 'Calvin and Hobbes.
  • WhelzornWhelzorn Posts: 256
    edited 2007-10-31 03:00
    Hey thanks guys, this worked out great. I didn't want to have to re-type all of the instances where I used ser.tx/rx, so I just put a ser2 : "fullDuplexSerialExtended" up there with the other one instead of using ser [noparse][[/noparse] 2 ]. but this is great to know, because I wasn't quite sure what to search for, even if the search function worked [noparse];)[/noparse]
Sign In or Register to comment.