Interface and Programming between Microprocessor Rabbit2000 and LCD Controller KS0108B

Publisher:创新驿站Latest update time:2012-04-22 Source: 21ic Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Introduction

LCD has the characteristics of displaying a lot of information, small size, low power consumption, etc., and is widely used in terminal display and human-machine interface. It can be used with the high-performance RabbitCoreRCM2200 module to form an advanced intelligent instrument. In the Bluetooth wireless data receiving and sending system we developed, the display of Bluetooth device link information and data sending and receiving and other related information plays a very important role. This article introduces the practical interface circuit and software design of RabbitCoreRCM2200 module and M12864-7A7.

2 Introduction to Rabbit2000 and RabbitCoreRCM2200

The Rabbit2000 8-bit microprocessor has a similar structure and high compatibility with the Z80 series microprocessor, but its performance has been greatly improved. It has 4 serial ports, 40 general-purpose I/O pins, built-in calendar, clock, watchdog, timer, multi-level interrupt, dual DMA channels, and can expand 4MB~8MB Flash for data storage. For microprocessors with 8-bit buses, Rabbit has constructed most of its external 8-bit buses and has a concise instruction set. Its performance is the same as many 16-bit processors and can perform 16-bit operations. Rabbit2000 uses an interface cable to connect the PC serial port and the target system based on Rabbit2000 to realize software development. It is supported by the DynamicC compiler, which has an interactive compiler, editor and debugger. Assembly language code can be embedded in DynamicC code or used as an independent function. Compilation and debugging can be implemented without leaving the DynamicC development environment, shortening development time and making programming easier.

The RabbitCoreRCM2200 module uses a Rabbit2000 microprocessor, has 256KB Flash and 128KB SRAM, 4 serial ports, 26 I/O ports, and a 10Base-T Ethernet port. The RCM2200 can be used to control, monitor, and debug embedded systems through a network or the Internet. There is a software toolkit that supports the RCM2200, providing TCP/IP protocol and DynamicC system software.

3KS0108B LCD controller

KS0108B LCD controller is mostly used for small and medium-sized module graphic dot matrix LCD (Hitachi HD61202 is fully compatible with it and can be directly replaced). Its feature is that it has a built-in 64-bit × 64-bit display memory. The display state of each pixel on the display screen corresponds to each bit of data in the display memory. The data in the display memory is directly used as the driving signal for graphic display. When the display data is "1", the corresponding pixel is displayed, and when it is "0", the corresponding pixel is not displayed. KS0108B needs to be matched with the corresponding row driver KS0107B with oscillator and display timing engine to form a complete LCD drive and control system. The instructions and functions of KS0108B are shown in Table 1.

Block diagram and pinout of 4M12864-7A7 LCD module

The M12864-7A7 LCD module uses two KS0108B as column drivers and one KS0107B as row driver. KS0107B is not connected to the MCU and can generate row drive signals and various synchronization signals as long as power is provided. Figure 1 is the structure of the LCD module; block diagram, pin functions are shown in Table 2.

5Hardware interface circuit

There are two ways to connect the built-in KS0108B graphic dot matrix LCD module to MCU (single-chip microcomputer or Rabbit2000, etc.): direct access and indirect control. The direct access method is to directly hang the interface of the LCD module as a memory or I/O device on the MCU bus, and the MCU operates the work of the LCD module by accessing the memory or I/O device. The indirect control method is that the MCU connects to the LCD module through the parallel interface in itself or the system. The application given below uses the PA port and some pins in the PB, PD, and PE ports of the parallel port of RCM2200. The MCU controls the LCD module by operating these interfaces.

In the circuit shown in Figure 2, the PA port of RCM2200 is used as the data port, PB7 is RET, PD3 is D/I, PD4 is R/W, PD5 is E, PE5 is CS1 and PE7 is CS2. V0 is the negative voltage required by the LCD, and the voltage can be adjusted by the potentiometer connected to it. The voltage range is -10V~0V to achieve the purpose of adjusting the display contrast.

6DynamicC source code

6.1 Program Description

This article focuses on the subroutine for displaying Chinese characters, which can display specified Chinese characters at specified locations.

Given below are some subroutines of the indirect control method shown in Figure 2. All programs are compiled and debugged using the DynamicC7.32TSE version compiler.

The M12864-7A7 LCD module is 128×64 dot matrix, each Chinese character is 16×16 dot matrix, so each line can display 8 Chinese characters, one screen can display 4 lines. The whole screen can display up to 32 Chinese characters.

The parameters pag and col in the function represent the page address (X address) and Y address, and *hzk is a pointer to the dot matrix of the Chinese characters to be displayed. Among them, 0<=pag<=7, col is any value of 0, 16, 32 or 48; the position of the Chinese characters to be displayed can be determined by pag and col. From Table 1, we can know that the starting value of the page address (X address) is Oxb8 (defined as Page_Add in the program), and it takes two pages to display a Chinese character at the same time, so the calculation formula of the page address is Page_Add+pag+j, 0≤j≤l; and the starting value of the Y address is 0x40 (defined as Col_Add in the program), and it takes 16 columns to display each Chinese character, so the formula for calculating the Y address is Col_Add+col. The Y address calculator has an automatic addition function, which automatically adds 1 after each read/write data, so when reading/writing data continuously, it is not necessary to set the Y address counter every time.

At the beginning of the program, the LCD initialization subroutine must be called first, then the screen is cleared, and then the LCD display is turned to the left or right screen depending on whether the Chinese characters to be displayed are on the left or right screen. Then, the data is sent to the LCD display until the 32-byte Chinese characters are fully displayed; the display of multiple Chinese characters is operated in the same way.

For the display of multiple information, voidMsg(void) can be changed to voidMsg(flag), that is, different values ​​of flag are used to identify different information to be displayed, and then, in actual use, it can be implemented by calling voidMsg(flaS).

7 Conclusion

The connection between the M12864-7A7 LCD module and the RabbitCoreRCM2200 module adopts indirect control, which is characterized by simple circuits, control timing is implemented by software, and can realize the interface between high-speed MCU and LCD module. The use of DynamicC can easily realize the display function of the LCD module, which requires more complex logic in assembly language, and can shorten the development and debugging time.

Reference address:Interface and Programming between Microprocessor Rabbit2000 and LCD Controller KS0108B

Previous article:Temperature acquisition instrument made of CD4051 and AD595
Next article:Design of a dedicated keyboard interface chip using CPLD

Latest Industrial Control 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号