Shop OBEX P1 Docs P2 Docs Learn Events
Propeller Backpack Video Overlay — Parallax Forums

Propeller Backpack Video Overlay

bunkerush5bunkerush5 Posts: 10
edited 2013-12-20 12:43 in General Discussion
Hello,

Has anyone had success in displaying a variables value on the video overlay. I loaded the PropBP_overlay_demo from parallax with no problems but it seems as though you can only display strings. Just to test I tried to increment a value by 1 every second and display the result. Something online said to use the fullduplexserial but I am not sure how that would work properly. A little guidance would be greatly appreciated.

Thanks.

Comments

  • ercoerco Posts: 20,256
    edited 2013-12-19 21:20
    If you post your code, people can spot problems faster.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-12-19 22:10
    That's right, the overlay demo doesn't include a "dec" method.

    I wrote a little demo which includes a "dec" method.
    CON
    
      _clkmode      = xtal1 + pll8x
      _xinfreq      = 10_000_000
    
    
      BUF_SIZE      = 16384
    
    
    OBJ
    
    
      pr : "prop_backpack_tv_overlay"
     ' io : "basic_sio"
    
    
    VAR
    
    
      byte  buffer[BUF_SIZE]
    
    
    PUB start | i
    
    
      pr.start(@buffer, BUF_SIZE)
     ' io.start
      i := 0
      repeat
        dec(i++)
        pr.out(pr#CR) ' carriage return
        waitcnt(clkfreq + cnt)
        
    PUB dec(value) | i, nz
    {
      This method taken from localroger's StrFmt object.
      add a signed random width decimal number as found
      in many output objects  
    }
      if value < 0
        -value
        pr.out( "-")
    
    
      i := 1_000_000_000
      nz~
    
    
      repeat 10
        if value => i
          pr.out(value / i + "0")
          value //= i
          nz~~
        elseif nz or i == 1
          pr.out("0")
        i /= 10
    
    
    

    I didn't connect my Backpack to a TV to test the program so let me know if it doesn't work.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-12-19 22:22
    Simple_Numbers.spin in the Propeller library has a dec method that can be used with the overlay object's str method. My own extension, Simple_Numbers_Plus.spin (attached) offers additional functionality.

    -Phil
  • bunkerush5bunkerush5 Posts: 10
    edited 2013-12-20 10:16
    Duane,

    Thanks for your help. I was not able to get the variable to display using your code. The video image comes through but nothing else. Any idea what could be wrong?
  • bunkerush5bunkerush5 Posts: 10
    edited 2013-12-20 10:26
    Phil,

    How do you go about using the dec method with the overlay str method? This is where I am stuck. I tried to do it with fullduplexserial like this and it did not work.

    OBJ

    pr : "prop_backpack_tv_overlay2"
    serial:"FullDuplexSerial"

    VAR

    byte buffer[BUF_SIZE]
    long x


    PUB start | i


    pr.start(@buffer, BUF_SIZE)

    pause(2000)
    serial.start(31, 30, 0, 9600)
    'num.init
    x:=1
    repeat
    x:=x+1

    pr.str(string(DEFWIN, 10, 40, DBL|2, CHGCLR, $f, _0, 8|TPT, 1, APNDSP, 10, SHO|10, _0, 20, SHODSP, 10, WDWRAP, 1))
    pr.str(string(serial.str(x, dec)))
    pause(2000)
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-12-20 10:38
    You need to use the Simple_Numbers object that I pointed out above:
    OBJ
    
      num : "Simple_Numbers"
      pr: "prop_backpack_tv_overlay2"
    
    PUB start
    
      ...
      pr.str(num.dec(value))
    

    -Phil
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-12-20 10:40
    FullDuplexSerial isn't going to help.

    If you use the Simple_Numbers.spin in the OBJ section as:
    num : "Simple_Numbers"
    

    You should be able to display a number with:
    pr.str(num.dec(x))"
    

    I only looked at the numbers object in the Prop Tool library, I haven't looked at Phil's "plus" version but I bet it works the same.

    Edit: Phil bet me to it but I see we pretty much say the same thing.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-12-20 10:47
    To post code in the forum you really need to use code tags. In order for the tags to show up, I'm using a zero instead of an "O" in the word "code".

    Start with a code tag.

    [c0de]

    ' paste code between tags
    x := 1

    [/c0de]

    If I change the "0" to "o" in the above lines, I get:
    ' paste code between tags
      x := 1
    
    

    This way the indentation shows up correctly in the posted code.
  • skylightskylight Posts: 1,915
    edited 2013-12-20 12:43
    you can also highlight all the code and then click the Hash(code) button in the editor to automatically wrap the tags around the code block.
Sign In or Register to comment.