Tutorials to .com

Tutorials to .com » Mechine » Display » OLED display module with C8051F MCU design

OLED display module with C8051F MCU design

Print View , by: iSee ,Total views: 20 ,Word Count: 2790 ,Date: Tue, 9 Jun 2009 Time: 12:28 AM

Organic light-emitting display OLED (Organic Light Emitting Display) is a liquid crystal display technology is more than a new generation of advanced flat panel display technology, is recognized as the industry's most promising next-generation display technology. It compared with the liquid crystal display technology with ultra-thin, high brightness, wide viewing angle, since the light-emitting, fast response, wide temperature range to adapt to, seismic, and low power consumption, enabling the advantages of flexible display can be widely used in communication , computers, consumer electronics, industrial applications, commercial, transportation and other fields. VGS12864E display module in the following as an example, C8051F020 mcu and its interface design and software programming.

1 VGS12864E display module

VGS12864E is 128 × 64 line monochrome dot matrix of OLED, character, graphic display module. 64 × 64 module containing the display data RAM, of which each data corresponds to the OLED screen on a point of light, dark state; its interface circuit and operation of command is simple, with 8-bit parallel data interface to read and write timing Adapter 6800 series of timing, can be directly connected with the 8-bit microprocessor; Intel 8080 and the timing of the MCU to connect the need for conversion timing.

2 shows the module structure

2.1 module block diagram

VGS12864E display module 128 for display, 64 line, the use of a 64 line output line drives and drive controllers out two of them out each drive output 64. Line drive has nothing to do with the MCU, as long as the power supply will be able to generate drive signals and synchronization signals, the module only with the external signal out of the drive. Built-in drive out 64 × 64-bit display memory, RAM is divided into eight, eight lines per page; screen shows the status of each pixel and display data memory-one correspondence that shows the data memory directly as a graphical display of the drive signal for "1" indicates that for "0" do not show. Figure 1 is a block diagram of the logic interface circuits.

OLED display module with C8051F MCU design

1VGS12864E logic diagram of Figure

2.2 module pin functions and instruction set

Module pin functions as listed in Table 1. Command module systems and liquid crystal display driver HD61202 compatible controller, a total of seven instructions. For a detailed description here is not only a list of commands listed in Table 2. The first two types of settings to show the status of orders, while the remaining categories of commands for reading and writing operations.

1VGS12864E pin function table

OLED display module with C8051F MCU design

Command list table 2VGS12864E

OLED display module with C8051F MCU design

3 shows the single-chip module is compatible with the hardware interface design Cygnal

The interface connector VGS12864E in two ways: one is the direct access method, and the other is an indirect access. No matter which way, it is necessary to visit the module must first read the status register content, determine the "busy" sign, take one's time only when they can visit. Direct access method is the interface module as a memory or I / O devices directly linked to the MCU bus, MCU to access the memory or I / O devices to operate on the module. Indirect access is through software simulation MCU timing control operation of the module. Here is the Cygnal C8051F020 MCU and indirect access VGS12864E interface design.

C8051F020 is Cygnal Introduces a mixed-signal SoC-based 8-bit single-chip, highly integrated mixed-signal system-level chips. It has 100 feet of the TQFP package, low power consumption, power supply voltage of 2.7 ~ 3.3 V, all I / O, RST, JTAG pins are 5 V voltage resistance; have high-speed, pipelined 8051-compatible structure CIP51 core (up to 25 MIPS). The MCU has P0 ~ P7 a total of 64 general-purpose I / O ports, each port pin can be configured as push-pull output or open-drain output level. For VGS12864E, due to its operating voltage is 5 V, and C8051F020 is the operating voltage 3.3 V, the output of the C8051F020 to be better able to drive 5 V input of the OLED, the need for additional system configuration. In addition to the corresponding output port is set to "open-drain", the circuit will be in each port through a pull-up resistor from 5 V power supply, the C8051F020 can guarantee such a logic "1" output can be raised to 5 V. Interface circuit shown in Figure 2.

4 software programming

