Shop OBEX P1 Docs P2 Docs Learn Events
Flexible VGA Bitmap Driver! 2 Color Version Done! 4 Color Version Done! — Parallax Forums

Flexible VGA Bitmap Driver! 2 Color Version Done! 4 Color Version Done!

KyeKye Posts: 2,200
edited 2009-11-05 06:03 in Propeller 1
Hey guys,

I've finished the flexible 2 and 4·color vga·bitmap drivers I was talking about.

The drivers·pretty much give all·you·need to being to build a display driver library. Included with it are also·functional (slow) spin examples on how to draw characters on screen and how to draw pixels.

I've also managed to make the drivers have a flexible display resolution so that you can expand or shrink the size of the display very·easily.·There are 144-192 different resolutions·ready to choose from. You can have a display that is the size of one long if you want with only 32-16 pixels. Or if you need more space 320 x 240 is a great resolution that takes up only·1/4th-1/2th of the internal memory.

The drivers keeps things simple with only 2-4 colors for the whole screen at once. While this is limited you can use this driver for graphing or ploting stuff very easily.

I also optimized the vertical refresh timing in the asm code so that you can get the driver to do other stuff while it is vertical refreshing. So if you want the display drivers to also make some sprites on screen you have plently of time during the vertical refresh to get it to do so.

Anyway, enjoy the included demo! And play arround with the character scaling feature.

This code will also be up in obex.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,

Post Edited (Kye) : 11/2/2009 1:29:32 PM GMT

