Virtual Instruments for Embedded Systems Become a New Idea for Testing Systems

Publisher:平和思绪Latest update time:2009-09-09 Source: EDN China Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Introduction

The development of computer and its interface technology and the shortcomings of traditional test and measurement instrument systems have made computer-based virtual instrument equipment increasingly dominant in test and measurement instruments. Virtual instrument systems have been widely used in industry for their platform versatility, expandability, easy upgrade and high intelligence. Inserting data acquisition boards based on PC bus (ISA, PCI) into PCs and industrial control computers to form hardware systems, and writing Windows system platform drivers and soft panels to implement software functions have become the main solutions in the industry.

However, in the practice of testing tasks in the field and in harsh environments, we found that virtual instruments based on PCs or industrial computers exposed many problems, such as: large size, inconvenient to carry; card-type structure, easy to loosen and not tighten; mechanical hard disk as the main storage medium, poor seismic performance, etc.

The embedded computing platform characterized by 32-bit embedded microprocessors and embedded operating systems has brought computing into the post-PC era. The small size and high reliability of embedded systems can meet the needs of portable virtual instruments in field operations and harsh environments. Based on the embedded computing platform, designing a virtual instrument system has become a new idea for building a test system.

By building an embedded computing platform based on PC104 bus and adding instrument cards and their functional programs, we have realized a variety of test instruments for radar electronic equipment. The technical problems that need to be solved in building virtual instruments based on embedded systems are concentrated in the construction of system platforms, the design of interfaces and drivers, and the design of soft panels.

2 Hardware System Composition

The hardware system includes an embedded mainboard, an instrument function board, a Flash storage medium (DOC or CF card), an LCD screen, a touch screen, and a signal interface, as shown in Figure 1. The LCD screen and the touch screen realize human-computer interaction, the signal interface is used to couple the test signal, the embedded mainboard is used as a control and calculation unit, and the instrument function board realizes the functions of the specific instrument.

The components are stacked in the following order: touch screen, LCD screen, PC104 motherboard, oscilloscope card, multimeter card. The function cards and embedded motherboard are mechanically and electrically interconnected through the PC104 bus in a stacked manner. This approach has the following benefits:

1. Highly tight electrical contact. The circuit boards are deeply connected through multiple rows of pins, which is much tighter than the ISA and PCI slot connections.

2. The mechanical structure is firm. The circuit boards are tightly connected with four studs, making the mechanical connection between the boards very firm and without shaking.

3. The electrical characteristics of the PC104 pins are fully compatible with ISA, and the electrical characteristics of the PC104Plus pins are fully compatible with PCI, so that the functional boards designed based on ISA or PCI bus can be reused from the electrical principle, which is conducive to the smooth transition of the system transformation process.

Abandoning the hard disk and using DOC or CF card as external storage media can also greatly improve the system's ability to resist vibration and impact.

The use of the hardware system described above can provide hardware support for a small and reliable virtual instrument system, but the resulting problems such as small system storage capacity and limited resources have brought difficulties to the design of the software system. An embedded operating system must be used, and software programming must consider small size and high efficiency.

3. Software System Design

We use embedded Linux as the operating system and write the instrument driver under the Linux platform. We use TinyX and GTK+ as the graphical interface solution to implement the instrument soft panel.

3.1. Embedded Linux system

We use an open source Linux system and use the compilation options to cut unnecessary functional modules to obtain a kernel module of about 500K. We use busybox to replace the shell and add libraries such as glibc.o to the system to build a 4M Linux operating system. The literature [1] on building embedded Linux systems has detailed introductions and guidance.

3.2.IO programming under Linux

The driver of the instrument card is implemented by port reading and writing. The operation method of the port under Linux is in usr/include/asm/io.h. Since the port reading and writing functions are some inline macros, when writing the port reading and writing program, you only need to add: #include and do not need to include any additional library files. In addition, due to a limitation of the gcc compiler, when writing a program containing port reading and writing code, either turn on the compiler optimization option (use gcc?O1 or higher options), or add: #defineexternstatic before #include

Before reading or writing a port, you must first obtain the permission to read or write the port through the ioperm() function. The usage of this function is as follows:

ioperm(from,num,turn_on)

If turn_on=1, it means to obtain the read and write permissions of num ports starting from from. For example, ioperm(0x300,5,1) means to obtain the read and write permissions of 5 ports from port 0x300 to 0x304. The last parameter turn_on indicates whether to obtain the read and write permissions (turn_on=1 means to obtain, turn_on=0 means to release). The ioperm() function is usually called during the hardware initialization phase of the program.

The ioperm() function needs to be run as root or the program must be given root privileges using seuid.

The port is read using the inb(port) and inw(port) functions, where inb(port) reads an 8-bit port and inw(port) reads a 16-bit port.

The write operation of 8-bit and 16-bit ports is completed by the functions outb(value,port) and outw(value,port) respectively. The first parameter of each function indicates the value to be written, and the second parameter indicates the port address.

The functions of the macros inb_p(), outb_p(), inw_p() and outw_p() are the same as the corresponding four port read and write functions mentioned above, except that a certain delay is added after the port operation to ensure reliable reading and writing. You can get a delay of about 4 microseconds by adding: #defineREALLY_SLOW_IO before #include.

3.3.Soft panel programming based on TinyX and Gtk+

The design of the instrument soft panel involves the selection and programming of GUI under Linux. Considering the maturity of XWindows and its consistency with the desktop system, we choose the streamlined XWindows system TinyX as the underlying GUI solution. We use the Gtk+1.2 library as the control set to develop the instrument soft panel program.

The graphical interface development solution based on TinyX and Gtk+ library makes the development of soft panel closer to the development based on Gnome in the desktop environment. Many Linux tools in the desktop environment can be used directly.

The Gtk+ graphics library is the underlying foundation of the GNOME desktop system. It contains a relatively complete set of GUI controls (GtkWidgets). Based on the object-oriented approach, GTK+ uses C language to implement a set of object systems and message and callback mechanisms, and integrates the entire graphics control set into the object framework, making it easier to expand the control set.

In response to the application needs in the field of virtual instruments, a control set of common GUI units can be built. We have developed panel controls for instruments such as oscilloscopes and signal sources and some key GUI unit controls in the form of GtkWidgets. These are conducive to users' secondary development and reuse of software units.

4 Conclusion

Based on the embedded motherboard and embedded software environment, we provide a general solution for constructing virtual instruments. At the same time, by building a GUI environment based on TinyX and Gtk+ libraries, plus a series of panel unit controls developed independently, we provide support for the development of virtual instrument soft panels.

Based on the above solution, we have developed a radar fault detector that integrates the functions of an oscilloscope, a multimeter, a microwave signal source and other instruments.

Practice in the military's field combat environment shows that the system has a solid mechanical structure, high reliability, and is easy to carry and use.

Reference address:Virtual Instruments for Embedded Systems Become a New Idea for Testing Systems

Previous article:Design Method of Parametric Array Test System Based on LabVIEW
Next article:Control system of vehicle motor test platform based on virtual instrument

Latest Test Measurement 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号