Tag Archives: pic

PIC Microcontroller RGB Video – Animations!

Update: For those who are interested in seeing how this is done, I have posted schematics and source along with some technical details about this project.  Click here to learn more.

After two days of straight coding, this is the result – two more aliens and an animation routine that toggles between 2 images for each alien and changes aliens every n frames.  The alien selection routine is implemented as a state machine and uses way too many instructions, but fit within a blank line of video so I called it good.  The hardest part again was maintaining a constant number of clock cycles regardless of the program flow through the display loop.  This is required to maintain the video timing and keep the LCD happy.

I also changed the image lookup table routine so that the image to be displayed is loaded during the blanking interval above the top of the visible screen.  This makes the pixel display much more efficient during the field but at the cost of a bunch of memory.  Now instead of execution time during the horizontal line limiting the max resolution, it’s memory instead…  sometimes you can’t win.  If I encoded color more efficiently the memory limitation would go away.

I need to clean up the code and add some more comments, but I’ll post the source in case anyone else is interested in learning how to generate RGB video with a PIC or wants to try a similar project.

Update: The LCD display I am using is a Sharp 4L-U4EB I bought surplus years ago.  I haven’t been able to find any more of them since, does anyone have a source?

Here are some still images showing the animation sequence for each alien.  Click on each for a bigger version.

Still images from space invaders animation Red!

Still images from space invaders animation Green!

Still images from space invaders animation Blue!

Previous posts related to this project:

https://mightyohm.com/blog/2008/09/space-invaders/

https://mightyohm.com/blog/2008/09/generating-analog-rgb-video-with-a-pic-microcontroller/

Also check out my flickr set, PIC Microcontroller RGB Video.

Generating Analog RGB Video with a PIC Microcontroller

Here is a PIC16F628 microcontroller clocked at 20MHz generating an analog RGB video signal with composite sync.

PIC Microcontroller RGB Video

This project was inspired by Rickard Gunee’s PIC Video Howto which gave me a big headstart in writing the code.  Thanks Rickard!  I have been wanting to work on this project since reading the tutorial several years ago, and finally got a chance to start it last week.

There are few fundamental differences in my approach compared to Rickard’s and others I have seen in the past.  His tutorial was written a few years ago before 20MHz PICs were commonly available (it uses an overclocked PIC16F84.)  He also focuses on generating composite video to drive a standard television (using the AV inputs).  I am generating RGB video which will interface with the Sharp LCD I had sitting on the shelf.  RGB is a little different in that it uses a separate sync signal (composite horizontal and vertical sync on one inverted TTL line) and each color is brought out as a separate 0.7Vpp signal.  These two differences make the RGB interface considerably easier (in my opinon) to work with, especially since the approach to composite video Rickard uses is limited to black and white.

So far the biggest challenges have been with getting the video timing right.  I am writing the whole program in PIC assembly and every clock cycle counts.

More on this project soon, but until then, there are a few more photos on flickr.