Announcement

Collapse
No announcement yet.

Trying to pass a REAL number to another domore using peerlink

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts


  • Trying to pass a REAL number to another domore using peerlink

    As the title says, Im trying to pass a Real to a PL to have it read by another domore, pl is unsigned word, how would I do this?


  • #2
    MEMCOPY your float into two consecutive PL registers, then MEMCOPY back to a float in the receiving Do-More.

    If implied decimal gives enough resolution, and you don't need negative values, do that. Multiply by 10 or 100 or 1000 or whatever into the PL, send the result, then divide that by the same factor on the other end and place in a Real. That will only take one register in the PL, which might be of value if you have a lot to send. Adding an offset, you could even send signed values.

    Comment



    • #3
      Source side: COPY R0 to PL0:R
      Destination side: COPY PL0:R to R0

      PL memory locations must be DWORD aligned to use casting like above example. The ":R" operator treats PL0 and PL1 like a real. And you don't really have to copy, PL0:R can be documented and used in code just like R0.

      If they aren't aligned, use PUBLISH and SUBSCRIB instructions.

      Comment



      • #4
        Originally posted by BobO View Post
        Source side: COPY R0 to PL0:R
        Destination side: COPY PL0:R to R0

        PL memory locations must be DWORD aligned to use casting like above example. The ":R" operator treats PL0 and PL1 like a real. And you don't really have to copy, PL0:R can be documented and used in code just like R0.

        If they aren't aligned, use PUBLISH and SUBSCRIB instructions.
        If I put the :R after PL1 it errors

        Comment



        • #5
          Originally posted by trimixdiver1 View Post

          If I put the :R after PL1 it errors
          It has to be on even numbers (0, 2, 4, etc). PL memory is 16 bit, and has to be accessed on 32 bit (DWORD) boundaries to use the real cast. If that isn't an option, use PUBLISH and SUBSCRIB instructions to do the copy. They can handle unaligned data.

          Comment



          • #6
            Originally posted by BobO View Post

            It has to be on even numbers (0, 2, 4, etc). PL memory is 16 bit, and has to be accessed on 32 bit (DWORD) boundaries to use the real cast. If that isn't an option, use PUBLISH and SUBSCRIB instructions to do the copy. They can handle unaligned data.
            So I can only send 16 real numbers?

            Comment



            • #7
              Originally posted by trimixdiver1 View Post

              So I can only send 16 real numbers?
              You can publish more than 1 block. If that still isn't enough, you can use RX/WX instructions.

              Comment



              • #8
                All I want to do is pass 4 real numbers to the BRX, I did the publish r461 to PL1, r638 to PL2, r463 to PL3 and r635 to PL4, converting to real double word on the D2 domore

                on the brx I subscribe doing the same order PL1 to R1, PL2 to r2, PL3 to r3 and PL4 to r4, converting to real double word, all Im getting is bad data.

                Please help

                Comment



                • #9
                  Screen shots of the D2 and BRX
                  Attached Files

                  Comment



                  • #10
                    I'm trying to help.

                    Each PL location is 16 bits. Each R location is 32. It takes two PLs to store one R. The :R operator grabs two successive PLs and treats it like the one R. You are overlapping and overwriting the data.

                    In the 205:
                    Copy R461 to PL0:R
                    Copy R638 to PL2:R
                    Copy R463 to PL4:R
                    Copy R635 to PL6:R

                    In the BRX:
                    Copy PL0:R to R0
                    Copy PL2:R to R1
                    Copy PL4:R to R2
                    Copy PL6:R to R3

                    Comment



                    • #11
                      Originally posted by BobO View Post
                      I'm trying to help.

                      Each PL location is 16 bits. Each R location is 32. It takes two PLs to store one R. The :R operator grabs two successive PLs and treats it like the one R. You are overlapping and overwriting the data.

                      In the 205:
                      Copy R461 to PL0:R
                      Copy R638 to PL2:R
                      Copy R463 to PL4:R
                      Copy R635 to PL6:R

                      In the BRX:
                      Copy PL0:R to R0
                      Copy PL2:R to R1
                      Copy PL4:R to R2
                      Copy PL6:R to R3
                      Im sorry if I came off as short, I wasnt. Now if I wanted to do 30 real numbers, can I still use peerlink?

                      Comment



                      • #12
                        Originally posted by trimixdiver1 View Post

                        Im sorry if I came off as short, I wasnt. Now if I wanted to do 30 real numbers, can I still use peerlink?
                        Yes. From the PEERLINK instruction, you just check more than one block, and you can do many more.

                        Comment



                        • #13
                          Originally posted by BobO View Post

                          Yes. From the PEERLINK instruction, you just check more than one block, and you can do many more.
                          I only see 16

                          Comment



                          • #14
                            Originally posted by trimixdiver1 View Post

                            I only see 16
                            That's 16 blocks of 8 PLs each. That can move a total of 64 R locations.

                            Comment



                            • #15
                              Originally posted by BobO View Post

                              That's 16 blocks of 8 PLs each. That can move a total of 64 R locations.
                              I see it now, thank you, could you add more if you increase the PL count in PLC memory?

                              Comment

                              Working...
                              X