μC/GUI Design Based on Embedded Processor S3C44B0X

Publisher:daasddlaLatest update time:2012-03-23 Source: 微计算机信息 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Introduction

无忧电子开发网 http://www.51kaifa.com B0X is a cost-effective microprocessor launched by Samsung for embedded systems. It is a 16/32-bit RISC processor based on the ARM7TDMI core and has a main operating frequency of 66MHz. Human-machine interface (GUI) is an indispensable and important component of modern intelligent electronic devices. In recent years, with the continuous progress of hardware development, embedded μC/GUI has played an important role in intelligent instruments and industrial fields [1-3]. This paper discusses a μC/GUI transplantation method based on the embedded microprocessor S3C44B0X produced by Samsung. This design method has the advantages of low resource consumption, high performance, strong reliability, and easy transplantation.

2. Universal embedded graphics module μC/GUI

μC/GUI is a general-purpose embedded user graphical interface software developed by Micrium. It provides an effective graphical user interface independent of the processor and LCD controller for any application using a graphic LCD. It can be used in a single-task environment or a multi-task environment. μC/GUI can be applied to any physical display or analog display of any size of any LCD controller and CPU. It has a driver interface layer and an application layer. All codes are written in ANSI _C. Source code is provided and can be easily ported to various platforms.

2.1 μC/GUI Features

The main features of μC/GUI include: applicable to any 8-bit/16-bit/32-bit CPU, and can be used with any compiler that supports ANSI C; applicable to any controller driving any LCD (monochrome, grayscale, or color); by configuring macros, it can support any interface; configurable display size; characters and bitmaps can be displayed at any point on the LCD; an optimization process is provided for display size and speed, and the compilation time depends on the optimization process adopted; it supports virtual display, and the size of the virtual display is larger than the actual display.

2.2 μC/GUI Data Structure

μC/GUI uses its window as the basic unit of memory management, and the management of all windows is achieved by defining a heap structure. When each window is created, a continuous memory block of a specific size is allocated to it in the heap space according to its structure type, and is identified by an element in a block structure array. The definition of the block structure is as follows:

typedef struct

{

tALLOCINT Off; /*The location where the block starts in the heap*/

tALLOCINT Size; /*Size of the continuous memory block in the heap*/

HANDLE Next; /*Point to the next window pointer*/

HANDLE Prev; /*Pointer to the previous window*/

}tBlock;

static tBlock aBlock [GUI_MAXBLOCKS];

The serial number of the allocated block structure array element in the array is used as the return value to identify a window, that is, the handle. In this way, for a window, the window type structure variable that records its various attributes is placed in the heap space and has a block flag corresponding to it. In the whole process, a global structure variable GUI_Alloc is defined to store related allocation information to achieve auxiliary management of memory.

2.3 μC/GUI Working Mechanism

wuyou dianzi kaifa wang

μC/GUI relies on message mechanisms and destruction functions to create, display, and delete windows. Dozens of message macros for various basic operations are defined in μC/GUI. The operation of a window is basically completed by sending message parameters to its corresponding callback function. During the entire working process, μC/GUI uses a global structure variable GUI_Context, the so-called context variable, to record information closely related to the current operation, including drawing properties, current window information, current API list, font information, etc., to manage the entire workflow.

3. S3C44B0X microprocessor

Samsung's 16/32-bit RISC processor S3C44B0X provides a cost-effective and high-performance microcontroller solution for handheld devices and general applications. Its main frequency can reach 66MHz, and its peripherals and interface expansion are rich, which greatly reduces the development cost of embedded systems.

3.1 S3C44B0X built-in LCD controller

The S3C44B0X built-in LCD controller can support black and white LCDs with specifications of 2 bits per pixel (4 gray levels) or 4 bits per pixel (16 gray levels). It can also support color LCD screens with 8 bits per pixel (256 colors). Its internal structure block diagram is shown in Figure 1.

Figure 1 LCD internal controller block diagram

3.2 Establishing GUI hardware platform based on S3C44B0X

