Design and implementation of DC motor monitoring interface based on ARM/DSP embedded system of QT/E

Publisher:平和宽容Latest update time:2011-08-05 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Abstract: Design a DC motor control system in the master-slave control mode of embedded microprocessor ARM&DSP, focusing on the DC motor monitoring system interface designed based on QT/Embedded, including serial communication and motor control. Build a development environment based on embedded operating system Linux, use C++ language to develop application program interface, and realize data communication between master and slave controllers according to the application layer protocol based on serial port. And complete the transplantation of Linux operating system, and realize human-computer interaction through touch screen.
Keywords: S3C2440; TMS320F2812 : Linux; QT/Embedded; DC motor; graphical user interface 0 Introduction Embedded technology is widely used in the field of robot control. It concentrates the latest scientific research results of multiple disciplines such as mechanical engineering, automatic control and artificial intelligence, and has become the focus and center of current scientific and technological research and application. One of the key problems that need to be solved in robot control system is motor control technology. This topic is based on the hardware platform of the master-slave control mode of the embedded system processor ARM&DSP. Using the Linux operating system, the control of the DC motor is studied and an application development based on QT is designed to provide users with an operation interface in a graphical way to achieve a more intuitive state display and flexible control of the motor. 1 Overall design of the control system The main controller of this system is composed of a Samsung S3C2440 embedded development board based on a 32-bit ARM. 920T RISC processor. It runs an embedded Linux operating system inside and is mainly responsible for the control of the system and the communication with the slave controller DSP. The main controller realizes data communication with the slave controller through the serial communication interface (UART), including sending control instructions in a specific data format and receiving sensor data returned by the DSP controller. The Linux operating system is used to build a platform and develop a QT-based graphical interface. The human-machine interface is realized through the touch screen to complete the control of the motor and the sensor and the display of the sensor data. The slave controller uses a 32-bit fixed-point controller TMS320F2812, which mainly completes the control of the motor and feeds back the current motion state to the main controller ARM9. The overall structural design block diagram of the control system is shown in Figure 1.






d.JPG



2 Serial Communication Design
In this system, the communication between the master controller ARM9 and the slave controller TMS320F2812 uses a serial communication interface, namely the UART port. The SCI module of TMS320F2812 uses interrupts for control. Its reception and transmission are double buffered, and the two can work independently in full-duplex mode. The serial port uses two I/O pins SCITXD and SCIKXD that can be reused and have priority to send and receive data respectively. The RS-232 and the TTL level in the DSP need to be equipped with a driver and isolation circuit to form a simple communication interface. The driver chip MAX3232 that complies with the RS-232 standard is used for serial communication between ARM9 and DSP. The MAX3232 chip has low power consumption, high integration, and two receiving and transmitting channels. The TMS320F2812 serial interface circuit is shown in Figure 2.

e.JPG


When the serial communication interface of TMS320F2812 is working, its functions can be realized through software programming. After receiving data, the direction and speed of the motor are controlled through the general timer, PWM unit and capture unit in the event manager module.

3 Design of QT Graphical Interface
3.1 QT/Embedded
Most embedded systems need to communicate with people, and have formed human-machine interface products based on graphical display and touch screen control, with fully customized software and hardware. QT/Embedded is a cross-platform application and UI development framework that supports rich graphical controls and provides beautiful interface development, fully meeting the interface display requirements of human-machine interaction products. The implementation structure diagram of QT/Embedded is shown in Figure 3.

f.JPG


QT applications are developed in C++. QT's API is divided into three parts: controls, frameworks, and tools. Its efficient performance is inseparable from its signal and slot mechanism. The QT/Embedded development process is shown in Figure 4.

g.JPG


Establish the QT development environment on the host machine, install cross-compilation tools, including compilers, linkers, library functions, etc. The application runs on the host machine, and the generated target code is for a specific hardware platform. And using QtCreator's cross-platform Qt integrated development environment helps improve development efficiency. The development of QT applications is transplanted to the target board after debugging on the host machine.
3.2 Serial communication interface
The serial communication interface provides serial port property settings, serial port data communication interface functions, and motor status information fed back to ARM9 by DSP. The serial communication interface is shown in Figure 5. Click the 'Edit Parameter' button in the interface to configure various serial port parameters. After configuring the parameters correctly, click the 'Connect' button to connect the serial port and prepare for communication. The motor status can be obtained by clicking 'Receive'. The 'Motor' menu can open the motor control interface, and its control is also transmitted through the effective serial port.

