Shop OBEX P1 Docs P2 Docs Learn Events
Serial porting question — Parallax Forums

Serial porting question

Don MDon M Posts: 1,653
edited 2011-04-27 07:33 in Propeller 1
I have a serial device connected to P6 & P7. It uses the Full Duplex serial object to communicate. If I wanted to directly communicate with this device (for setup reasons I don't want to un-solder it) is is possible to utilize Full Duplex serial again with Parallax Serial Terminal on P30 & P31 in the same cog and just "pass through" the data back and forth between P6/P7 and P30/P31?

Could someone please pass on some example code how to "join" these different ports to one another? Or can it even be done? The serial device communicates with the prop at 115K baud so I'd want to communicate with PST at 115K. I would download this code just to program the device then reload the original spin program. I am just wanting to be able to setup the serial device without having to remove it. Something down and dirty simple.

Serial device <--P6/P7->Propeller<-P30/P31->PST via PC USB

Thanks.
Don

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-04-27 07:33
    Yes, that's exactly how you'd do it. You need two instances of FullDuplexSerial and, after initializing both of them, your main cog would simply check for a character available from one instance. If so, it would get the character and transmit it to the other instance. It would then do the same thing going the other way. Something like:
    repeat
       if (temp := port1.rxcheck) <> -1
          port2.tx(temp)
       if (temp := port2.rxcheck) <> -1
          port1.tx(temp)
    
Sign In or Register to comment.