Design of Communication Module for Automatic Paving Machine Based on C164 Single Chip Microcomputer

Publisher:CuriousObserverLatest update time:2009-09-16 Source: 电子设计应用 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Introduction

With the continuous development of high-grade highways, the quality requirements for the construction of the road base and subbase of high-grade highways are becoming increasingly stringent. Conventional construction methods are difficult to meet the requirements of surface geometry and flatness. Therefore, it is imperative to use a paver to pave the road base and subbase. However, in highway engineering tasks, the quality requirements are high, the time is tight, and the operating conditions are harsh. It is urgent to improve the operating environment, reduce labor intensity, and improve the automation of the paver. The integration and robotization of engineering machinery are the future development direction of engineering machinery. The integration of electronic technology, computer technology, control technology, communication technology, etc., realizes the automation and intelligence of mechanical products, and opens up a broad space for the development of mechatronics technology. The research and development of this asphalt concrete automatic paver will improve the automation and intelligence level of road paving projects, improve the operating environment and working conditions of road projects, reduce labor intensity, and improve the grade of paver products. It will become a domestically leading and internationally advanced domestic product, which is of great significance to promoting the development of my country's highway transportation industry.

2. Working principle of paver

The paving process of asphalt concrete road is as follows: During operation, the loader quickly transports the mixed high-temperature paving materials from the asphalt concrete mixing plant to the front of the paver and pours the raw materials into the hopper of the paver. Below the hopper are two left and right conveyor belts, which carry the raw materials to the rear of the vehicle body, and the raw materials fall from the conveyor belts. The material distributor is two spiral rods, which rotate to separate the raw materials accumulated in the middle to both sides and basically evenly distribute them on the road surface. At the rear of the vehicle body is the ironing plate, which compacts the raw materials with high pressure and high frequency of the vibrator. After the paver passes by and the raw materials cool down, the road surface is formed.

3. Network topology of communication module

Network topology of communication modules

Figure 1 Network topology of the communication module

The automatic paver system is large and complex. It includes the direction and speed control of the vehicle body, material distribution control, large arm, ironing board, leveling control, engine start and stop control, and measurement, display and fault alarm of various state parameters. In order to improve the reliability of the system, a distributed computer architecture is adopted to achieve centralized management and decentralized functions and risks. All these sub-control systems are completed on different single-chip microcomputers, and the parameter transmission between these subsystems is coordinated by the main interactive machine. Obviously, whether the paver can work normally, reliably and stably under the conditions of a very harsh working environment depends to a large extent on whether each single-chip microcomputer can communicate reliably and stably with the system. According to the requirements of the project, the relationship between various input/output quantities of the human-computer interaction system and the measurement and control system was studied and measured in depth, and the network topology shown in Figure 1 was formulated.

In Figure 1, the main interactive machine communicates with the left interactive machine, the right interactive machine, the vehicle travel measurement and control machine, and the leveling and feeding measurement and control machine using the CAN bus; while the main interactive machine and the mobile phone use RS232C for serial communication.

4. Hardware design of communication template

This system uses Yiheng's 16-bit CMOS microcontroller series C164 as the main controller. Yiheng C164 is a very excellent microcontroller, especially its 16-bit microcontroller, high-performance CPU combined with feature-rich peripherals, can execute 12.5 million instructions per second, and has the following performance characteristics when the CPU clock frequency is 20MHz:

(1) High-performance 16-bit CPU with 4-stage pipeline

80ns minimum instruction cycle time, most instructions only need 1 cycle, that is, two CPU cycles; 16*16 bit multiplication requires 400ns (20 CPU cycles), 32-bit division by 16-bit requires 800ns (40 CPU cycles). Processing capacity reaches 10MIPS.

(2) Integrated on-chip memory

64KB on-chip programmable FLASH; 2KB internal RAM for variable memory pool, system stack and code; 2KB on-chip high-speed RAM for variables, user stack and code; 4KB on-chip data EEPROM for non-volatile variables.

(3) External bus interface

Independent or multiplexed bus configuration; segment assignment and chip select signal generation; 8-bit or 16-bit data bus.

(4) 16 priority interrupt system

Up to 33 interrupt nodes with independent interrupt vectors; 240ns/400ns interrupt latency during internal program execution; fast external interrupts.

(5) Intelligent on-chip peripheral subsystem

