Shop OBEX P1 Docs P2 Docs Learn Events
Text or image? — Parallax Forums

Text or image?

dosmithdosmith Posts: 15
edited 2011-01-18 07:56 in Propeller 1
I've been playing around with the VGA text demo file originally created by Chip Gracey in 2006 to create a device that we can use with our emergency notification system. The thought occurred to me that using a small graphic file might be easier than trying to do this in text. Anyone agree with that concept? If not, then I'm looking for someone to walk me through the code to edit parameters of the text including colors, size and background colors. Anyone interested? Thanks.

Comments

  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2011-01-11 13:00
    Can you tell us a little more about what this project will do? It'll help.

    I take it that you need VGA output?

    OBC
  • dosmithdosmith Posts: 15
    edited 2011-01-11 13:46
    We're trying to leverage our classroom control system to augmented a campus-wide emergency announcement system. Basically what we're looking to do is create a small device that will plug into an open vga input on a classroom projector/monitor that is constantly displaying a message (or an image depending on the input from all of you) instructing the viewer to follow some instructions. We've built a prototype device and it's currently displaying text but I don't have the skills to edit the text well.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2011-01-12 07:18
    Take a look at the "VGA_Text_Demo" in Propeller Library - Demos (In Propeller Tool)

    Is this what you are looking for? Or something more jazzy?

    OBC
  • potatoheadpotatohead Posts: 10,261
    edited 2011-01-12 07:27
    Are these instructions like, "Please go to Area 1C right now.", or "Fire Drill in Progress...?", or something longer?
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2011-01-12 07:47
    If it's just text you need, we can narrow that demo down a little.
    ''***************************************
    ''*  TV Text Demo v1.0                  *
    ''*  Author: Chip Gracey                *
    ''*  Copyright (c) 2006 Parallax, Inc.  *               
    ''*  See end of file for terms of use.  *               
    ''***************************************
    
    CON
    
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    
    
    OBJ
    
      text : "tv_text"
      
    
    PUB start 
    
      'start term
      text.start(12)
      text.str(string(13,"The building is on fire!",13))
      text.str(string(13," PANIC! RUN! SCREAMING!",13)) 
    

    I'll await your good humor and response to potatohead's question. :)

    OBC
  • dosmithdosmith Posts: 15
    edited 2011-01-13 06:25
    Yes, I've been working with the VGA_Text_Demo file with some success and yes it's a static message with basic emergency instructions. What I haven't been able to figure out is how to control font and background color and basic editing controls. This is also why I asked the question of whether to use text or a graphic thinking that I can edit a graphic very easily. Thanks for the help.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2011-01-13 06:41
    > basic editing controls.
    Are you looking for a way to change/edit text with a keyboard?

    I'm not sure font change is going to be available. I believe background color is doable with that object.

    OBC
  • dosmithdosmith Posts: 15
    edited 2011-01-13 07:36
    Nope. I can send you what I've got. I was able to figure out how to get the text I needed but not how to control line breaks, any color options, etc. Basically we'll program these once and put into production. I'm still interested to know whether or not using a simple graphic image would be more effective. Thanks.
  • potatoheadpotatohead Posts: 10,261
    edited 2011-01-13 08:37
    A graphic would be simpler from the authoring point of view, but more difficult on the Propeller because the graphics take considerable program space.

    So we need some detail:

    1. How many messages are there?

    2. If only one or two, you can use a graphic. We have drivers that can change colors and such, and display simple bitmaps. 2 or 4 or 64 color bitmaps. Probably store only one 64 color one, a coupla 4 color ones, and maybe three 2 color ones. (and that's a rough guess based on a rough idea of content)

    3. if more, then do you have storage on your board? SD card, or large EEPROM?

    Based on that, we can give you some advice.

    The storage method will require that a VGA driver is up, whatever communications you plan to use, and either SD or EEPROM driver code to be able to fetch the graphics.

    If there are a lot of messages, then it's better to draw text, and there are some things that can be done. It won't be like your average graphics program can do with fonts and such, but you can make some adjustments. Each takes some work.

    Since you said it's a emergency system, I suspect several, or perhaps some ad-hoc message to be displayed at emergency time...
  • AribaAriba Posts: 2,690
    edited 2011-01-13 14:14
    Text is much simpler than graphics, especialy respecting colors.
    With TV_Text you can choose one of 8 color-sets for every character. Such a color set defines fore- and background color.
    Further you can change the palette which defines the 8 color sets, on the fly.
    Here is a demo:
    CON
      _clkmode        = xtal1  + pll16x
      _xinfreq        = 5_000_000
    
    OBJ
      tv : "TV_Text"
      
    PUB Main   | i
      tv.start(12)
      tv.setcolors(@palette1)       'set our palette
      colorset(0)                   'color nr of palette
      tv.str(string("Text Color Test",13))
      repeat i from 0 to 7
        at(4,i+2)
        colorset(i)    
        tv.str(string("ColorSet "))
        tv.out("0"+i)
      
      waitcnt(clkfreq*4 + cnt)
      repeat                        'change colors
        tv.setcolors(@palette2)
        waitcnt(clkfreq + cnt)
        tv.setcolors(@palette1)
        waitcnt(clkfreq + cnt)
      
    PRI colorset(cnr)
      tv.out(12)
      tv.out(cnr)
    
    PRI at(xpos, ypos)
      tv.out(10)
      tv.out(xpos)
      tv.out(11)
      tv.out(ypos)
    
    DAT
                 '      fore   back   set            also border 
                 '       color  color                 |
    palette1     byte    $07,   $0A    '0    white / dark blue
                 byte    $07,   $BC    '1    white / red
                 byte    $9E,   $9B    '2   yellow / brown
                 byte    $04,   $07    '3     grey / white
                 byte    $3D,   $3B    '4     cyan / dark cyan
                 byte    $6B,   $6E    '5    green / gray-green
                 byte    $BB,   $CE    '6      red / pink
                 byte    $3C,   $0A    '7     cyan / blue
    
    palette2     byte    $07,   $DC    '0    white / violet
                 byte    $3C,   $0A    '1     cyan / blue
                 byte    $07,   $0A    '2    white / dark blue
                 byte    $04,   $07    '3     grey / white
                 byte    $3D,   $3B    '4     cyan / dark cyan
                 byte    $9E,   $9B    '5   yellow / brown
                 byte    $6B,   $6E    '6    green / gray-green
                 byte    $BB,   $CE    '7      red / pink
    

    Andy
  • dosmithdosmith Posts: 15
    edited 2011-01-14 14:39
    We're working with a single, static message. As for size of EEPROM we used the same one that comes with the propeller starter kit. Basically we've had a company create a small board with just the vga out, power in and programming port. All other I/O's were eliminated but we kept all the rest of the components that came on the starter kit. Thanks.
  • potatoheadpotatohead Posts: 10,261
    edited 2011-01-15 00:51
    If it's a single message, I think I would use the VGA tile driver for it. You can author a image with the text attributes you want, convert it to binary data, to be included with your program image to be written to the EEPROM.

    Seems like the Prop isn't doing much else but waiting to display it, which leaves lots of room for the image to be stored.

    In my blog, I've linked the driver, and did some sample art. You get 64 colors to work from, and a resolution of 256x240 pixels to put it in. Many things, given there isn't a ton of detail, will easily fit into the HUB memory.

    Your program then would just fire off that driver, two cogs only, no sprites are used, and when it's time to display the image, just write the tile-map address to the driver, so it will display.

    The blog entry includes sprites. You can ignore those and just use the background.bmp as a working example of how to encode something for VGA display at a good resolution and color set.

    The basic flow is author your message as a graphics .bmp file.

    Then, save it.

    Run the converter program Baggers wrote, and it will output two binary file packages. One will be all the unique tiles needed to display the image, and the other is a tilemap, which contains the screen addresses needed to tell the driver which tile to display where.

    The sample program there contains the display code you will need.

    This is one approach.

    The other one is to use one of the VGA bitmap drivers, operate at a lower resolution, and simply author a bitmap in a graphics program to be displayed on the Propeller, skipping the tile map part of things.
  • dosmithdosmith Posts: 15
    edited 2011-01-18 07:44
    I'd like to give this a try. Can you point me to your blog? Thanks.
  • potatoheadpotatohead Posts: 10,261
    edited 2011-01-18 07:56
    Here's the entry here on the Parallax site. They gave us blogs!

    http://forums.parallax.com/entry.php?76-Some-tile-art...

    In that post, I've got the VGA / TV tile driver that does lots of colors. It's set for demoboard. Basically, you can make a 256x200 image for TV, then use the converter utility on it to generate tiles and a map file, which that driver can then display on the screen. The intent behind that is for games. I'm chipping away at one using the art sample on the blog. But, it doesn't have to be games. Look closely at the background.bmp It's formatted for VGA, as it has 240 lines. It can work on TV, just that not all of them will be seen.
Sign In or Register to comment.