Shop OBEX P1 Docs P2 Docs Learn Events
LCD screen connection via vga type connector — Parallax Forums

LCD screen connection via vga type connector

Hello, I am trying to connect LCD monitor to the parallax chip using VGA type connection. I have to use as few pins of the parallax chips as possible for that task. from the schematic diagrams of the Propeller professional development board i noticed that 8 pins are required on the parallax chip to connect monitor using vga. Six of them uses red, green and blue color pins via different resistors. I wonder is that the only possible way for these pins to be connected. Can the number of pins used can be reduced in any way? I have attached the schematics, the diagram is in the page 7. If anyone has any ideals pleas share. Many thanks

Kind regards,
Mindaugas


Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    For the VGA object to function you would need all 8 connections as shown.
  • JRetSapDoogJRetSapDoog Posts: 954
    edited 2016-11-23 18:22
    Hi. Yes, in some cases, you can reduce the number of pins from 8 down to 5 or even down to 3 if you're willing to give up some colors. Five pins used as VHRGB (vertical and horizontal sync signals and 1 bit of color for each of the colors red, green and blue) will get you a total of 8 colors (black, red, green, blue, yellow, purple, aqua and white), down from the original 64 colors (with 2 bits per colors). That may be sufficient for your needs. And if you're okay with a monochrome display (like green on black), you could get by with just using a single color pin for a total of only 3 pins, VH & whatever color pin you choose to drive things with. Theoretically, that color pin could drive more than one of RGB inputs of the VGA monitor if, for example, you wanted to white on black. Anyway, without external gates, you'd be limited to some color on black; that is, you couldn't have white on blue, for example, with just three pins.

    Now for any of this to save you pins, you're going to have to tell the video driver not to use certain color pins, that way you can reuse those pins for other things. The details of how to do that may be driver dependent, but, in some cases, a single byte is sent to the driver telling it what pins you want to enable for video. If that's the case, you can just send in zeros for the pins that you don't want the driver to use. For example, if the driver used a byte to enable the pins as RRGGBBHV, for the eight color scheme mentioned above, you could send in 10101011, which would give you one (high order) pin for each of RGB plus the two HV sync pins. Again, you'll have to check the driver to see how it enables things, but it often boils down to just changing one byte that gets sent to it from the application program.

    Now with altered drivers, it might be possible to save some memory (depending on how the driver works), but that's another matter beyond the scope of what I'd care to get into here. Anyway, I've used the aforementioned 8-color scheme by just running the high-order (most significant bits) through a single resistor each in the range of (180 to 240 ohms) with decent results, though higher values give a grayer white and a muddier (browner/darker) red (for example).

    I'm not familiar with the Propeller Professional Development Board. I'm not sure if you're using that or just referenced that schematic. Hopefully, you were just referencing it and have full control over how you wire up your pins. If you are using that board, you would probably have to make some board modifications in order to be able to save pins. Anyway, I just took a look at the schematic and each color is fed by two pins through 240 and 470 ohm resistors. Assuming that you found a way to disconnect pins to repurpose them, I think you could just use the pins connected with the 240 ohm resistors for R, G and B, as well as the H and V pins. That would save you three pins. Or, if monochrome is okay, you could, for example, just use the G pin (as it would give you the best contrast against a black background), as well as the H and V pins. That would save you a total of five pins. But in either case, you're going to need to make sure that the video driver only enables the pins that you need (and disables the others so that you can reuse them). Hopefully, the driver that you're using will let you control that from your application, so that you just send in the enable value that you need (as mentioned a couple paragraphs back), that way you don't need to change anything in the video driver itself. But even if the video driver needs changing, it's likely that it only needs a single line changed.

    You might get more specific answers if you mentioned whether you're wiring up a Propeller from scratch or using a pre-made board, such as the Propeller Professional Development Board (sorry, I wasn't clear on whether you're limited to that board), as well as mentioned what video driver you were planning on using or whether you had any preferences (or were open to any driver). If you're wiring up your own Propeller, I think I'd just use a single resistor between each color pin (whether just one, like G, or three, like RGB) and each Propeller output pin driving a respective color pin. I described that in words rather that with a schematic, sorry, but it's really straightforward. And it's the same as the schematic that for the board that you referenced, only with some of the resistors left out (freeing up the pins those resistors were attached to, assuming that you disable those pins in the video driver as mentioned above). Again, that'll save you three to five pins, which hopefully will get you what you need. --Jim
  • JRetSapDoogJRetSapDoog Posts: 954
    edited 2016-11-23 18:57
    Here's a schematic drawing for what I was talking about that assumes that the video pins are P0 through P7. However, this technique is applicable to any of the four pin groups, so just adjust accordingly. If there's any concern about overdriving the VGA inputs, perhaps up the resistor values. Oh, and keep in mind that you could, for example, eliminate the red and blue channels to get down to a total of just three pins if monochrome video will work for you. That's about the limit in terms of fewest pins unless you have external circuitry (to decouple a combined V&H signal) or a monitor that can use sync-on-green, all of which would require significant video driver changes.
    655 x 509 - 14K
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    Yeah, to use less pins you would need a driver to support that. I'm not sure if there is one. Most of the VGA drivers are written for the Demo Board schematic, which is the same as the PPDB.
  • Thank you for your replays. Jim you was very helpful, thank you very much. No i am not limited to the Professional development board, so that's not an issue for me. Currently using TFT monitor which is using PAL&NTCS type systems, unfortunately these screens cause problems, so the way out perhaps could be VGA type connection. I have noticed that programs of TV.spin and TV_text.spin which i am using currently, are very similar to the VGA.spin and VGA_text.spin which i want to use. For the time being going to try to apply the ideas that you proposed, will see how it goes.
    I only hope Chris that it will be possible either to find the driver, which would suit me, either to figure it out in the hard way how to change the program to suit my needs. Many thanks.

    Kind regards,
    Mindaugas
  • JRetSapDoogJRetSapDoog Posts: 954
    edited 2016-12-01 04:45
    @Mindaugas: Glad the info was useful. Just sharing the wealth, something that I don't get to do so often but I've sure been on the receiving end.

    Once you've narrowed down how many colors you can live with (or pins you want to save) and some driver candidates, someone on the forum can probably give you a few pointers on how to modify the driver, if modification is even necessary.

    I think the driver you mentioned that's very similar to TV/TV_text is quite memory efficient. One difference, though, if I recall correctly, is that it gives 32 column of text instead of 40. But there are 40 column (and even 50 column) VGA text drivers out there. A forum member and video guru named kuroneko has written several for the Prop at the standard 80 MHz. And if you have the memory, a Prop expert named Key (Kwabena W. Agyeman) has written a 40 column driver that let's you mix filled/unfilled rectangles with text and I think it allows text lines to be drawn at half-line intervals vertically for better centering control (and it might horizontal centering by drawing at half-character width intervals, but I don't fully recall). Incidentally, Kye also have an SD card driver in the Obex.

    Anyway, some drivers may be in the Obex but not all of them. Some of the drivers are linked to posts, so you'll probably want to do a search. All the ones in the Obex are under the very liberal MIT license, as the Obex requires, so you can pretty much do whatever you want with them, commercial or otherwise, as long as you give recognition per the MIT license. I think Kye removed some of his older drivers from the Obex, but his newer ones are there. Update: kuroneko's nifty drivers are on GitHub, as mentioned in macca's post below.

    I just did a quick search of this forum and here's a thread with a driver that kuroneko wrote in response to a question I had asked in another thread:

    http://forums.parallax.com/discussion/150593/fyi-vga-40x15-single-cog-per-cell-colour-palette-rom-font

    I've used a variant of this driver and only five pins (VHRGB) and am quite pleased with it (it's never had a single glitch = rock steady). I didn't read through that linked thread above just now, so I'm not sure if the latest version of that driver is at the top of the thread or whether you'd have to go down a few posts (and there very well may be more than one version of the driver in that thread). Now a big reason I like his driver is because its light in terms of its memory requirements, but if memory isn't tight, you might try to find Kye's driver that I mentioned above (update: see below).

    Hmm, just did a quick search of the Obex and I see a couple of 640x480 VGA drivers from Kye in there. One is a bit map driver (bit maps tend to take up a lot of memory) and the other is a tile map driver. The tile map drivers are generally very lean on memory, as they usually only allow characters, not any random graphics (with the fonts for the characters being in the Prop's ROM). I think the tile map driver of Kye's that's in the Obex is probably the one that I mentioned above that allows for rectangles, so it's more flexible than most tile map drivers (that's why Kye wrote it, I'd guess), yet it is still lighter than most bit map drivers. I haven't looked at it in a long time, so, off hand, I'm not sure how readily it lends itself to reducing the pin count, but I'd guess that doing so would be pretty straightforward. Obviously, you don't have to connect all the color bits, but you do need to tell the driver somehow to disable using the pins that you don't connect such that they are available for other purposes (you wouldn't want video signals mixed in with your control signals).

    Here's the Obex link to Kye's tile map driver: http://obex.parallax.com/object/97

    I haven't looked into what would be required in terms of modifications to get any of the above drivers to work with fewer pins, but hopefully the above sheds some further light on what's available and might be possible. Good luck.
  • Just wonder in the program VGA text start up pin 16 is called for Vsync and consecutive pins then used for Hsync and RGB pins. Does the pins has to be set that way, what if the free pins are spread over the all parallax chip, in that case does each of the pins has to be initialized separately, or set somehow in the program?? Any ideas? Thanks for help

    Kind regards
    Mindaugas,
  • VGA setup has to done with 8 contiguous pins. You could use P0-P7, P8-P15, P16-P23, P24-P31, but I would stay away from P24-P31, as P28-P31 are used by the EEPROM ans USB chip.
  • OK thanks, will have to move something around in that case.
  • JRetSapDoogJRetSapDoog Posts: 954
    edited 2016-11-29 08:13
    The order of the pins could be varied within a pin group with appropriate driver changes, but using pins from different pin groups to generate one video signal would be a bear in terms of timing synchronization of the video signals (and slight timing variations among the pin groups might throw a monkey wrench into things). Having said that, I think that it would be possible to sync the V and maybe H signals of multiple video drivers to share them, but I don't think that would help in this case. As for "free" pins, they can be spread around the chip, but spreading the video pins among different pin groups for one video driver would take some advanced programming techniques at best.

    As for using the last pin group for video, I've experimented with using pins 24-27 and 30 for VHRG and B, respectively (and maybe some other combinations involving one of the EEPROM's pins (sorry, don't recall)) and it seemed to work okay (and I could still program the chip normally on P30 and P31 using the Prop Plug without disconnecting the video monitor). So I wouldn't completely write off using that pin group (after all, it is in the chip), but if you can move things around without too many compromises, then, yeah, that's probably the best way to go. I always feel uneasy using any of those last four pins (though that hasn't stopped me from trying).
  • Mindaugas wrote: »
    Just wonder in the program VGA text start up pin 16 is called for Vsync and consecutive pins then used for Hsync and RGB pins. Does the pins has to be set that way, what if the free pins are spread over the all parallax chip, in that case does each of the pins has to be initialized separately, or set somehow in the program?? Any ideas? Thanks for help

    The VGA output is basically an 8-bit streamer, using waitvid instructions to output 8-bits at a time with the correct timings. These 8-bits are configured as groups as illustrated by Publison (see also the waitvid instruction on the Propeller manual) and can't be changed. The meaning of the bits however can be easily changed, if for example you need H-sync on pin 7 instead of pin 0 you can change that in the driver, after all they are just 8 bits.

    It is possible to separate the HV-sync pins, look at the drivers from Kuroneko here https://github.com/konimaru/waitvid.2048 some of them have a vpin and spin group selectors with which you can select the output group for RGB and HV-sync separately and also select the pins. See an example at the bottom of this source:
    https://github.com/konimaru/waitvid.2048/blob/master/scanline/320x240/src/waitvid.320x240.driver.2048.spin
Sign In or Register to comment.