S3C44B0X has two operating modes: one is with an operating system, and the other is without an operating system. For the operating mode without an operating system, the system initialization and main program are run in the 2MB linear FALSH, which is connected to Bank0 of S3C44B0X. After power-on reset, the system automatically starts running from the address 0x00000000, or the program can be loaded to a specified address to start running. This article adopts the operating mode without a system, and loads the initialization program and the main program into the 2MFLASH with the first address of 0x0c008000 for running.

The development board based on S3C44B0X used by the author and the LCD-related parts mainly integrate the following devices: 2MB of FLASH; 8MB of SDRAM; user-defined logic devices; a Sharp 5.7-inch, 256-color, 320×240 resolution LCD; and an ARM JTAG interface.

Its functional block diagram is shown in Figure 2.

Figure 2 Block diagram of the relevant parts of the development board [page]

In the hardware platform, S3C44B0X allocates a dedicated DMA channel for display, which can greatly save CPU resources and make the system faster. In terms of memory, the system allocates a specified size of memory as the real screen display memory. The processor uses a dedicated DMA channel to write the data in the memory to the LCD display buffer at the specified refresh rate to realize the LCD graphical interface display.

4. Porting μC/GUI on S3C44B0X

4.1 Migration steps

The general transplantation process can be divided into the following steps:

(1) Customize the μC/GUI you need; (2) Specify the address of the hardware device and write the interface driver code; (3) Compile, link, and debug the subroutines; (4) Test, modify, and add the functions you need; (5) Write your own application. Due to space limitations, this article only gives the core steps of the transplantation: writing the interface driver code.

4.2 μC/GUI and input/output device driver interface module design

This article takes the design of LCD driver interface module as an example to introduce the writing of LCD driver in the process of μC/GUI transplantation, so as to finally realize graphic display.

The driver is mainly responsible for LCD initialization. This function completes the configuration of the 44B0X LCD controller, the mapping of the video memory, etc. This article uses the 320×240 color LCD as an example to give the writing of the initialization program. The details are as follows:

void LCD_Init(void)

{int i;

LCD_DisplayOpen(FALSE); // /* Turn off LCD display*/

for(i=0; i<320*240; i++) /* Initialize video memory*/

*(pLCDBuffer256+i) = 0x0;

rPDATD = 0xff;;

rPCOND = 0xaaaa; /* PDATD[7 :0]: initialized to 0xff */

rPUPD = 0x00; /* PCOND[15:0]: Configure as function terminal*/

/* PUPD [7 :0]: Enable the pull-up resistor of the corresponding bit (0 = enable, 1 = disable) */

rLCDCON1 = (0)|(DISMODE<<5)|(WDLY<<8)|(WLH<<10)|(CLKVAL<<12);

/* disable,8B_SNGL_SCAN,WDLY=16clk,WLH=16clk, CLKVAL=10*/

rLCDCON2 = (LINEVAL)|(HOZVAL<<10)|(LINEBLANK<<21);

/* Use color mode, LCDBANK=0xc000000, LCDBASEU=0x0 */

rLCDSADDR1= (MODESEL<<27) | (((U32)pLCDBuffer256>>22)<<21) |
M5D((U32)pLCDBuffer256>>1);

rLCDSADDR2= M5D(((U32)pLCDBuffer256+(LCDWIDTH*LCDHEIGHT))>>1) |
(MVAL<<21);

rLCDSADDR3= PAGEWIDTH | (OFFSIZE<<9);

rREDLUT = 0xfdb97531;

rGREENLUT = 0xfdb97531; /* Set the color values ​​of red, green and blue*/

rBLUELUT = 0xfb73;

rDITHMODE = 0x0;

rDP1_2 = 0xa5a5;

rDP4_7 = 0xba5da65;

rDP3_5 = 0xa5a5f;

rDP2_3 = 0xd6b;

rDP5_7 = 0xeb7b5ed;

rDP3_4 = 0x7dbe;

rDP4_5 = 0x7ebdf;

rDP6_7 = 0x7fdfbfe; /* Enable 8-bit single scan/

rLCDCON1 = (1)|(DISMODE<<5)|(WDLY<<8)|(WLH<<10)|(CLKVAL<<12);

Delay(5000);

LCD_BkLight(TRUE); /* Turn on backlight*/
LCD_DisplayOpen(TRUE); /* Turn on LCD display*/}

