circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

October 2006, Issue 195

Generate Video from Software

 


by René Geraets

Start Video Signal Anatomy Transforming Digital I/O Output Resolution Memory Restrictions Using DMA Perfect Fit Sources and PDF

MEMORY RESTRICTIONS

Another reason to keep the resolution relatively low is to make the image fit in the M16C/62P microcontroller’s internal memory. I need 4 bits per pixel (1 bit for each I/O pin allocated to video), but use a complete byte to store each group of 4 bits. This makes it possible to copy the pattern directly to the I/O port without any mask or shift operations on the bit pattern. This is important because I have a limited amount of time to spend on each pixel (only eight processor clock cycles!), and I use the DMA controller for the actual output streaming.

Given such choices, I can calculate the required amount of memory. Each video line contains 64 µs of data (useful picture content plus the sync pulse). At a 3-MHz pixel clock, the amount of memory to store each line amounts to 192 bytes (i.e., 0.000064 × 3,000,000). With 120 lines for PAL, the total amount for the image is 23 KB (120 × 192). It is slightly less for NTSC because I use only 100 image lines. The 23 KB fit well within the available 31 KB of memory in the M16C/62P microcontroller. This leaves enough room to spare for the other variables, data structures, and stack of the application.