8-channel 10-bit A/D converter with programmable conversion time (minimum 7.76us; 5 timers/counters; synchronous/asynchronous serial channels; CAN sensors with 15 message bodies; watchdog timer with programmable time interval; real-time clock; program boot loader for system initialization.

(6) 59 I/O pins

The input mode is tri-state and has bit addressing function.

The hardware circuit of the communication module is shown in Figure 2.

Hardware circuit diagram of communication module

Figure 2 Hardware circuit diagram of the communication module

The communication module has one CANBUS and one RS232C, which can independently perform CAN bus communication and RS232C serial communication. The RS232C communication hardware circuit is composed of the C164 chip asynchronous serial port, optocoupler, MAX232A and transmission line. CAN communication is composed of the C164 chip CAN controller, optocoupler, CAN transceiver PAC82C250 and transmission line.

The interfaces of CAN transceivers PAC82C250 and C164CI are both equipped with photoelectric isolation, and two sets of power supplies are used before and after isolation:

(1) System power supply: +Vs (+5V), Gs;

(2) Machine power supply: +Vm (+5V), Gm.

5. RS232C communication software design

5.1 C164CI asynchronous serial port

The asynchronous serial port ASC0 of C164CI provides a serial communication port with other systems. Its features are: asynchronous serial port with built-in baud rate generator; asynchronous mode, maximum 625Kbaud transmission rate; full-duplex; programmable features (1 or 2 stop bits, 7, 8 or 9 data bits); generation of check or wake-up bits when data is sent; odd or even check bits; error detection, etc.

5.2 Serial Port Communication Programming

The serial port is mainly used for communication between mobile phones and host interactive machines. The implementation of serial communication is mainly through the configuration of the serial port control register to achieve initialization. The following are the steps to achieve this process:

1. Initialize the serial port control register;

2. Define the baud rate;

3. Define interrupts;

4. Define the special functions of the pins;

5. System startup.

The following is the communication program for the serial port:

#include

unsigned int a;

interrupt(0x2B) void S0RINT(void) //Receive interrupt service subroutine

{

a=S0RBUF; //Save the received data

}

void putchar(unsigned char tdata) //Serial sending program

{

while(!S0TBIR){;} //Wait for the send buffer to be cleared

S0TBIR=0; //Reset the transmit buffer interrupt request flag

S0TBUF=tdata; //Load the transmit buffer register

}

void ASC_vInit(void) //Serial communication initialization

{

S0CON=0x8011; //Define control register: SOR=1; SOREM=1; serial mode 1

S0BG=0x0040; //define baud rate 9 600Bd

S0RIC=0x0062; //Define receive interrupt control register

S0TBIC=0x0080; //Define the send buffer control register

P3 |= 0x0400; //Define P3.10 pin as output latch (TXD0)

DP3 |=0x0400; //Define P3.10 direction control (TXD0 is output)

Dp3 &=0xF7FF; //Define P3.11 direction control (RXD0 is input)

IEN=1; //Enable interrupt

}

void main(void)

{

………………;

ASC_vInit(); //Serial port initialization

putchar('…..'); //Serial transmission

………………;

}

[page]

6. CAN bus communication software design

6.1 Overview of C164CI CAN Module

The features of the C164CI CAN module are as follows:

(1) Comply with CAN V2.0B regulations (symbol standards and extended functions).

(2) The maximum CAN communication rate is 1MB/S.

(3) Complete CAN device:

l 15 information bodies with their own identifiers and status control bits;

l Each message body can be defined as sent or received.

(4) Connected to the main CPU (C166-core) via the internal XBUS (16-bit independent mode) of the chip.

(5) Programmable mask register for receive filter:

l Global shielding of input information body (full CAN function);

l Information body 15 has additional shielding (basic CAN function);

l Flexible interrupt event control;

l With two receive buffers;

l Use your own global mask registers for receiving and filtering.

6.2 CAN bus communication software design

The tasks of the CAN bus communication software design for the automatic paver system are: after selecting the communication protocol CAN2.0B, specify the format and convention of data transmission by each computer; coordinate the communication between computers; and uniformly consider the reliability measures in communication.

6.2.1 Data transmission mode

Due to the different importance and transmission period of the data to be transmitted, two different data transmission modes are used in the communication of this system:

(1) Transmission mode 0: It is sent once, without checking whether the reception is correct, and returns after the transmission is completed. After receiving this type of data packet, the receiver does not need to send a response packet. The characteristics of this data packet are: it is sent regularly according to a certain period and is used for the status display on the main operation panel, so occasional transmission failure will not affect the normal operation and operation of the system.

(2) Sending mode 1: The data packet must be sent correctly to the receiver. A resend mechanism is used to wait for the receiver to respond. If no response is received, the data packet is resent. If the five transmissions fail, FALSE is returned, and the sender takes corresponding processing actions, such as alarming or shutting down. TRUE is returned if the data packet succeeds. The characteristics of this data packet are: it is sent by the corresponding event. If the transmission fails, the normal operation of the system will be affected.

6.2.2 Data transmission mode

For the automatic paving machine system, the number of nodes in its CAN network is relatively small, and each data packet only needs to be received by a part of the nodes. Therefore, the data frame identifier is used in the communication design to implement address multicast. In order to avoid receiving unnecessary data packets, the receiving nodes are bit-addressed, and each node corresponds to a bit in the acceptance filter. If the corresponding bit in the high 8 bits of a message identifier is 1, it is received; otherwise it is ignored. Therefore, as long as the sending node sets the appropriate message identifier according to the content of the data packet, the data packet can be correctly received by the relevant nodes and ignored by irrelevant nodes.

6.2.3 Verification

Cyclic redundancy code (CRC) check has been implemented in the MAC layer of the CAN structure. However, the working environment of the automatic paver is harsh and the working conditions are complex. In order to ensure the reliability of system communication, the control program level communication is also checked. In order to reduce the system burden and program complexity, the control program level check adopts a relatively simple sum modulo check method. The last data byte of each data frame is used as the checksum, and its value is the value of the sum of all previous data bytes modulo 256. The checksum is calculated in the same way in the receiving interface of each node. If the check is correct, the data packet is pushed into the receiving queue, otherwise the packet is discarded.

6.2.4 Data Packet Format and Content

Packet format and content

Among them: L value is 2-8: CAN2.0B standard is adopted, using 29-bit identifier.

ID28—ID21: Determine the receiving node of this frame. Each bit represents 1 node and can be broadcast.

ID20-ID17: The sequence number of this frame, which increases by 1 for each frame sent. It is used to distinguish different data frames and retransmitted data frames.

IDl6: Response flag: 1 indicates that this frame requires a response, and 0 indicates that this frame does not require a response.

IDl5-IDl3: specifies the sending node of this frame, 0-3 represent the left interactive machine, right interactive machine, vehicle body travel measurement and control machine and leveling and feeding measurement and control machine respectively.

ID12—ID0: meaningless.

6.3 CAN bus communication programming

CAN bus communication programming is a rather tedious task, mainly involving many CAN registers, but as long as you master its rules and technical key points, it will become easy. The following are the implementation steps of CAN bus communication programming:

(1) CAN module initialization;

(2) define each information body;

(3) Loading message body data (only for sending message body);

(4) receiving information body to receive data;

(5) Send a message body;

(6) Checking a body of information;

(7) Check whether the CAN bus is turned off.

To facilitate modular programming, the CAN communication functions are encapsulated into subroutines and a dedicated program library is generated for different programmers to call, which improves programming efficiency and facilitates function expansion. Two of the subroutines are given below.

The following is the CAN communication program for sending a message body:

#include //C164 register definition

#include //CAN control register definition

void send_mo_16x(unsigned char a) //Send message body "a" (1..14)

{

if((a<15)&&(a))*msgctrl_ptr_16x[a]=0xefff; //Set TXRQ

}

The following is the CAN communication program to check whether the CAN bus is closed:

#include //CAN control register definition

unsigned char check_busoff_16x(void) // Check if the bus is off and restore if necessary

{

unsigned char busoff_var=0;

if(SR&0x80) //If BOFF=1

{

busoff_var=1;

CR=CR&0xfe; //Restore the closed bus (clear INIT)

}

}

7. Conclusion

Since the paver has many functions, complex operations, and a very harsh working environment, the reliability of the control system is the key to the design of the automatic paver. In this system, RS232C is used to realize the serial communication between the main interactive machine and the mobile phone; a single-chip microcomputer with a CAN bus is used to complete the functions of different modules, and data or commands are transmitted through the CAN bus, realizing the decentralized functions and centralized monitoring, and the dispersion of dangers. Therefore, it is very suitable for the realization of a distributed control system in an automatic paver. The results of the field experiment show that the communication module has good reliability, stability and security.

Reference address:Design of Communication Module for Automatic Paving Machine Based on C164 Single Chip Microcomputer

Previous article:Development of Ultrasonic Reversing Distance Meter Based on Temperature Compensation
Next article:Highly sensitive vehicle detection algorithm based on C8051F310

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号