PIC Programming - Software Driven Video


An acquaintance had a need for a portable PAL composite video source with two requirements:

  1. Generate a visible image for setting up projection gear before any other video sources are available.
  2. Provide a black video signal to suppress the blue screen displayed by the projection equipment when no input is present.

I adapted Dave Woodhouse's Video Cross Hatch Generator project. The hardware is the same, with the exception of a DPDT center-off switch in the +5V line. One pole of the switch supplies +5V in both positions. The other pole of the switch goes to a 1k resistor connected to RA0 [pin 17]. In one position the 1k resistor is connected to 0V, in the other it is floating.

The firmware has been modified to clean up the sync timing somewhat, and also to extend the horizontal lines across the full screen width. In addition there is code to generate a black-level raster. At start-up the state of RA0 [via the position of the DPDT switch] determines which code is run.

This is an interesting example of real-time programming. Every instruction needs to be counted to ensure the timing is correct. There's very little leeway when running a 4MHz clock. A higher clock speed permits the generation of more complex video signals. For more information on this subject, Rickard Gunee has written a comprehensive article on the subject. Note that his examples use a 12MHz clock.

Back Home