+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 20 of 22

Thread: Resistor values for 64 GreyScale VGA output from the Propeller

  1. #1

    Post Resistor values for 64 GreyScale VGA output from the Propeller

    The Propeller's VGA output typically outputs 6 bits of colour (RrGgBb) plus two sync signals on an 8 bit "port". Using two resistors per colour, the Red, Green, Blue video signals can each have one of four levels, giving 64 possible colours, but only 4 true grey scales (Black, Dark Grey, Light Grey, White).

    For some applications (photographic, video processing) it is more desirable to use the 6 bits available purely for intensity. The result is a smooth 64 levels of grey.

    Click image for larger version

Name:	DSC01266.jpg
Views:	209
Size:	36.1 KB
ID:	81107Click image for larger version

Name:	DSC01272.jpg
Views:	631
Size:	54.2 KB
ID:	81108

    GREYSCALE RESISTOR LADDER

    The resistor ladder connected to the 6 output pins is a sequence of doubling resistors - R, 2R, 4R, 8R, 16R and 32R.

    Click image for larger version

Name:	VGA_64grey.png
Views:	400
Size:	17.1 KB
ID:	81109

    Since the Red, Green and Blue signals are tied together to always make 'grey', the 'loading' impedance is 25 ohms, rather than the usual 75 ohms for separate signals.


    CALCULATING THE EQUIVALENT RESISTANCE REQUIRED TO GET THE CORRECT VIDEO LEVEL

    VGA standard expects a 0.7 volt peak signal for "full on" (white). Since the r,g and b are tied together to make 'grey' the 'loading' impedance is 25ohms, rather than 75 ohms.
    Prop with all 6 pins on (3.3v) ---/\/\Requiv\/\/---x---/\/\25\/\/----GND
    We want 0.7 volts at node 'x' when all 6 bits are on (3.3v)
    0.7=3.3*(25/(25+Requiv))
    117.86 = 25 + Requiv
    Requiv = 92.86 ohms


    CALCULATING THE ELEMENTS OF THE LADDER ("R")

    Requiv is the equivalent resistance of the overall 6 pin network, using the formula for resistors in parallel:-
    Requiv = 1/(1/R + 1/2R + 1/4R + 1/8R + 1/16R + 1/32R)
    Requiv = 32R/63
    R = 182.81 ohms


    PRACTICAL E12 RESISTOR VALUES

    We know the equivalent resistance required, but what about the individual values that make up the R~32R ladder? What resistors can we use to achieve a close to ideal result? Incorporating the ~ 27 ohm internal Propeller FET resistance,
    P23: R = 182.8125 ohms - less 27 ohms internal - use 154 ohms
    P22: 2R = 365.63 - use 340 ohms
    P21: 4R = 731.25 - use 698 ohms
    P20: 8R = 1462.5 - use 1430 ohms
    P19: 16R = 2925 - use 2870 ohms
    P18: 32R = 5850 - use 5760 ohms
    P17: use 220ohms as usual (sync)
    P16: use 220ohms as usual (sync)

    Click image for larger version

