LCD screen connection via vga type connector
Mindaugas
Posts: 15
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
Kind regards,
Mindaugas
Comments
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
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
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.
Kind regards
Mindaugas,
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).
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