??? 09/14/12 15:10 Read: times |
#188326 - Graphics Displays Responding to: ???'s previous message |
Welcome to the world of graphics displays. When you want to modify one pixel out of a field of other pixels it is necessary to read the other field data, mask it to keep the other data and insert the new data that you want. Then finally you write the new data back.
In your case where the field is a byte of 8-pixels you pre-read the byte. Then either OR in your new pixel if you want to set the new pixel or you would AND the byte with the NOT of your pixel mask to clear the pixel. Then write the final value back to the display. Some displays, particularly those that use a serial interface, cannot be read back to get the previously written pixel values. For this case you need to keep a local buffer that keeps a pixel image of the display available for you to reference. I have posted some sample ideas of how this is done with a buffer like this at the following link. You will find the buffer concept particularly valuable when you come to write font glyphs to the display. Do all the work in the buffer first and then use fast loops to copy the appropriate rasters of pixels from the buffer to the display. Even if you have a display that supports read back of the pixel image you will generally find that operating the display in read/write mode for each pixel is painfully slow. http://www.carousel-design.com/GraphLCD.html Michael Karas |