Are there grayscale displaydriver for th Propeller?

SchuelerSchueler Posts: 3
edited January 2010 in Propeller 1 Vote Up0Vote Down
As far as I can see, there are only 1-color, 2, 4, 8, 16, 64 color drivers for the Propeller.

For a lot of projects I am not interested in color but intensity.
So, why not tie the RGB of the VGA connector together and drive it with a 6bit R2R?
This way you should get 64 gray levels...
But how to hack the driver?!?
Is it this simple or not?

Has someone already done it?


  • 9 Comments sorted by Date Added Votes
  • kwinnkwinn Posts: 7,643
    edited January 2010 Vote Up0Vote Down
    Why hack the driver? 64 color can be used to provide 64 gray levels instead.
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • Toby SeckshundToby Seckshund Posts: 2,011
    edited January 2010 Vote Up0Vote Down
    I was musing on a simular thing. Instead of 64 levels of grey I was going to go right back to MDA with Black, medium/light gray and full white. All this was to try and get back 4 pins. Of course the screen could be set to background colour and white (as in the DracBlade). I was looking at the VGA demos on the PropBASIC thread as a way of getting a better understanding.

    Style and grace : Nil point
  • SchuelerSchueler Posts: 3
    edited January 2010 Vote Up0Vote Down
    Well, the driver provides only 4 gray scales... ( black and white included... )
    And yes, it is possible to used the driver as is... but it would be more nice just to give the gray scale level to the driver instead of separate R, G and B values...
    E.g. if I would like to have gray level 45, I have to calculate what the values should be for R, G and B. This is a waste of time don't you think?

    The conversion is not needed for my concept so that's why I have to modify the driver.
    Or, if someone already did, would like a copy of the work...

  • Dr_AculaDr_Acula Posts: 5,482
    edited January 2010 Vote Up0Vote Down
    Re kwin "Why hack the driver? 64 color can be used to provide 64 gray levels instead."

    I'm not sure it can. The only grey colors are when RGB are equal, so you have 00 for all, 01 for all 10 for all and 11 for all. ie 4 gray scales.

    I think I can see what is being asked here. Take 6 physical pins. Put different resistor values on each where each resistor doubles in value.

    100, 200, 400, 800 1600, 3200 ohms ??

    Join all the outputs of those together and to RGB.

    But - would the low and high resistor values be ok and more specifically, would they allow enough current to drive a VGA display?

    Or would you go for a R/2R network of, say 220R resistors?

    This is an intriguing question because I agree that gray scale may well be more useful than color in some circumstances. I don't think the driver will be too hard to hack - you just send it a binary byte of NNNNNNxx where N is a bit and x is a don't care. Though vga text in hi res gray scale won't mean much given this value applies to the whole screen. So the driver that is going to need hacking will be a graphics type driver. Bean is doing some cool things with propbasic at the moment that could be very relevant here.

    Answers: 1) A quadcopter. 2) Very high. 3) The internet. 4) A lot. 5) No.
  • kwinnkwinn Posts: 7,643
    edited January 2010 Vote Up0Vote Down
    The video generation is not nice and simple unfortunately. While there are 6 bits available for 64 shades of gray or 64 colors you can only display 4 of the 64 in any one scan line.
    In science there is no authority. There is only experiment.
    Life is unpredictable. Eat dessert first.
  • potatoheadpotatohead Posts: 8,978
    edited January 2010 Vote Up0Vote Down
    At modest resolutions, it's possible to drive the waitvid command backwards. For pixels, color 3, 2, 1, 0 are specified, along with a 4 pixel frame. Instead of loading pixels each time, you load colors instead, turning the waitvid command into a one byte per pixel mode.

    This makes for a fast waitvid, limiting resolution somewhat. With a single COG, that's probably somewhere around 320 pixels, with two cogs, a 512 pixel display is likely. Because it's only a 4 pixel frame, the draw loop needs to be quick, leaving time for only simple bitmap drivers on a single COG. Two COGs would probably leave time for tiles and objects. More COGs = more display options.

    Building the resistor ladder makes a lot of sense. The way Propeller video works is some of the "color" values are actually sync signals, because the waitvid draws the entire signal. 64 possible greys would yield less than that number on screen, probably 50 something, depending on the resistors used.

    An alternative is to use color maps, or tiles, packing the 4 greys into pixel groups. That's not complete color freedom, but significantly improved over just 4 per scan.

    An existing VGA driver can do this, once the math has been done to calculate what the sync level values are, given the resistors in play. The big modification is to modify the draw loop to use a 4 pixel frame, instead of the usual 16 or 32 pixel frames normally used for best overall throughput on the waitvid.

    Once that is done, it's only about picking the right sync color values.

    Propeller Wiki: Share the coolness!
    8x8 color 80 Column NTSC Text Object
    Safety Tip: Life is as good as YOU think it is!
    Do not taunt Happy Fun Ball! @opengeekorg ---> Be Excellent To One Another SKYPE = acuity_doug
    Parallax colors simplified:<br>
  • SchuelerSchueler Posts: 3
    edited January 2010 Vote Up0Vote Down
    It is indeed for graphics but it can be used for text as well...
    I can proof it will be even shorter ( and faster ) then the color version.
    Now, the graphic driver gets three colors... R, G, and B. Each color has 2 bit ( 4 possibilities as mentioned ).
    For gray scale, you only send over 1 byte with a 6 bit possibility.... so, 64 gray scales.
    The instead of combining the three color and send it to the output it can just output the gray scale byte straightaway.
    Saves some clock cycles.

    Each line to the RGB VGA monitor "should" be driven by 50 ohm. Or maybe 75 Ohm... However, this is not really a problem unless you move up to hi resolutions...
    Otherwise I will build the R2R DAC three times, for each output one R2R DAC.

    Should be something to try or not?
  • ericballericball Posts: 770
    edited January 2010 Vote Up0Vote Down
    In general existing drivers are based on the demoboard DAC, i.e. 2 bit RGB+HV or 3 bit composite (3 bit luma/sync+/-psk chroma). If you tied the VGA DAC to a single pin you could generate 0-13. TV is -40 to 100 IRE with 0 IRE black, so for 0-13 sync would be 0 and 4 would be black so you'd get 10 black levels, versus 6 for the basic DAC. So to get more greys you'd need a wider DAC.

    And even if you wanted to use the VGA DAC, you would need to create a custom driver as the existing TV driver wouldn't use all 8 pins and the VGA driver wouldn't create the correct sync.

    With a full 8 bit DAC you can get 182 greys, or 128 with a dedicated sync pin. Video drivers aren't horribly difficult, see my sig for starting points.

    Composite NTSC sprite driver: Forum
    NTSC & PAL driver templates: ObEx Forum
    OnePinTVText driver: ObEx Forum
    Pay for your free software - let the developers know how much you appreciate their work!

    Links to Propeller stuff I've done (mostly composite video)
Sign In or Register to comment.