Software programming language using Keil C51, including the display driver hardware modules (that is, written instructions and write data), display module to initialize and clear screen, etc., as well as general subroutine West of the display of text characters procedures. Instruction as a result of this module and liquid crystal display drive controller HD61202 compatible, these procedures have a high versatility. Chinese characters for the characters revealed that the module is based on the characteristics of characters in the data base form of the preparation of data, that is, one byte of data that an 8 × 1 data, and the characters are usually compared to the Treasury, the character is a 90 ° rotation of the matrix data. Zimo21.exe check matrix using the software and set up for extracting the longitudinal modulus, it is easy to obtain the required mode of Western text. As the display module in each of 8 × 1 column of data is low in the former, high in the latter, in order to further the realization of the right of Chinese and Western text shows that this method needs to be made through the matrix of high and low bytes of each bit for a swap and procedures used in an array UpsetChar [] to achieve. Procedures used in Spanish is 16 × 8 characters dot matrix, character is the 16 × 16 lattice.

Cygnal indirect access through the single-chip control OLED. Its I / O ports need to be configured as follows:

void C8051F020_output_config() {
P2MDOUT = 0x00; //P2.5(lcd_wr),P2.6(lcd_rd),
//P2.7(lcd_rs)P74OUT = 0xf3; //P5.0~P5.7(lcd_d0 lcd_d7)
//
}
void C8051F020_output_config() {
P2MDOUT = 0x00; //P2.5(lcd_wr),P2.6(lcd_rd),
//P2.7(lcd_rs)P74OUT = 0xf3; //P5.0~P5.7(lcd_d0 lcd_d7)
//
}

On the display module to write command to write data operation and write operation is divided into the left screen and right screen to write. Write about the difference between a half-screen digital home is just the corresponding chip select signal, and the write command and write data to write the difference is that home-bit data register select signal RS. Show the location of the initialization of the completion of the identification and open the show. Screen left is to write commands and write data on the left screen as an example to illustrate the operation function.

OLED display module with C8051F MCU design

Figure 2C8051F020 with indirect access VGS12864E interface circuit

(1) command to write the left screen

void wr_command1() {
cs1=1; cs1=1; cs1=1;  //cs2=0; cs2=0; cs2=0;
read_status();     //BUSYr_w=0; r_w=0; r_w=0;
P5=com;         //I/Oe=1; e=1; e=1;
e=0; e=0; e=0;     //E,//
}
void wr_command1() {
cs1=1; cs1=1; cs1=1;  //cs2=0; cs2=0; cs2=0;
read_status();     //BUSYr_w=0; r_w=0; r_w=0;
P5=com;         //I/Oe=1; e=1; e=1;
e=0; e=0; e=0;     //E,//
}
void wr_command1() {
cs1=1; cs1=1; cs1=1;  //cs2=0; cs2=0; cs2=0;
read_status();     //BUSYr_w=0; r_w=0; r_w=0;
P5=com;         //I/Oe=1; e=1; e=1;
e=0; e=0; e=0;     //E,//
}
void wr_command1() {
cs1=1; cs1=1; cs1=1;  //cs2=0; cs2=0; cs2=0;
read_status();     //BUSYr_w=0; r_w=0; r_w=0;
P5=com;         //I/Oe=1; e=1; e=1;
e=0; e=0; e=0;     //E,//
}
void wr_command1() {
cs1=1; cs1=1; cs1=1;  //cs2=0; cs2=0; cs2=0;
read_status();     //BUSYr_w=0; r_w=0; r_w=0;
P5=com;         //I/Oe=1; e=1; e=1;
e=0; e=0; e=0;     //E,//
}

(2) to write data on the left screen

