Implementation of OLED display application system design based on ARM7 microprocessor LPC2138

Publisher:石头12345Latest update time:2023-02-09 Source: elecfans Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

With its powerful functions, extremely low power consumption, and smaller packages, ARM processors are widely used in small systems such as access control, wireless meter reading, and intelligent temperature control. In these systems, the human-computer interaction interface is generally completed by LCD, but Usually LCD has defects in display brightness, environmental adaptability, etc., so more and more new technologies and new products are gradually emerging, OLED is one of them. This article introduces the structural principle of an OLED-based display VGS12864E, and gives its hardware connection and specific program design in the ARM7 microprocessor LPC2138 system application.


System brief description

Introduction to LPC2138

LPC2138 is a microcontroller based on the 32/16-bit ARM7TDMI-S CPU that supports real-time simulation and embedded tracking, with 512 KB high-speed Flash and 32KB SRAM. A 128-bit wide memory interface and a unique acceleration architecture enable 32-bit code to run at maximum clock rates. Applications that have strict control over code size can use 16-bit Thumb mode to reduce code size by more than 30% with minimal performance loss.


LPC2138 contains 2 32-bit timers, 2 10-bit 8-way ADCs, 10-bit DAC, PWM channels and 47 GPIOs as well as up to 9 edge or level-triggered external interrupts. It also has multiple serial ports, including 2 16C550 industry standard UARTs, 2 high-speed I 2 C interfaces (400kbit/s), SPITM and SSP (with buffering function, variable data length).


The smaller package and extremely low power consumption make the LPC2138 ideal for use in small systems such as industrial control and medical, such as access control and POS machines, communication gateways, protocol converters, soft modems, voice recognition and low-end imaging, etc. wait.


VGS12864E structural principle

VGS12864E is a 128 columns It has superior characteristics such as high brightness, high contrast, wide viewing angle, low driving voltage and high luminous efficiency, and can also be used in a wide temperature range (storage temperature: ?30℃ to 80℃, operating temperature: ?20℃ to 70℃) Adapt to harsher environments.


VGS12864E uses two column driver controllers to drive columns 1-64 and 65-128 respectively and a row driver with 64 rows of output. It has a built-in 64×64 display data RAM. Each bit of data in the RAM corresponds to one point on the screen. Light and dark, its structure is shown in Figure 1: It divides a half screen into eight pages by rows, because the data of each byte is arranged in a structure with the low bit (LSB) on top and the high bit (MSB) on the bottom, so When extracting the font library, you need to set the font mode to: vertical modulus, byte reverse order.


System hardware structure

VGS12864E has a total of 20 pins, and its functions are defined in Table 2. Its connection with LPC2138 is shown in Figure 2. Although the I/O port of LPC2138 can withstand an input voltage of 5V, the high-level voltage it outputs cannot drive the VGS12864, so a level conversion chip needs to be added between them. The level conversion of this system uses the IDT74FCT164245T chip, which is a 16-bit 3.3V to 5V bidirectional conversion port based on high-speed CMOS technology (the P1.28 port is responsible for the control of the data direction).

programming

Various operations on VGS12864E are completed through its command system, and various operations are completed through the high and low levels of the control pins and the data of the data port. When displaying, it is generally necessary to set the column address and page address, then perform corresponding read and write operations (the "busy" status must be read before the write operation), and finally perform the corresponding loop as needed. Within the same page, the column address is automatically incremented by one after performing read and write operations.

The program in this article has the following macro definitions:

#define uint32 unsigned int

#define uint16 unsigned short

#define uchar unsigned char

#define DIS_DIR 1 Read "busy" status subroutine

Before performing various write operations on VGS12864E, a read "busy" operation needs to be performed to prevent incorrect execution of the "write" operation in the "busy" state. The program code is as follows:

void read_status()

{uchar busy;

uchar temp;

IOCLR0 = DIS_DI; //Select the "instruction" register

IOSET0 = DIS_RW; //Select "read" operation

IOCLR1 = DIS_DIR; //Control the level conversion direction

do

{ IOPIN0 = (IOPIN0 & 0xFFFFFF00) | 0xff;

IOSET0 = DIS_E;

busy=(IOPIN0 & 0xff);

IOCLR0 = DIS_E; //Enable operation

temp=busy & 0x80;

}while(temp!=0); //If busy, continue looping

IOSET1 = DIS_DIR; //Control the level conversion direction

}

Write instruction subroutine

// For the left half screen write command operation, the right half screen operation only needs to change the chip select level (DIS_CS1, DIS_CS2)

void wr_command1()

{

IOCLR1 = DIS_CS1; //Select the left half of the screen

IOSET0 = DIS_CS2;

read_status(); //Read "busy" status

IOSET0 = DIS_DI; //Select the "write" operation

IOCLR0 = DIS_RW; //Select the "instruction" register

IOPIN0 = (IOPIN0 & 0xFFFFFF00) | com; //Send command

IOSET0 = DIS_E; //Enable operation

IOCLR0 = DIS_E;

}

Write data subroutine

//For the left half screen data writing operation, the right half screen operation only needs to change the chip select level (DIS_CS1, DIS_CS2)

void wr_data1()

{

IOCLR1 = DIS_CS1; //Select the left half of the screen

IOSET0 = DIS_CS2;

read_status(); //Read "busy" status

IOSET0 = DIS_DI; //Select the "write" operation

IOCLR0 = DIS_RW; //Select the "data" register

IOPIN0 = (IOPIN0 & 0xFFFFFF00) | dat;//Send data

IOSET0 = DIS_E; //Enable operation

IOCLR0 = DIS_E;

}

Other subroutines

//OLED initialization subroutine

void init_OLED()

{

com =0xc0; //The "0" line starts to display

wr_command1();

wr_command2();

com =0x3f; //Turn on OLED display

wr_command1();

wr_command2();

}

//Clear screen program

void clear_prog(void)

{

for(i=0;idat=0x00;

wr_data1();//Write RAM to 0, thus completing the screen clearing

}

}

}

//Standard function for displaying Chinese characters: Divide the screen into four rows 0, 1, 2, and 3 and 64 columns to display Chinese characters. Each Chinese character occupies two // rows. The font data is transferred through pointers.

void display(uchar hang,uchar lie,uchar *p_dis_data)

{

for(page=hang;page}


Conclusion

VGS12864E is easy to use and can adapt to harsh environments compared to LCD, so it is widely used in industrial control, military and other aspects. Since the interface needs to be designed through font template software, it not only enhances the design flexibility but also increases the difficulty of designing complex interfaces, and generating a font library requires a large amount of storage space. The LPC2138 is a microcontroller based on the ARM7 core. Together with the VGS12864E, it can form a very versatile small display control system.


Reference address:Implementation of OLED display application system design based on ARM7 microprocessor LPC2138

Previous article:Design of intelligent power distribution bear based on microcontroller LPC2132 chip
Next article:Online upgrade solution based on ARM7 chip LPC2132

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号