Comments

  • Bill HenningBill Henning Posts: 6,445
    edited 2009-11-01 16:33
    Nice!
    Kye said...
    Hey guys,


    I've finished the flexible 2 color vga bitmap driver I was talking about.



    The driver pretty much gives you need to being to build a display driver library. Included with it are also functional (slow) spin examples on how to draw characters on screen and how to draw pixels.



    I've also managed to make the driver have a flexible display resolution so that you can expand or shrink the size of the display very easily. There are 144 different resolutions ready to choose from. You can have a display that is the size of one long if you want with only 32 pixels. Or if you need more space 320 x 240 is a great resolution that takes up only 1/4th of the internal memory.



    The driver keeps things simple with only 2 colors for the whole screen at once. While this is limited you can use this driver for graphing or ploting stuff very easily.



    I also optimized the vertical refresh timing in the asm code so that you can get the driver to do other stuff while it is vertical refreshing. So if you want the display driver to also make some sprites on screen you have plently of time during the vertical refresh to get it to do so.



    Anyway, enjoy the included demo! And play arround with the character scaling feature.



    I'll have the four color version coming out later when I have time to finish it. It will have the same features, but with 4 color support... This also means it will use up more space so the display will need to be smaller.
    This code will also be up in obex.
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
    Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
    Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
    Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
  • potatoheadpotatohead Posts: 10,261
    edited 2009-11-02 02:33
    Kye,

    This is nicely commented and organized code. Thanks for sharing!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Wiki: Share the coolness!
    Chat in real time with other Propellerheads on IRC #propeller @ freenode.net
    Safety Tip: Life is as good as YOU think it is!
  • Cluso99Cluso99 Posts: 18,069
    edited 2009-11-02 08:42
  • KyeKye Posts: 2,200
    edited 2009-11-02 13:28
    The four color version is now done!



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,
  • JRetSapDoogJRetSapDoog Posts: 954
    edited 2009-11-03 21:57
    Great work, Kye!· These objects work well and are quite interesting to experiment and/or play with.· They're well documented, as well.

    For the color constants in the engine, I'm curious about why you call the bit combination $FC = %11_11_11_00 (w/the last 2 bits as·"don't care")·by the name·"Light_Grey" as opposed to "white."· Is that because it's not fully white?· That is, thought of in a 24-bit RGB context (which it's not, of course), perhaps·it's·kind of analogous to %11000000_11000000_11000000·rather than·%11111111_11111111_11111111.· Of course the actual VGA circuit only combines 2 bits per color channel.· I don't have any real idea how the standard circuit for the VGA resistor network converts a %11 for a particular color channel.· Perhaps it doesn't fully "saturate" things in terms of voltage.

    Anyway, perhaps the short answer will be, "I called it 'Light_Grey' because that's how it looked on my monitor," which is fine if that's the case.· In my case, however, that particular color choice ($FC)·causes my ViewSonic monitor to "freakout" (give out-of-range warnings, etc.) so I can't actually view that color.· That is, while perhaps it's off-white on yours, perhaps it's too "hot" for my monitor.· Maybe the voltage is too high (or "oversaturated," though that's probably an NTSC TV word).· Incidentally, I did use 1% resistors when making the VGA network.· At any rate, the other colors work fine, so that hasn't stopped me from learning and having fun.· Thanks for your hard work and contribution to the forum.· --Jim

    Post Edited (JRetSapDoog) : 11/3/2009 10:04:51 PM GMT
  • KyeKye Posts: 2,200
    edited 2009-11-03 23:00
    Actually that color is white. I call it light grey because I was keeping the (color, lightcolor, darkcolor) naming scheme.

    Hah! If the color is giving your monitor out of range warnings then it is definately your hardware.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,
  • BradCBradC Posts: 2,601
    edited 2009-11-04 01:23
    Kye said...

    Hah! If the color is giving your monitor out of range warnings then it is definately your hardware.

    I doubt that. I suspect his monitor is just complaining that you are ramming _way_ out of spec signals down its throat. Remember that VGA colour signals are designed for 0-0.7v from black to full saturation. Jamming 3.3v into them from a propeller pin is driving them somewhat past their designed limit.

    So it's not the fault of your driver, but it's likely related to the way most people seem to hook VGA monitors up to the propeller.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    If you always do what you always did, you always get what you always got.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-11-04 02:47
    Well done Kye, thanks. I haven't tried it yet but the character scaling sounds interesting and useful.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • KyeKye Posts: 2,200
    edited 2009-11-04 04:23
    @BradC - Ahhhhh, then question parallax's engineers. I only have written software that drivers I/O lines to high and low very quickly. Not how you interface. If you look at the schematic in the source code I made sure not to actually list the resistor values. Just 1R and 2R.

    @Peter, try character scaling with the value of zero. You then·get characters that·are 4 pixels by 2 pixels. I find that character scaling with values of 3 works great since it produces text that are 8 pixels by 16 pixels.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,
  • JRetSapDoogJRetSapDoog Posts: 954
    edited 2009-11-04 15:57
    Well...about mentioning the out-of-range signal on white, it was mostly just an excuse to congratulate you on your great work. I thought it was better than just saying "Congrats!" since that had already been said. Besides, a comment of any nature can help keep a thread alive (and keep us all learning).· Yes, as you said,·it wouldn't make sense to hold you and your code (and the value $FC or the pulsing thereof) responsible for a hardware problem on my end.· For timing, maybe, but not voltage levels, lol, but no problems so far.· Besides, can't complain about the price.· However, it is interesting that such a problem can happen (the over-driving), and this site is as much about hardware as software. Of course, it might be good to know if others have experienced such a problem with ANY of the Prop VGA drivers. Anyway, it only happened on white, and I haven't double-checked my wiring or resistors and so on. I also haven't played much yet with the other drivers connected to a VGA monitor (I've mostly just used modified drivers connected to a raw LCD panel). Anyway, I'm sure we'll discover interesting ways to apply your driver and I hope that we'll mention them here. --Jim

    Post Edited (JRetSapDoog) : 11/4/2009 4:17:24 PM GMT
  • KyeKye Posts: 2,200
    edited 2009-11-05 00:31
    I hope so too.

    I wrote this driver actually so I could dump raw data from a camera onto the screen, and view signals like on a scope.

    Using double buffering most of this stuff should be doable in spin at arround 15FPS which is pretty good. Since you can change the size of the display buffer very easily it is very possible to double buffer with a small display and still have some ram.

    ...

    And if you like the driver give it a review so everyone else knows! 5 Stars please =).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2009-11-05 00:41
    Hi Kye,

    Your little code packages just seem to get better and better. I was wondering, do you have a website or a location where you could package them all up for download. I have this idea that some time in the future I'll think; 'I need to do x, I'll bet Kye has some code to do that'. Rather than search through the forum...

    Cheers, James Moxham

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.smarthome.viviti.com/build
  • KyeKye Posts: 2,200
    edited 2009-11-05 06:03
    I like making little code packages.

    But no website for now.

    Oh, I'll be making a high speed serial driver soon for 2MBs full duplex communication. It will use one cog to receive and one to transmit and I'll make it compatible with my current serial driver.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,
Sign In or Register to comment.