I have a project where I want to read the HSync and VSync signal from a VGA cable into an microcontroller and calculate the pixel clock.
Calculation: Pixel clock = Horizontal Pixel Count * Vertical Line Count * Refresh rate
I'm currently stuck by the question of how I can get the horizonal pixel count.
If we assume that my VGA cable caries a 640x480 (800x525 with the porches) @ 60Hz signal, like shown here:
I can get the refresh rate by timing the vertical sync pulses to each other (~16.68ms > 1/16.68ms = 60Hz.) I can get the vertical pixel count by dividing the time of every frame and the time of every HSync pulse to each other (16.68ms / 31.77µs = ~525 lines).
How do I get the horizontal pixel count?
For 640x480 @ 60Hz it should be 800 pixels.
Really important is that the resolution and framerate of the VGA cable is not fixed, so I can not use any definitions for timings.
For clarification: I know that a VGA cable sends analog signals and there aren't any pixels. But my source device have pixels and they convert them into analog video signals. So want to get the pixel clock from my source device that is connected via a VGA cable.