Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

Share this Page URL

The Flight > Image Serialization - Pg. 236

236 Chapter 12 This ensures that access to the array elements is performed via pointers, something we would have done anyway both when reading and when writing to the array. Image Serialization If each image line is represented in memory in the VMap array by a row of 16 integers, we will need to serially output each bit (pixel) in a timely fashion in the short amount of time (52 s) between the back and the front porch part of the composite video waveform. In other words, we will need to set or reset the chosen video output pin with a new pixel value every 200 ns or better. This would translate into about three machine cycles between pixels, way too fast for a simple shift loop even if we plan on coding it directly in assembly. Worse, even assuming we managed to squeeze the loop in so tight, we would end up using an enormous percentage of the processing power for the video generation, leaving very few processor cycles for the main application (18% in the best case). Fortunately, there is one peripheral of the PIC24 that can help us efficiently serialize the image data: it's the SPI synchronous serial communication module. In a previous chapter we used the SPI2 port to communicate with a serial EEPROM memory. In that chapter we noted how the SPI module is composed of a simple shift register that can