Shop OBEX P1 Docs P2 Docs Learn Events
mixing rfbyte and rfword — Parallax Forums

mixing rfbyte and rfword

Using a well tested serial routine (on the Prop2 side)
connected to a somewhat flakey serial connection on the computer side...
to read from the computer into the P2 and interleave image and distance data
(from a KinectV2). The image data is a byte and the distance data is two bytes.
Once I call this, the P2 doesn't seem to respond to further commands although the
computer side of things seems fine.

kinect2hub      
                mov z,##230400                                
                mov ptra,##_Off_SCREEN_BUFFER  
                wrfast ##0,ptra
.get3bytes      
               call #rcv_char
                wfbyte rx_char
                call #rcv_char
                mov xx,rx_char
                shl xx,#8
                call #rcv_char
                add xx,rx_char
                wfword xx
                djnz    z,#.get3bytes

                mov rx_char,#0

                 ret

I suspect that mixing wfbyte and wfword might not be allow?

Comments

  • rjo__rjo__ Posts: 2,114
    I should have plenty of hub ram available.
  • cgraceycgracey Posts: 14,209
    There should be no problem mixing any sizes of WFxxxx.
  • rjo__rjo__ Posts: 2,114
    Yes... I just change my byte to a word and no go. must be elsewhere in my code... but it is really simple stuff. I don't know.
  • cgraceycgracey Posts: 14,209
    I don't see a problem from your example. Could you do a test where you see if a WFBYTE followed by a WFWORD write incorrect data? I would do it here, but things are somewhat in a state of flux with the smart pin work.
  • rjo__rjo__ Posts: 2,114
    I took a nap...:) Things are much better. I was writing too much and thinking too little.
    The total buffer is 230400 bytes... but I am grabbing 3 bytes per loop... so I only need to
    loop 76800 times. With this fix... all is well. Sorry.

    By the way... the P2 is just fabulous.

    Thanks
Sign In or Register to comment.