a.JPG

When designing the serial port configuration interface, first define the structure serial config, as follows:

h.JPG


After setting the serial port parameters, click 'Connet' to send the QPushButton signal clicked() to call the custom slot function setup_serial() to read the parameters in the QT control and configure the corresponding serial port according to the parameters. The member function currentText() of the control portNameComboBox obtains the set serial port number, reads the serial port name, and assigns it to the property serial.dev. The code segment for setting the serial port name is as follows:

i.JPG

Similarly, read other corresponding parameters of serial communication. Next, you need to open the serial port. The code segment is as follows:

j.JPG


Among them, the open function is used to open the serial port and obtain the file descriptor fd_serial of the serial port device file.
In the slot function setup_serial(), after completing the parameter reading and opening the serial port operation, the baud rate is set by calling the custom sub-function set baudrate(int), while the sub-function set Parms(int) is used to set other parameters. The termios data structure for Linux serial port communication is mainly used to configure the serial port. Since the serial port is used to read or control the motor, waiting is not allowed, so for any serial port opened, it needs to be set to non-blocking working mode. In the program, fcntl(fd serial, F_SETFL, O_NONBLOCK) is used to set the buffer that defaults to blocking read under Linux to non-blocking read.

When designing the motor status reading part, the structure motor_status is first defined:

k.JPG


When the motor is in normal working state, click 'Receive' on the interface, and the custom slot function receive data() will respond to read the motor status. The format of the data packet fed back by the DSP to ARM9 is shown in Table 1. The data format size is a 16-bit char array. In the slot function, use the read(fd_serial, buff16) function to read the 16-bit data with motor status information through the serial port and assign it to the array buff[].


Pass each field of the character array buff[] to the corresponding motor_status attribute, and send custom signals respectively. The QLabel control used to display the motor status is a subclass of QWidget, and its slot function setText(QString) receives the signal and displays it. For example, the process of displaying the motor speed status is: emit the custom signal speed_changed(QString), trigger the slot function setText(OString) of the QL-abel type control label_DiskSpced_value, and display the current motor speed on the interface. The statement connecting the signal and the slot function is connect(this,SIGNAL(speed_changed(Qstring)), ui->label DiskSpeed ​​value, SLOT(setText(QString)), which realizes the data display of the motor speed.

3.3 Motor control interface
The motor control interface provides the configuration of motor control instructions. The motor control interface is shown in Figure 6 below.

b.JPG


Click the 'Edit' button to edit the parameters, then click 'Send' to make them effective through the serial port transmission.
First, define the motor parameter structure motor config:

m.JPG


After clicking 'Send', the signal clicked() of the QPushButton control is sent, which triggers the custom slot function send_data() to pass the control command to the DSP through the serial port. Define the data format of the motor control received by the DSP, as shown in Table 2, and a 13-bit char array is required to store the motor control information. In the slot function send_data(), the value is assigned to
the char buff[] array according to the format, and then the data is written to the serial port through the function write(fd_serial, buff, sizeof(buff)).

n.JPG


3.4 Experimental results
The simulation of the QT application under Linux on the PC is completed, and the binary executable file executed on the development board is compiled. The final running effect on the embedded ARM board is shown in Figure 7, which realizes the serial communication between ARM and DSP and the monitoring of the motor.

c.JPG



4 Conclusion
The GUI application based on QT/Embedded runs on the embedded operating system Linux, which is efficient and stable. The UI design provides a good user experience and meets the interface display requirements of embedded devices. This project uses the technical solution of ARM&DSP+Linux+QT/Embedded to design and implement the motor control interface, showing the feasibility of high-performance embedded processors, intelligent embedded operating systems, and graphical applications in embedded product applications.

Reference address:Design and implementation of DC motor monitoring interface based on ARM/DSP embedded system of QT/E

Previous article:Design and implementation of an embedded system upgrade
Next article:Implementation and Application of MODBUS Protocol Based on ARM Cortex-M3

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号