HIỂN THỊ HÌNH ẢNH DÙNG 8051 OLED
Trong hướng dẫn này, chúng ta sẽ thấy cách hiển thị hình ảnh / biểu tượng trên 128x64 OLED. Để làm điều này, chúng tôi cần hình ảnh 128x64 pixel, nếu không, chúng tôi phải cắt / thay đổi kích thước hình ảnh có độ phân giải cao hơn. Điều này có thể được thực hiện bằng cách sử dụng photoshop hoặc một số trình chỉnh sửa ảnh khác. Chúng tôi sẽ sử dụng các cửa sổ được tích hợp sẵn trong công cụ PAINT.
Image Resize
Đầu tiên bạn cần là chỉnh hình ảnh về 128 x64 dùng PAINT Như sau :
Lưu ảnh ở định dạng bitmap đơn sắc .bmp như hình dưới đây.
SỬ DỤNG Lcd Assistant HỖ TRỢ NHƯ SAU : LCD Assistant
CODE CHƯƠNG TRÌNH.
#include "oled_i2c.h" code char IPL_Logo [] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x88, 0x84, 0xC4, 0x42, 0x43, 0x41, 0x41, 0x41, 0x80, 0x00, 0x40, 0x80, 0x00, 0x00, 0x20, 0x01, 0x01, 0x03, 0x03, 0x07, 0x1F, 0x3E, 0xFC, 0xF8, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x09, 0x01, 0x01, 0x01, 0x00, 0x00, 0x38, 0x7C, 0x7C, 0xFC, 0x7C, 0xF8, 0xF0, 0x00, 0xC0, 0xE0, 0xF8, 0xFF, 0x7F, 0x1E, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC1, 0x7F, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x07, 0x0F, 0x1F, 0x3E, 0x7C, 0xF8, 0xF0, 0xE0, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x83, 0xFF, 0xFF, 0x7E, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xC0, 0xF0, 0x7C, 0x47, 0x47, 0x7F, 0xFF, 0xF8, 0xE0, 0x80, 0x00, 0x00, 0xFF, 0xFF, 0x07, 0x0F, 0x1E, 0x3C, 0x78, 0xF0, 0xE0, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1F, 0x3F, 0x3F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xF8, 0xF0, 0xE0, 0xC0, 0x00, 0x00, 0x00, 0x80, 0x20, 0x10, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE3, 0xE3, 0xE3, 0x20, 0x20, 0xE0, 0xE3, 0xC3, 0x80, 0x00, 0x00, 0xE0, 0xE0, 0xE1, 0x23, 0x63, 0xE0, 0xE0, 0xC0, 0x83, 0x03, 0x03, 0xE2, 0xE2, 0xE2, 0x23, 0x21, 0x21, 0x20, 0x00, 0x00, 0x00, 0xE3, 0xE3, 0xE3, 0xC0, 0x00, 0x03, 0x03, 0x00, 0x00, 0x80, 0xE0, 0xE0, 0xE0, 0x03, 0x03, 0x03, 0xE2, 0xE0, 0xE3, 0xE3, 0x00, 0x00, 0xE0, 0xE0, 0xE0, 0x20, 0x21, 0x23, 0x23, 0x00, 0x00, 0x00, 0xE0, 0xE0, 0xE0, 0x20, 0x60, 0xE0, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x0F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xF8, 0xF0, 0xE0, 0xE0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x04, 0x07, 0x07, 0x03, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x08, 0x3C, 0x7F, 0xF7, 0xE3, 0xC1, 0x80, 0x00, 0xFF, 0xFF, 0xFF, 0xC6, 0x84, 0x84, 0xC4, 0xC0, 0x00, 0xC0, 0xFF, 0x03, 0x07, 0x1F, 0x7F, 0xFC, 0xF0, 0x78, 0x0E, 0x03, 0x03, 0xFF, 0xFF, 0xFC, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xE0, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xC4, 0x84, 0x84, 0xC4, 0xC0, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x08, 0x3C, 0x7F, 0xF7, 0xE3, 0xC1, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x5E, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xF8, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xF8, 0xF8, 0xF8, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x70, 0x38, 0xF8, 0xF8, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xF0, 0xF0, 0x18, 0x08, 0x08, 0x08, 0x08, 0x08, 0x18, 0x00, 0x00, 0x00, 0xF8, 0xF8, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0xF8, 0x00, 0x00, 0x00, 0xF8, 0xF8, 0xF8, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xFC, 0xFE, 0x7F, 0x7F, 0xBF, 0xBF, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x3F, 0x3F, 0x30, 0x20, 0x20, 0x30, 0x30, 0x00, 0x38, 0x3F, 0x3F, 0x3F, 0x21, 0x21, 0x31, 0x30, 0x00, 0x20, 0x38, 0x1E, 0x07, 0x06, 0x06, 0x07, 0x07, 0x1F, 0x3F, 0x3C, 0x30, 0x01, 0x0F, 0x1F, 0x1F, 0x38, 0x30, 0x20, 0x20, 0x36, 0x3E, 0x3E, 0x02, 0x00, 0x00, 0x0F, 0x1F, 0x3F, 0x30, 0x20, 0x20, 0x20, 0x30, 0x1C, 0x0F, 0x00, 0x00, 0x00, 0x3F, 0x3F, 0x3F, 0x21, 0x21, 0x31, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x05, 0x01, 0x01, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; /* start the main program */ void main() { OLED_Init(); OLED_DisplayLogo(IPL_Logo); while(1); }