Shop OBEX P1 Docs P2 Docs Learn Events
does GETPTR only work with streamer? — Parallax Forums

does GETPTR only work with streamer?

RaymanRayman Posts: 13,861
edited 2020-03-15 21:38 in Propeller 2
GETPTR doesn't seem to be working like I'd like...

I'm trying to use it with a wflong loop, to mark where a trigger occurred...
When I search here for info, I just see stuff about using it with the streamer...

As a test, I did this:
            wrfast  #nBlocks/2,pBuf  'we keep writing to buffer in a loop until triggered and then read a bit more            
            getptr  d1

I would have expected that d1 would have same value as pBuf, put it doesn't. Looks at it is pointing to where it would wrap.
But, in real code it just seems to give quasi random values...

Comments

  • cgraceycgracey Posts: 14,133
    Rayman wrote: »
    GETPTR doesn't seem to be working like I'd like...

    I'm trying to use it with a wflong loop, to mark where a trigger occurred...
    When I search here for info, I just see stuff about using it with the streamer...

    As a test, I did this:
                wrfast  #nBlocks/2,pBuf  'we keep writing to buffer in a loop until triggered and then read a bit more            
                getptr  d1
    

    I would have expected that d1 would have same value as pBuf, put it doesn't. Looks at it is pointing to where it would wrap.
    But, in real code it just seems to give quasi random values...

    GETPTR just increments according to RFBYTE/RFWORD/RFLONG. It doesn't wrap. I tried to make it wrap, but it was very complicated, so I didn't do it.
  • cgracey wrote: »
    GETPTR just increments according to RFBYTE/RFWORD/RFLONG.

    Only RFxxxx, not WFxxxx?

  • cgraceycgracey Posts: 14,133
    TonyB_ wrote: »
    cgracey wrote: »
    GETPTR just increments according to RFBYTE/RFWORD/RFLONG.

    Only RFxxxx, not WFxxxx?

    Whoops! Both reads and writes work.
  • RaymanRayman Posts: 13,861
    I think I see now how Chip worked it out with his HDMI Scope example:
            getptr  .x          'capture write pointer, reflects trigger point
    
            waitx   ##320*4         'allow time to fill second half of buffer
    
            xstop               'stop streamer, ~640 samples gathered within 1k sample buffer
    
    
            sub .x,##320*4      'determine start of buffer so that trigger point is in the middle
            and .x,##$0FFC
            or  .x,##buffer
    

    I guess the math is easy with a buffer size like $1000
    The AND operation above gets you position in buffer.
Sign In or Register to comment.