Name:	DSC01268.jpg
Views:	221
Size:	81.3 KB
ID:	81106

    CHECKING THE PROPOSED RESISTOR VALUES

    Using the above "practical" values, the resultant equivalent resistance is 91.9 ohms. The peak voltage level would therefore be 3.3*(25/(25+91.9)) = 0.706 volts peak.


    TEST CODE

    The following code is based on Kye's 160x120 6 bit per pixel VGA driver. The engine stays the same, the intensity of each byte is (greyscale) Ggggggxx instead of RrGgBbxx.
    Last edited by Tubular; 01-16-2012 at 10:27 PM. Reason: Updated 1% resistor values include 27 ohm internal prop fet resistance.

  2. #2

    Default Re: Resistor values for 64 GreyScale VGA output from the Propeller

    Nice work! Very useful for vision apps, as you noted.
    www.mikronauts.com / E-mail: mikronauts _at_ gmail _dot_ com / Products and Projects:
    RoboPi: The most advanced Robot controller for the Raspberry Pi (Propeller based)
    SchoolBoard ][ Solderless Educational Development Board (Propeller, FPGA, more)
    Advanced prototyping & Parallax Propeller boards - Follow @Mikronauts on Twitter

  3. #3

    Default Re: Resistor values for 64 GreyScale VGA output from the Propeller

    Thanks Bill.

    The other thing it could do well, would be view avatars... should the world ever need that!

    (I was trying to think what else is around the 160*120 pixels in native format...)

  4. #4

    Default Re: Resistor values for 64 GreyScale VGA output from the Propeller

    This theory needs to be ammended to allow for the driving impedance of the prop (about 27 ohms I think). Essentially each driving resistor needs its value lowered by 27 ohms.

    I'll amend it once I have a bit more of an idea about the range of output impedances across a few prop chips. The 27 ohm estimate is based on measuring just one device at 3.3v.

  5. #5

    Default Re: Resistor values for 64 GreyScale VGA output from the Propeller

    Nice work. With a little program to convert color to grayscale you should have some nice pictures. I'm looking forward to some screenshots

  6. #6

    Default Re: Resistor values for 64 GreyScale VGA output from the Propeller

    It's 06:35 here, I'm at "work", and I was also here 8 hours ago. My bleary eyed thoughts are ruminating on whether Gamma curves should be taken into account.

  7. #7

    Default Re: Resistor values for 64 GreyScale VGA output from the Propeller

    I have often mused about VGA grey scale too, but my approach would be to try the Duty DAC idea used on the 1PinTv code.

    You could try it on just green for a retro monitor, or tie RGB together to get greyscale.

    Or use two cogs to drive RGB separately and do a 16bit color driver.

    ....Perry

  8. #8

    Default Re: Resistor values for 64 GreyScale VGA output from the Propeller

    Drac, yep should have some screenshots soon. Short movie clips may also be possible using the dataflash (~200 frames?)

    Toby, Hmmm. Not sure if gamma can be easily corrected in the hardware domain. Think it must be a software problem...

    Perry, I'd be very interested to see how well that might work. But how many levels might you get given the pixel clock requirements of vga?

  9. #9

    Default Re: Resistor values for 64 GreyScale VGA output from the Propeller

    Very nice job!
    Nyamekye,

  10. #10

    Default Re: Resistor values for 64 GreyScale VGA output from the Propeller

    Quote Originally Posted by Tubular View Post
    Perry, I'd be very interested to see how well that might work. But how many levels might you get given the pixel clock requirements of vga?
    There are no clock requirements, instead of setting outputs to resistors you set the frequency of a "Duty DAC" you should be able to go over 255 grey scales if you use words!

  11. #11

    Default Re: Resistor values for 64 GreyScale VGA output from the Propeller

    The problem with DUTY mode output is that it has to be low-pass filtered to produce an analog voltage. The DUTY transitions occur every 12.5ns with an 80 MHz clock. One VGA pixel at, say, a 25 MHz dot clock lasts only 40ns. That's only 3.2 DUTY transitions, or enough for three gray levels. 64 transitions -- enough for six bits of gray-level data, requires 800ns, which spans (i.e. smears out over, when filtered) 20 horizontal pixels.

    The reason the "DUTY gray" technique works with NTSC output is that each pixel lasts longer, so the output can be more aggressively filtered without producing horizontal smearing.

    -Phil

  12. #12

    Default Re: Resistor values for 64 GreyScale VGA output from the Propeller

    I guess we're only using 160 horizontal pixels, so 160ns/transitions?

    It might be that a duty approach combined with a multi pin resistor DAC may extend the number of perceived levels and smooth out the greys?

  13. #13

    Default Re: Resistor values for 64 GreyScale VGA output from the Propeller

    What's your pixel clock rate? That will be the determining factor.

    -Phil

  14. #14

    Default Re: Resistor values for 64 GreyScale VGA output from the Propeller

    I updated the top post with the 1% resistor values I'm actually using. These values factor in the 27 ohm internal prop fet resistances.

  15. #15

    Default Re: Resistor values for 64 GreyScale VGA output from the Propeller

    I'll be testing this tomorrow with a R-2R networking using 91 ohm and 160 ohm (187ohm with pin resistance included) resistors. I used http://www.brischalle.de/JDAC/DAC_R2...lation_en.html to figure these values out. Should be a big improvement over the 5 colors I'm using now.

    Lawson
    micro-power experiments with the propeller.
    Drivers for TAOS TSL3301 line sensor Forum thread, and OBEX
    Lumen Electronic Jewelery Website
    My AWD motorcycle Website and action video
    What I'm paid to work on. UW Lidar Group.
    FME, a Spin-only floating point library with trig, exponential, and logarithm functions. OBEX and Forum.

  16. #16

    Default Re: Resistor values for 64 GreyScale VGA output from the Propeller

    Well the Proto-board modification worked exactly as planned. Everything would have fit better if I had found 0805 size resistors in the correct values, but 1206 size still worked fine. (see the attached picture) I also found out that the buzzer conductivity test mode of my multi-meter shows 0.000 resistance for >700ohms. Note to self, don't use the buzzer conductivity mode to double check solder joints on resistor sculptures

    Lawson
    Attached Thumbnails Attached Thumbnails Click image for larger version

Name:	P1040352-2.JPG‎
Views:	99
Size:	158.9 KB
ID:	89919  
    micro-power experiments with the propeller.
    Drivers for TAOS TSL3301 line sensor Forum thread, and OBEX
    Lumen Electronic Jewelery Website
    My AWD motorcycle Website and action video
    What I'm paid to work on. UW Lidar Group.
    FME, a Spin-only floating point library with trig, exponential, and logarithm functions. OBEX and Forum.

  17. #17

    Default Re: Resistor values for 64 GreyScale VGA output from the Propeller

    I'd like to see a pick-and-place machine that could do that!

    -Phil

  18. #18

    Default Re: Resistor values for 64 GreyScale VGA output from the Propeller

    Stonehenge, for the electrons.

  19. #19

    Default Re: Resistor values for 64 GreyScale VGA output from the Propeller

    Love it... i'd heard of air cored inductors before, but not resistor networks.

    Bourns make R2R networks in SIP format, not sure if they go quite low enough however (100 ohms min?).

  20. #20

    Default Re: Resistor values for 64 GreyScale VGA output from the Propeller

    Quote Originally Posted by Lawson View Post
    I'll be testing this tomorrow with a R-2R networking using 91 ohm and 160 ohm (187ohm with pin resistance included) resistors. I used http://www.brischalle.de/JDAC/DAC_R2...lation_en.html to figure these values out. Should be a big improvement over the 5 colors I'm using now.

    Lawson
    What did you fill in for RL and how did you hook it up to the vga port?

+ Reply to Thread

Similar Threads

  1. What two values for VGA R-2R resistor ladder?
    By tonyp12 in forum Propeller 1 Multicore Microcontroller
    Replies: 5
    Last Post: 05-10-2011, 09:23 PM
  2. DAC w/ PWM output using resistor/capacitor
    By smbaker in forum Propeller 1 Multicore Microcontroller
    Replies: 2
    Last Post: 07-19-2010, 03:23 AM
  3. grounding output pin w/no resistor?
    By northcove in forum Propeller 1 Multicore Microcontroller
    Replies: 18
    Last Post: 06-08-2009, 05:26 AM
  4. PWM+RC Audio Output - R & C values
    By hippy in forum Propeller 1 Multicore Microcontroller
    Replies: 10
    Last Post: 09-29-2008, 07:17 PM
  5. Replies: 6
    Last Post: 01-13-2006, 02:21 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts