View Full Version : Graphics Pinouts
02-07-2007, 07:52 AM
Hey Guys, I have just 1 more question that will help me finish the PCB for my game console design,
If I am planning on generating 256 color graphics on the Propeller, what kind of pinouts/circuits would I need?
I was following the design of the prop demo board, but I noticed that the video output is basically a series of resistors forming a DAC across 4 pins. So, would I need to use more pins/resistors for more colors or...what?
Suggestions would be appreciated!
02-07-2007, 08:30 PM
The prop board uses two resistors, a 240 Ohm, and a 470 Ohm to create a resistor divider together with the 75 Ohm input impedance of the VGA monitor to create four different voltage levels, between 0 Volt and 1 Volt, on each of it's R/G/B input levels.
The six bits used means a total of 64 colors are possible.
When you want more than 64 colors, you need to add more bits to the resistor dividers.
Unfortunately 256 colors means you have eight bits, so you cannot give each R/G/B input the same number of bits.
Traditionally this is solved by giving two inputs three bits and the remaining one two bits. So its a question which color tints you want to give eight levels, and which one only four. Traditionally blue is chosen to get only four levels.
The resistors should be chosen such that each one has the double value of it's counterparts, and the parrallel resistance should be about 172 Ohm.
For the two bit resistor the nearest practival values then are 240 and 470 Ohm.
For a three bit resistor divider the resistor values would be 1200 Ohm, 560 Ohm and 270 Ohm.
Note that the best soution would be to rewire the current six resistors so that the new eight resistors are connected to a 8-bit port of their own.
02-07-2007, 10:20 PM
Well, that's somewhat helpful, but I was referring to the TV Video output, not the VGA output.
64 Colors may be enough though, if that's what its set up for...
Can you define a custom palette or are they based on the hardware configuration?
I know the HYDRA goes into some detail about palettes, and customizing them.
How many colors out of the TV out can I expect from the demo board setup, and what would I need to modify to get more?
02-07-2007, 11:59 PM
Okay, I thought you were refering to the new propeller proto board, which does not have a TV video output (as standard).
When talking about the TV video output, then what you are really talking about is composite video output, see:
The same basic principle applies for the resistor dividers, they create a signal between 0 and 1 Volt, by using the 75 Ohm input of the PAL/NTSC/SECAM compatible input on your TV (often a SCART input in europe, or the yellow RCA connector), but this time they use three resistor pairs for eight different levels.
You might ask why there is a fourth resistor, but it is NOT used when creating a composite video signal. Instead, the propellor is also capable of directly generating a RF (antenna) signal that is modulated with the composite video, but -also- with an audio signal, the fourth resistor is then used to add this audio subcarrier.
The lower one third of the (composite video) 1Volt voltage range must be used for the sync and blanking signals, thats two or three levels out of the eight possible, with the remaining five or six it is then possible to create "grey scales", but two (one above "max white", and one below "max black") levels are probably needed for the color busts (see further) so you end up with only four (four levels are encodable in two bit's so thats practical).
Color is not directly encoded with voltage levels on the ouput, but by using a "color burst" signal, with a fixed amplitude. This is a high frequency (relative to the greyscale video signal) signal superimposed on the gray scale level.
Before each scanline begins, there is a time period called the "front porch", during that period, the high frequency color burst signal is present also. The trick is that the phase shift between the color burst signal of the front porch, and the color burst signal superimposed on the grey scale signal determines the color of the signal at that moment.
By manipulating the phase shift of the color burst it is therefore possible to determine the color.
The propellor COG that creates the video signal uses one of the counters to create the color burst frequency, and the software manipulates the phase shift register of the counter to create the necessary phase shifts. So actually the number of colors that are possible are not dependant on any pins or resistor combinations, but on the software, and the propellers counter hardware capability to create a number of discrete phase shifts at the desired frequency (3.579545 MHz).
If you still want 256 different colors, lets calculate how many possible phase shifts you need.
Because, (in principle) "all black" does not have different colors, you can only have three different luminances for each tint of color, so when you want to display 256 different colors, you can divide the number of colors by three, so you only need to create about 86 different phase shifts 3x86=258.
If you ignore that black cannot have different tints of grey, by just concidering it as a very dark kind of gray, then you can do with 256/4 =64 different phase shifts.
You can also still add "real black", with a bit of software trickery, by discarding one of the darkest grey color tints and replacing that with a signal that drives the composite video output level to a levels below the "very dark grey" level.
The conclusion is that the number of available colors does NOT depend on the current hardware configuration, but on the TV out video software, and the capabilities of the timer hardware inside each COG.
P.S. I did NOT (yet) look at the TV out video code, so I dont know the exact capabilities of the color burst generating timer, but this is the general principle of how a TV signal generator works.
Post Edited (mahjongg) : 2/7/2007 4:29:46 PM GMT
Thanks for posting that mahjongg... I was wondering the same thing and your response was very helpful.
02-08-2007, 06:21 AM
Yeah, thanks a bunch, thats just the info I needed, it'd be nice if someone could write up a 'basics of video signals and hardware' tutorial for us noobs.