Thursday 15 June 2017

What's the simplest way to generate a VGA signal for a totally white screen? Preferably with an AVR MCU


I'd like to make a simple board to plugin a LCD monitor and get a blank white screen. The idea is to use any monitor as a makeshift light table. I have a preference for 8-bit AVR micros since I have a couple laying around.


So what is the simplest way to generate a VGA signal for just a white screen?



Answer



In actuality, you will likely need to switch the R, G, and B lines as well as the HSYNC and VSYNC. Most monitors will not continue to display those colors if a steady DC voltage is present on their inputs. Instead, they usually respond to the difference between the voltage present when the scanning is "off screen" and that present when scanning the intended display area. You might find an odd monitor that would respond to DC, but it's atypical.



Since you want monochrome you can of course drive all three together. A resistive voltage divider is the usual way of creating the right voltage levels.


So basically, you will need to generate a sequence of pulses on HYSYNC, RGB, and VSYNC, with moderately precise delays in between. None of the events really overlap, so this is quite feasible. Your program will probably consist of a for loop producing the desired number of horizontal lines with a sequence of hysnc and RGB turn on-wait-turnoff actions, inside an infinite while loop that drives the vsync to produce full screens. Many monitor manuals would show timing diagrams; often even the manual for a different monitor than you are using would be applicable at least for a suitable resolution/vertical refresh rate.


You could use the hardware timers to generate timing, but since it doesn't sound like you need your micro to do anything else, you could also use a delay loop.


Traditionally a video card generates all it's timing as a multiple of a multi-MHz dot clock, using a programmable counter to count each state as some number of dot clocks and read through the frame buffer. But since you aren't trying to produce any narrow features, you can probably just use a delay loop for whatever the shortest event is (likely the hysnc pulse), and define all the longer events in multiples of that or with their own delay loops if they are not close to an integer multiple thereof.


Access to an oscilloscope would certain simplify the task of getting your implementation right, though it's not an absolute requirement. A monitor will likely generate "something" even with the timing rather off, and you can then "walk" it into position by changing the delays.


It's worth mentioning two things about monitor technologies; CRT's may not be real happy being driven at unusual scanning frequencies and the magnetics may audibly complain; theoretically they could even be damaged. LCD's are pretty tolerant, but go out of their way to adapt to whatever you feed them and make the most of it with their rescaling circuitry. You may find yourself hitting the re-adjust button frequently as you change your timings. I suppose it's also possible that they could fail to adapt to a signal that generates a big rectangle with no high frequency content that they could use to try to align their sampling rate with your non-existent dot-clock in order to sharply display fine text or graphics features that you aren't generating. If using a CRT with an all white display you will definitely want to get the vertical sync rate as high as you can with valid timings to avoid flicker (picking relatively few vertical lines may help with that, since the constraint is often the maximum horizontal frequency the monitor can handle); for an LCD it's not directly an issue so people usually time things to 60Hz.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...