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.
Previous article:Design of intelligent power distribution bear based on microcontroller LPC2132 chip
Next article:Online upgrade solution based on ARM7 chip LPC2132
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Detailed explanation of intelligent car body perception system
- How to solve the problem that the servo drive is not enabled
- Why does the servo drive not power on?
- What point should I connect to when the servo is turned on?
- How to turn on the internal enable of Panasonic servo drive?
- What is the rigidity setting of Panasonic servo drive?
- How to change the inertia ratio of Panasonic servo drive
- What is the inertia ratio of the servo motor?
- Is it better for the motor to have a large or small moment of inertia?
- What is the difference between low inertia and high inertia of servo motors?
- 【Share】Choice of flyback chip
- Replace the foreign 2SK2837 field effect tube 500V, 24A model in AC-DC switching power supply!
- Program to control ad7708 with MSP430
- Bluetooth is down: BIAS attacks threaten all mainstream Bluetooth chips
- Will there be conflicts between Wi-Fi and Bluetooth in the same frequency band?
- Analog signal isolation GP9303+GP8101 solution
- Who remembers a video about the principles of network communication?
- [Sipeed LicheeRV 86 Panel Review] 7 - lvgl Solution to the problem of incorrect image color display
- Wireless communication technology-NB-IoT
- SMT32 is no longer available, let's discuss alternative models