The first is to develop guidelines to see if some can not understand:
OLED_GRAM [128] [8] represents the number of 128 (x-coordinate) column, 8 represents the page, and each page contains 8 lines,
a total of 64 lines (y-coordinate). Descending number corresponding row from small to large. For example, we want to x = 100, y = 29 to write the point
1, can be achieved with this sentence:
OLED_GRAM [100] [. 4] | = 1 << 2;
a generic point (x, y) is set 1 expression is:
OLED_GRAM [X] [Y-. 7 /. 8] | = 1 << (Y-%. 7. 8);
Then find the Internet to find, some people say is to convert coordinates GRAM address. Still can not understand, then to find a relatively easy to understand, and record it
Paste the original post address: http://www.openedv.com/forum.php?mod=viewthread&tid=71722
Then get to the point
As shown in picture 1, which is an OLED memory storage format.
Picture 2 is OLED_GRAM [128] [8] defined routines.
Picture 3 is the original routine OLED_Refresh_Gram () function to i = 0 Example:
step1: performing OLED_WR_Byte (0xb0 + 0, OLED_CMD) ;
i.e., a pointer to the page memory provided OLED page 0.
step2: performing OLED_WR_Byte (0x00, OLED_CMD);
OLED_WR_Byte (0x10, OLED_CMD);
i.e., a pointer to the set of OLED memory column 0.
step3: performed for (n = 0; n-<128; n-++)
OLED_WR_Byte (OLED_GRAM [n-] [0], OLED_DATA);
when p n = 0, the OLED_GRAM [0] [0] is written OLED video memory 00 column; then, OLED memory column pointer plus one , i.e., point 0 this page 2 column;
when n = 1, is written to the memory OLED 0 1 OLED_GRAM [1] [0]; then, OLED memory column pointer plus 1 , i.e., point 0 this page . 3 column;
...
up to n = 127, 0 is written to memory 127 of OLED OLED_GRAM [127] [0]; then, OLED memoryColumn pointer return , i.e., point 0 column;
Here, there is a need to pay attention to the problem, which specifies the instruction SSD1306 page pointer, walking the way row pointer it? Individual estimates should exist among 4 pictures, the lack of detailed instruction examples, instructions for SSD1306 more familiar with big God can discuss in SSD1306 chip manual.
Summary: 1 understand the definition OLED_GRAM, we need to carefully read OLED_Refresh_Gram () function execution process;
2. To understand OLED_Refresh_Gram () implementation process, need to understand the page pointer, walking the way row pointer, which requires careful manual reading SSD1306 chip .