void wr_data1() {
cs1=1; cs1=1; cs1=1;  //cs2=0; cs2=0; cs2=0;
read_status();     //BUSYd_i=1; d_i=1; d_i=1;
r_w=0; r_w=0; r_w=0;
P5=dat;         //I/Oe=1; e=1; e=1;
e=0; e=0; e=0;     //E,//
}
void wr_data1() {
cs1=1; cs1=1; cs1=1;  //cs2=0; cs2=0; cs2=0;
read_status();     //BUSYd_i=1; d_i=1; d_i=1;
r_w=0; r_w=0; r_w=0;
P5=dat;         //I/Oe=1; e=1; e=1;
e=0; e=0; e=0;     //E,//
}
void wr_data1() {
cs1=1; cs1=1; cs1=1;  //cs2=0; cs2=0; cs2=0;
read_status();     //BUSYd_i=1; d_i=1; d_i=1;
r_w=0; r_w=0; r_w=0;
P5=dat;         //I/Oe=1; e=1; e=1;
e=0; e=0; e=0;     //E,//
}
void wr_data1() {
cs1=1; cs1=1; cs1=1;  //cs2=0; cs2=0; cs2=0;
read_status();     //BUSYd_i=1; d_i=1; d_i=1;
r_w=0; r_w=0; r_w=0;
P5=dat;         //I/Oe=1; e=1; e=1;
e=0; e=0; e=0;     //E,//
}
void wr_data1() {
cs1=1; cs1=1; cs1=1;  //cs2=0; cs2=0; cs2=0;
read_status();     //BUSYd_i=1; d_i=1; d_i=1;
r_w=0; r_w=0; r_w=0;
P5=dat;         //I/Oe=1; e=1; e=1;
e=0; e=0; e=0;     //E,//
}

Among them, a function of time using state spaces query flag, that is

void read_status() reentrant {
uchar busy;
uchar temp;
d_i=0; d_i=0; d_i=0;  //r_w=1; r_w=1; r_w=1;  //do {
P5=0xff;
e=1; e=1; e=1;
busy=P5;      //P5e=0; e=0; e=0;
temp=busy&0x80;
}while(temp!=0);
}
void read_status() reentrant {
uchar busy;
uchar temp;
d_i=0; d_i=0; d_i=0;  //r_w=1; r_w=1; r_w=1;  //do {
P5=0xff;
e=1; e=1; e=1;
busy=P5;      //P5e=0; e=0; e=0;
temp=busy&0x80;
}while(temp!=0);
}
void read_status() reentrant {
uchar busy;
uchar temp;
d_i=0; d_i=0; d_i=0;  //r_w=1; r_w=1; r_w=1;  //do {
P5=0xff;
e=1; e=1; e=1;
busy=P5;      //P5e=0; e=0; e=0;
temp=busy&0x80;
}while(temp!=0);
}

(3) OLED initialization

void init_lcd() {
com=0xc0;       //0wr_command1();
wr_command2();
com=0x3f;       //wr_command1();
wr_command2();
}
void init_lcd() {
com=0xc0;       //0wr_command1();
wr_command2();
com=0x3f;       //wr_command1();
wr_command2();
}

(4) OLED screen-ching

void clear_lcd() {
uchar column1;
uchar page;
for(page=0;page<8;page++) {
com=(0xb8+page); //wr_command1();
wr_command2();
com=0x40;     //0,//1
wr_command1();
wr_command2();
for(column1=0;column1<64;column1++) {
//dat=0;
wr_data1();
}
for(column1=64;column1<128;column1++) {
//dat=0;
wr_data2();
}
}
}
void clear_lcd() {
uchar column1;
uchar page;
for(page=0;page<8;page++) {
com=(0xb8+page); //wr_command1();
wr_command2();
com=0x40;     //0,//1
wr_command1();
wr_command2();
for(column1=0;column1<64;column1++) {
//dat=0;
wr_data1();
}
for(column1=64;column1<128;column1++) {
//dat=0;
wr_data2();
}
}
}
void clear_lcd() {
uchar column1;
uchar page;
for(page=0;page<8;page++) {
com=(0xb8+page); //wr_command1();
wr_command2();
com=0x40;     //0,//1
wr_command1();
wr_command2();
for(column1=0;column1<64;column1++) {
//dat=0;
wr_data1();
}
for(column1=64;column1<128;column1++) {
//dat=0;
wr_data2();
}
}
}