After completing the LCD driver as above, set the corresponding interrupt service subroutine (IS), and μC/GUI can run stably on the S3C44B0X hardware platform. [page]

4.3 Modification of μC/GUI Configuration File Parameters

The main modification is to the configuration file LCDConf.h. For the 320×240 color LCD used in this article, the content of LCDConf.h needs to be modified as follows:

#define LCDCONF_H

#define LCD_XSIZE (320) /* LCD horizontal resolution*/

#define LCD_YSIZE (240) /* LCD vertical resolution*/

#define LCD_BITSPERPIXEL (8)

The setting of LCD register constants is not described here. In addition, the hardware platform used in this article is equipped with a 1×4 keyboard, which is connected to the I/O port of S3C44B0X. In the process of porting μC/GUI, the use of the keyboard is mainly to detect the level (0 or 1) of the corresponding I/O port to determine whether the keyboard is pressed or not.

5. GUI User Model Design

With the above μC/GUI transplantation process based on S3C44B0X, users can design GUI according to their own requirements. Figure 3 shows a test GUI designed by the author, which embodies the basic elements and ideas of GUI design.

Figure 3.3 Test user interface diagram

Figure a is a GUI for testing LCD bitmaps and keyboards, including sliding buttons, fixed buttons, and color test bars; Figure b is a commonly used sine wave test chart with a red background and white grid lines and waveforms.

6. Summary

Based on the analysis of μC/GUI principles and functions, the process of transplanting the embedded graphical user interface on the target platform based on S3C44B0X is discussed in detail, and the transplant core program - driver interface program is given. The program has been successfully tested and runs on the hardware platform, and it runs stably and has strong real-time performance.

The author's innovation lies in the integration of μC/GUI's advantages of easy transplantation, convenient and flexible use, powerful functions, and ARM processor's advantages of low power consumption, portability, and high code execution efficiency. The code can be widely used in smart terminals such as smart meters and portable devices with a slight modification, and has good application prospects.

References:

[1] Li Yan, Rong Panxiang. Principles and applications of embedded uClinux system based on S3C44B0X[M]. Beijing: Tsinghua University Press, 2005.

[2] Yang Guangyou, Zhou Guozhu, Zhang Daode, Ding Yi. Graphical interface design of embedded measurement and control instruments [J]. China Instruments and Meters. 2004. (10): 36-39

[3] Jiang Junhui. Embedded system hardware design based on ARM [J]. Microcomputer Information, Vol. 21, No. 7-2, 2005, p. 120.

[4] μC/GUI User Manual[M]. Micrium, 2003.

Reference address:μC/GUI Design Based on Embedded Processor S3C44B0X

Previous article:Design of MPEG-4 Video Transmission System Based on IPP Library
Next article:Design of intelligent traffic signal based on S3C44B0X

Recommended ReadingLatest update time:2024-11-17 00:48

Design of car black box based on S3C44B0X and uClinux operating system
The car black box is a car driving recorder, which is used to record the state of the car while driving. With the successful application of black boxes on airplanes, more and more countries are also using this technology on cars. 1 Overall structure of the system 1.1 Requirements Analysis Accordin
[Microcontroller]
Realization of Audio File Playing Based on Embedded Microprocessor S3C44B0X
S3C44B0X is a cost-effective microprocessor launched by Samsung for embedded systems. It is a 16/32-bit RISC processor based on the ARM7TDMI core and has a main frequency of 66MHz. In order to reduce costs and save product development cycles, S3C44BO0X provides a wealth of built-in components, including: internal SRAM
[Microcontroller]
Realization of Audio File Playing Based on Embedded Microprocessor S3C44B0X
Experience in flash programming of S3C44B0X
Use software flashpgm2.2.4 After the software is installed, a problem occurs. When the software is opened, an error message appears: NT Driver not found: MAC_MOT.SYS Solution: Find the MAC_MOT.SYS file through the path WINDOWS/system32/drivers, and copy the MAC_MOT.SYS file to the directory where flashpgm is insta
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号