Shop OBEX P1 Docs P2 Docs Learn Events
How to erase string on TV — Parallax Forums

How to erase string on TV

caskazcaskaz Posts: 957
edited 2012-03-10 06:12 in Propeller 1
Hi.
I'm studying TV-display.
I want to erase string"ABCD".
But It cannot erase below;
CON
  _clkmode = xtal1 + pll16x
  _xinfreq = 5_000_000
  _stack = ($3000 + $3000 + 100) >> 2   'accomodate display memory and stack
  x_tiles = 16
  y_tiles = 12
  paramcount = 14       
  bitmap_base = $2000
  display_base = $5000
  lines = 5
  thickness = 2
  twenty_sec = 1_600_000_000
VAR
  long  mousex, mousey
  long  tv_status     '0/1/2 = off/visible/invisible           read-only
  long  tv_enable     '0/? = off/on                            write-only
  long  tv_pins       '%ppmmm = pins                           write-only
  long  tv_mode       '%ccinp = chroma,interlace,ntsc/pal,swap write-only
  long  tv_screen     'pointer to screen (words)               write-only
  long  tv_colors     'pointer to colors (longs)               write-only               
  long  tv_hc         'horizontal cells                        write-only
  long  tv_vc         'vertical cells                          write-only
  long  tv_hx         'horizontal cell expansion               write-only
  long  tv_vx         'vertical cell expansion                 write-only
  long  tv_ho         'horizontal offset                       write-only
  long  tv_vo         'vertical offset                         write-only
  long  tv_broadcast  'broadcast frequency (Hz)                write-only
  long  tv_auralcog   'aural fm cog                            write-only
  word  screen[x_tiles * y_tiles]
  long  colors[64]
  byte  x[lines]
  byte  y[lines]
  byte  xs[lines]
  byte  ys[lines]
OBJ
  tv    : "tv"
  gr    : "graphics" 
PUB start | i, dx, dy, a
  'start tv
  longmove(@tv_status, @tvparams, paramcount)
  tv_screen := @screen
  tv_colors := @colors
  tv.start(@tv_status) 
  'init colors
  repeat i from 0 to 63
    colors[i] := $00001010 * (i+4) & $F + $2B060C02
  'init tile screen
  repeat dx from 0 to tv_hc - 1
    repeat dy from 0 to tv_vc - 1
      screen[dy * tv_hc + dx] := display_base >> 6 + dy + dx * tv_vc + ((dy & $3F) << 10)
  gr.start
  gr.setup(16, 12, 128, 96, bitmap_base)
  gr.colorwidth(1,1)
  gr.textmode(2,2,6,1)
  gr.clear
  repeat 
      gr.text(80,-80,string("ABCD"))
      gr.copy(display_base) 
      waitcnt(clkfreq*2 + cnt)
      gr.text(80,-80,string("    "))
      gr.copy(display_base)
      waitcnt(clkfreq*2 + cnt)
DAT
tvparams                long    2               'status
                        long    1               'enable
                        long    %001_0101       'pins
                        long    %0000           'mode
                        long    0               'screen
                        long    0               'colors
                        long    x_tiles         'hc
                        long    y_tiles         'vc
                        long    10              'hx
                        long    1               'vx
                        long    0               'ho
                        long    0               'vo
                        long    0               'broadcast
                        long    0               'auralcog 

How do erase string?

Comments

  • AribaAriba Posts: 2,690
    edited 2012-03-08 07:25
    You can draw a box with the background color to erase the text.
    The graphics object uses a vector font and draws only the lines for the character, but not the background, thats why erasing with spaces does not work. Do you really need the graphics object? TV_Text, which uses the ROM-Bitmap font, is much simpler and can overdraw characters with spaces.

    Andy
  • caskazcaskaz Posts: 957
    edited 2012-03-08 07:45
    Hi.
    I need graphic object because I want to display pulse-wave and pulse-value.
    640 x 480 - 166K
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-03-08 07:53
    What about changing the font color to the background color and print the same characters over the top of the old text?
  • caskazcaskaz Posts: 957
    edited 2012-03-09 02:08
    Hi.

    I tried to write "0" in v-ram.
    I put string"ABCD" topof v-ram(left-up on TVscreen).
      repeat 
          gr.text(-128,96,string("ABCD"))
          gr.copy(display_base) 
          waitcnt(clkfreq*2 + cnt)
    
          a := bitmap/4
          longfill(@a, 0, 16)
          gr.copy(display_base)
          waitcnt(clkfreq*2 + cnt)
    

    But character"A" don't erase.

    Character"A" erased when I changed "longfill(@a, 0, 630)".

    How is relation of V-ram address and TVscreen?
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2012-03-09 06:52
    Edit: What Duane Degn said above.. :-)

    Haven't tested this with your code but changing the color of the text to the background color should work.
      repeat 
          gr.colorwidth(1,1)
          gr.text(80,-80,string("ABCD"))
          gr.copy(display_base) 
          waitcnt(clkfreq*2 + cnt)
          gr.colorwidth(0,1)
          gr.text(80,-80,string("ABCD"))
          gr.copy(display_base)
          waitcnt(clkfreq*2 + cnt)
    
  • caskazcaskaz Posts: 957
    edited 2012-03-09 07:25
    Hi.
    Thanks Beau Schwabe.
    But it cannot use.
    Codes I showed is merely sample.
    Pulse monitor display many string(OVER, UNDER, LOST, and number from 50 to 199).

    Every strings overlap.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-03-09 07:31
    caskaz wrote: »
    Hi.
    Thanks Beau Schwabe.
    But it cannot use.
    Codes I showed is merely sample.
    Pulse monitor display many string(OVER, UNDER, LOST, and number from 50 to 199).

    Every strings overlap.

    You'll need to keep track of what strings were displayed (and where) so they can be erased.
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2012-03-09 07:33
    caskaz,

    "...Pulse monitor display many string(OVER, UNDER, LOST, and number from 50 to 199)....Every strings overlap." - Sure you can, just keep track of the old number versus the new number... if there is a change then clear the display (color 0) with the old number, and then replace it (color 1) with the new number.



    ...Edit: dang Duane :-) apparently I'm going to be your back seat driver today. You beat me to it again :-)
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-03-09 07:53
    ...Edit: dang Duane :-) apparently I'm going to be your back seat driver today. You beat me to it again :-)

    @Beau, You can be my back seat driver anytime. I just wish I could get back at Phil for the dozens of times he's bet me to it.

    @caskaz, To go along with what Beau said. You'll want to only write the numbers to the screen when their values change. Part of the writing process will be to write the previous value in the background color and the write the new value. You don't want to continuously be erasing the last value (if it's the same) since the numbers will flicker. There's actually a lot of displays that need to be treated this way. I'm almost starting to get used to it.

    BTW, Your project looks way cool. I love the look of that line across the screen.
  • caskazcaskaz Posts: 957
    edited 2012-03-10 06:12
    HI.
    Thanks Duane Degn and Beau Schwabe.
    I think problem(Character overlap) had gone.
    I did think changing the color of the text can't erase string.
    I had misunderstanding.

    This month(3/24), Open source conferense EHIME(OSC EHIME) open at Ehime-university.
    Kansai Propeller User Group(propelabu) have exhibition on OSC EHIME.
    So I demonstrate this "PulseMonitor TV".
    If you live at Ehime in Japan, please visit OSC EHIME.

    http://www.ospn.jp/osc2012-ehime/
    (It's japanese langauge)
Sign In or Register to comment.