vico wrote on 2024-04-19, 03:42:I can't figure out how you do the calculation, there are several things I don't know, I don't know where the values 800 and 525 came from, I don't know what values to use to calculate the minimum Pixel Clock of my monitor.
800 pixels fer line and 525 lines per frame are the VGA 60Hz resolution standard, someone came up with these values multiple decades ago at IBM and every VGA monitor and card uses these values or close approximations when outputting the standard VGA resolution.
Could you explain how the maximum 80MHz value was calculated?
The 80MHz maximum is the physical limit of your monitor, it is only able to sync up to pixel clocks up to 80MHz, while also needing to follow maximum line rate which is 60kHz and maximem frame rate which is 75Hz. Panel resolution is 1024 x 768 pixels.
According to these specs, this is an attempt to calculate lower level details of the maximum the monitor can handle :
*Maximum Pixels per line = Pixel Clock / Line Rate = 8000000 / 60000 = 1333.3333...
*Maximum lines per frame = Line Rate / Frame Rate = 60000 / 75 = 800
These figures also include not just visible pixels but also borders, blanking and sync portions.
Since the monitor native resolution is 1024 x 768, this leaves 1333 - 1024 = 309 pixels for all the horizonntal offscreen parts on a line, and 800 - 768 = 32 lines for vertical bits beyond the active image.
A line is composed of 4 parts :
* Sync pulse
* Left blanking + border (commonly called Back Porch, because it is after the sync pulse)
* Active line (the actual visible pixels)
* Right blanking + border (commonly called Front Porch, because it is before the sync pulse)
Similarly a frame is composed of 4 parts too :
* Sync pulse
* Top blanking + border (vertical back porch)
* Active frame (the actual visible lines)
* Bottom blanking + border (vertical front porch)
Active line takes 1024 of these pixels, the remaining 309 are divided up to the sync and porches according to some standards and implementation details, i.e. sync pulse must be more than 1µs long) For example if you need to shift image toward left, you increase front porch pixel count and reduce back porch while making sure the total pixel count remains same. If it doesn't, the image timings change and this leads to a different resolution to the monitor.
Similar things for vertical centering, you reduce one porch by the same amount you incerase another.
----
Now to your original problem, you mentioned the image is too wide. This means that while the monitor synced up to the timings, there are simply too many pixels per line to fit into the visible portion. A solution is to increase pixel clock and increase porches to maintain the timings. Each increment of pixel clock makes the pixels narrower, and if porches are not increased the timings will also change. There will be a point where the image will fit onto the screen with just the right amount of border outside it.
To make this easier, what kind of resolution are you wanting, and what kind of timing values do you know ? All of these parameters are interrelated, and if you know some you can calculate the others.
For example to find pixel clock you do :
Pixel Clock = Pixels per Line * Line Rate
Pixel Clock = Pixels per Line * (Frame Rate * Lines per Frame)
As before, per line and per frame figures include blanking and sync portions, they can never be ignored.
This is a neat site that can be most helpful : https://tomverbeure.github.io/video_timings_calculator