单片机控制诺基亚2600彩屏(八)
0赞
Step 9Drawing Optimizations
Step 10Drawing Pictures Using the Serial Port


It is actually very easy to draw full color photos on the LCD! I simply used the serial port to transfer the image from the PC to the AVR which displays it on the LCD. To convert the image into the correct format, I wrote a small application in Visual Basic (VS 2010) that takes a 130x130 .bmp formatted image and transforms it into the 12 bit per pixel color format needed to display on the LCD. The Visual Basic VS2010 project is included with the code package at the end of this Instructable.
The serial port uses 115200 baud which is very fast for a microcontroller. This enables a quick transfer of image data to the microcontroller and it can draw a full 130x130 image in less than 1 second. To do this, the microcontroller must be running at around 20MHz (it must be exactly 20MHz to use the code unmodified, but it may work at 16MHz if the baud rate calculation is changed). A MAX232 level shifter is used to convert the RS-232 signal into a 0-5V TTL signal. Although the ATMega168 is only running at 3.3V, the inputs are 5V tolerant so you may connect the 5V signal to the Rx pin and it will still work.