(5) shows that 16 × 8 characters of the procedure

void lcd_write_char_code(uchar page8,uchar column8,uchar* block168) reentrant {
uchar column1;
set_position(page8,column8);//for(column1=0;column1<8;column1++) {
dat=block168[column1];
//8×8dat=UpsetChar[dat];
//if(column8<=7)
//,//wr_data1();
else
//,//wr_data2();
}
page8++;
set_position(page8,column8);//for(column1=8;column1<16;column1++) {
dat=block168[column1];
//8×8dat=UpsetChar[dat];
//if(column8<=7)
//,//wr_data1();
else
//,wr_data2();
}
}
void lcd_write_char_code(uchar page8,uchar column8,uchar* block168) reentrant {
uchar column1;
set_position(page8,column8);//for(column1=0;column1<8;column1++) {
dat=block168[column1];
//8×8dat=UpsetChar[dat];
//if(column8<=7)
//,//wr_data1();
else
//,//wr_data2();
}
page8++;
set_position(page8,column8);//for(column1=8;column1<16;column1++) {
dat=block168[column1];
//8×8dat=UpsetChar[dat];
//if(column8<=7)
//,//wr_data1();
else
//,wr_data2();
}
}
void lcd_write_char_code(uchar page8,uchar column8,uchar* block168) reentrant {
uchar column1;
set_position(page8,column8);//for(column1=0;column1<8;column1++) {
dat=block168[column1];
//8×8dat=UpsetChar[dat];
//if(column8<=7)
//,//wr_data1();
else
//,//wr_data2();
}
page8++;
set_position(page8,column8);//for(column1=8;column1<16;column1++) {
dat=block168[column1];
//8×8dat=UpsetChar[dat];
//if(column8<=7)
//,//wr_data1();
else
//,wr_data2();
}
}
void lcd_write_char_code(uchar page8,uchar column8,uchar* block168) reentrant {
uchar column1;
set_position(page8,column8);//for(column1=0;column1<8;column1++) {
dat=block168[column1];
//8×8dat=UpsetChar[dat];
//if(column8<=7)
//,//wr_data1();
else
//,//wr_data2();
}
page8++;
set_position(page8,column8);//for(column1=8;column1<16;column1++) {
dat=block168[column1];
//8×8dat=UpsetChar[dat];
//if(column8<=7)
//,//wr_data1();
else
//,wr_data2();
}
}
void lcd_write_char_code(uchar page8,uchar column8,uchar* block168) reentrant {
uchar column1;
set_position(page8,column8);//for(column1=0;column1<8;column1++) {
dat=block168[column1];
//8×8dat=UpsetChar[dat];
//if(column8<=7)
//,//wr_data1();
else
//,//wr_data2();
}
page8++;
set_position(page8,column8);//for(column1=8;column1<16;column1++) {
dat=block168[column1];
//8×8dat=UpsetChar[dat];
//if(column8<=7)
//,//wr_data1();
else
//,wr_data2();
}
}
void lcd_write_char_code(uchar page8,uchar column8,uchar* block168) reentrant {
uchar column1;
set_position(page8,column8);//for(column1=0;column1<8;column1++) {
dat=block168[column1];
//8×8dat=UpsetChar[dat];
//if(column8<=7)
//,//wr_data1();
else
//,//wr_data2();
}
page8++;
set_position(page8,column8);//for(column1=8;column1<16;column1++) {
dat=block168[column1];
//8×8dat=UpsetChar[dat];
//if(column8<=7)
//,//wr_data1();
else
//,wr_data2();
}
}

5 Conclusion

OLED display technology has broad application prospects. The use of this technology VGS12864E display module MCU interface with convenient display strong and programming simple, the value of a wide range of applications. Described above, interface design and software programming has been successfully applied to data acquisition system parameters of the system showed good results; again with significant anti-button control, parameter settings, such as flip, the establishment of a good man-machine interface .


Optical Electronics and Display Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.