Shop OBEX P1 Docs P2 Docs Learn Events
Help with FullduplexSerial — Parallax Forums

Help with FullduplexSerial

Mike GMike G Posts: 2,702
edited 2008-01-02 22:36 in Propeller 1
I'm trying to wrap my brain around FullDuplexSerial. I'm having difficulty understanding how the jmpret command is working in this context.

                        mov     txcode,#transmit      'initialize ping-pong multitasking 
...
receive                 jmpret  rxcode,txcode         'run a chunk of transmit code, then return 

...
transmit                jmpret  txcode,rxcode         'run a chunk of receive code, then return





I see how calling receive jumps to transmit but what happens next? Does "jmpret txcode,rxcode" cause the receive code to run again?

Comments

  • LeonLeon Posts: 7,620
    edited 2008-01-02 20:15
    Have you looked at the description of jmpret in the manual?

    At that point the program alternates between the receive and transmit routines.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle

    Post Edited (Leon) : 1/2/2008 8:21:42 PM GMT
  • Mike GMike G Posts: 2,702
    edited 2008-01-02 20:27
    Why Leon, yes I have read the manual - Jump to address with intention to “return” to another address page 374. I looks to me that the jmpret would ping-pong between the two addresses forever and never execute the code below. Obviously that's not what is happening.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2008-01-02 20:59
    Hi Mike, pay a little closer attention to the labels provided for JMPRET, you'll see the source operand is the "destination address" and the destination operand is the "return address". So the first line primes the jump to the transmit section of code, the next line stores the current program counter + 1 into the register labeled rxcode (the re-entry point back into the receive code), then a JMP to the address contained in txcode is taken (to the primed address for the transmit code). When the third line is executed the reverse takes place, PC+1 is store in register txcode and a jump is made to the address contained in rxcode.

    I think your confusion stems from the destination address being store in the source operand (where one would naturally think destination address = destination operand).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • LeonLeon Posts: 7,620
    edited 2008-01-02 21:04
    jmpret executes the code at the destination address. I don't see the problem.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • Mike GMike G Posts: 2,702
    edited 2008-01-02 21:22
    Got it!

    Thanks Paul
  • deSilvadeSilva Posts: 2,967
    edited 2008-01-02 22:36
    Mike,
    you will get additional insight reading that thread
    http://forums.parallax.com/showthread.php?p=681299
    where such techniques have been discussed in detail some time ago...
Sign In or Register to comment.