Shop OBEX P1 Docs P2 Docs Learn Events
Serial communication issues 3 objects — Parallax Forums

Serial communication issues 3 objects

Tom_005Tom_005 Posts: 7
edited 2009-05-11 06:49 in Propeller 1
I am getting strange results maybe some on has an Idea what I am doing wrong.
I am trying to build a test rig, to monitor some RS422 communication on a system I built.
I just want to log both sides of the conversation while passing it along. I am using AD7306JNZ, they work fine of RS422.
When i remarked out one side of the communication every thing seems fine. I have tried remarking out both sides and the other side works.
When both sides are up I get very strange results.
Any thoughts??

<

PUB start

  term.start(31, 30, 0, 19200)  

  serial_1.start(16, 17, 0, 14400) 

  serial_2.start(0, 1, 0, 14400) 




repeat
  
        'side 1   
        if(a:=serial_1.rxcheck) == -1 
         'term.Str(string("no")) 

        else
          serial_2.tx(a)
          term.Str(string("COM: "))
          term.dec(a)
          term.Str(string(13))
             


       'side2
       if(b:=serial_2.rxcheck) == -1 '
     '   term.Str(string("no"))  

       else
         serial_1.tx(b)
         term.Str(string("CCU: "))
         term.dec(R2)
         term.Str(string(13))
>

Comments

  • MagIO2MagIO2 Posts: 2,243
    edited 2009-05-11 06:49
    Welcome to the guessing thread ... ;o)

    What does your strange results look like? What is R2?

    But I'd guess that it's simply a timing problem. Your code get's not done until the next byte is received. So you'll miss bytes.

    Why do you send from one serial to the other? Why don't you connect the tx of serial_1 with rx of serial_2 and tx of serial_2 with rx of serial_1? Do you plan to intercept or send additional data?
    You could still connect both tx to two propeller rx pins and listen.

    If you need interception, you could put the received bytes into a FIFO-buffer and have an additional COG running, which outputs the buffer to the terminal. And I'd suppose to use a higher transfer rate for the terminal connection. That'll give you some time to add strings to the output.

    Post Edited (MagIO2) : 5/11/2009 6:54:38 AM GMT
Sign In or Register to comment.