You are on page 1of 4

2011 International Conference on Electronic & Mechanical Engineering and Information Technology

Multi-motor Control System Design Based on Can Bus

Shanshan Wang 1 '", Bo Yin 1 A b , He Li 1 , Qingshu Yang 1 1.College of Information Science and Engineering, Ocean University of China, Qingdao, China 2. College of Computer Science and Technology, Zhejiang University, Hangzhou, China a. ss8709@126.com; b. yinbofirst@ouc.edu.cn

AbstractIn this paper, a multi-motor control circuit based on controller area network (CAN) bus is presented. The 89C51 microcontroller is the foundation and the circuit which is based on the usage of DAC0832 digital-to-analog converter, in order to achieve the breakdown of motor control. In the subdivision control, subdivision steps are set by software. Article details the overall structure of the system of hardware design, software design process, and CAN bus controller structure. Compared with the traditional centralized control, the multi-motor control system has higher reliability. Experimental result shows that the system and the intelligent control module is effective and efficient. Keywords-CANBUS; DAC0832; controller structure
I. INTRODUCTION

The rest of paper is organized as follows: Section II briefly describes system components, and introduces CAN BUS nodes. In the section, it shows the whole system structure. In section III the article instates the information of Hardware Design. In the Hardware Design, the article consists of four modules, and details the method and function in each module. And in section IV, the article details Software Design. In the Software Design, the article instates the realization of the program in details. Finally, we conclude the paper in Section V.
II. SYSTEM COMPONENTS

The controller area network (CAN) was originally developed by Bosch in the early'80s. In order to solve the vehicle control and measure a large number of data exchange between devices and the development of a serial data communication bus, belonging to the field bus area and it became to be international standards (ISOH898: road vehicles, high-speed digital switching system Controller Area Kong Standard) in 1993. The CAN bus is an effective support for real-time control of distributed control system or the serial communication network, it is a multi-master bus, each node has the right to send information to other nodes at any time, bus conflicts decided by arbitration takes the bus node, implemented in electromagnetic interference environment, a reliable long-range real-time data transmission. CAN bus is a communication protocol is a serial communication protocol. What is the communication protocol? Exchange between devices is to follow the norms; we all carried out in accordance with the norms of exchange, until the mess is not only an orderly exchange to be successful. CAN bus is an abbreviation; the full name should be "Controller Area Network Bus" Controller Area Network is in English the first letter combination. It is a bus, with our common USB bus belongs to a class concept, but CAN bus using differential signal transmission, have a strong ability of error detection, communication distance, was used in some special occasions, such as cars, factories and mines, such as strong local interference. In this paper, we use 89c51 microcontroller, DAC0832 8 bite D /A converter chip consisting of control system in the CAN bus system, to achieve the multiple motor driver.

As all modern communication technologies, CAN-based networks follow the internationally standardized Open Systems Interconnect (OSI) reference model as defined in ISO 7498-1. For CAN technology, this model has been adapted. The CAN reference model comprises the CAN physical layer (layer-1), the CAN data link layer (layer-2), and the CAN application layer (layer-7). Some layer-7 solutions include also network and transport layer functionality. All these communication services and protocols specify just the communication behavior. The application functionality may be described in standardized profile specifications. In order to verify the correctness of implementations standardized conformance test plans are necessary. A manufacturer-independent certification based on these test plans minimizes compatibility problems. System communication network topology consists of bus structure; this structure is characterized by multiple nodes which sharing a transmission line. This is a simple structure, with low cost, passive tap connections and high reliability. The whole system can be divided into two layers. The upper is host computer and CAN adapter card, the lower is consist of the number of on-site control unit, and they all join control system's CAN node, as shown in Fig. 1.

978-l-61284-088-8/ll/$26.00 2011 IEEE

4910

12-14 August, 2011

PO I I CAN CONTROLLED CAN RECEIVER^

circuit. In the next parts, the article will describe the method and functions of each part in details. III. A.
HARDWARE DESIGN

MCU and the Controller Module

CAN RECEIVER^

CAN CONTROLLER^

Figure 1. system structure based on CAN BUS

Concrete realization of the time, CAN bus communication only need two lines, through the two lines can be communication CAN bus has many outstanding features, field processing equipment connected to other means of communication through the CAN bus has unmatched advantages, Specific to this system are: simple structure, communication network can has two cables, greatly reducing the number of wires between processing equipments and complexity of working with multi-master mode, hot-swappable, increasing the flexibility of communication; message is short, having a higher real-time , which can improve the machining accuracy and speed; anti-interference capability, error correction test mechanisms, security can be guaranteed so as to greatly increase processing automation. This paper introduces a CAN bus system structure and uses DAC0832 digital-to-analog converter to analog output digital signal, then directly control motor driver circuit though zoom power by leading into combining can controller, can transceiver, can system bus and can interface circuit with single-chip microcomputer. In the structure of a bus system using SJA1000 chip and two pieces of 6N137 chip, a piece of PCA82C250 chip consist the control circuit. Fig. 2 shows the overall structure.
Motor drive
circuit

In this paper, the single chip 89c51 is used as the central part. This is a flash programmable and erasable read only memory with 4K bytes. 89C51 with ATMEL is an efficient 8-bit micro-controller CPU, it has the following features: On-chip oscillator and clock circuitry; 32 I/O bus; External memory address range of ROM, RAM64K; Two 16-bit timers / counters; five interrupt sources, two priority levels; Full-duplex serial port; Boolean processor. The SJA1000 is a stand-alone CAN controller. It is used in the automotive and general industrial with advanced features. Due to it is compatible with hardware and software, it will replace PCA82C200. SJA1000 has a range of advanced features, and is suitable for a variety of applications, especially in system diagnostics and maintenance optimization. Its features include the following: independent CAN controllers and electrical and pin compatible; the default Basic CAN mode is the PCA82C200 mode; scalable 64-byte FIFO receive buffer; compatible with CAN2.0B protocol; supports both 11-bit and 29-bit identification code; bit rates can reach IMbits / s; PeliCAN mode extensions; 24MHz clock frequency; different microprocessor interfaces; programmable CAN output driver configuration; enhanced temperature adaptation in -40 C to 125 C.This article makes POO ~ P07 port of microcontroller SJA1000 connected to the A0-A7 port for data transmission. SJA1000 in connection with the MCU is shown in Fig. 3. SJA1000 connection with the MCU diagram is as shown in Fig. 3.

P00-P07

F=3

A0-A7

SJALOOO

MCU RXO
Figure 3. connection between MCU and SJA1000

USB

J DACQS32* MCLK

PC.

t^l

CAN-

B.

Transceiver Module

r
d

"v circuit.

6N137^

p j PCA82C25Q^

Figure 2. system circuit and each modules

In Fig. 2, the whole system structure is shown in details .In this structure, there are seven main parts, and the most important parts are the connection between MCU and CAN BUS and the design between DAC0832 and motor

There are two main collections of popular CAN bus devices at present: standalone CAN controller used with microcontroller and microprocessor with CAN controller. In connection with the requirement and developing environment of the system, The SJA1000 CAN controller and P82C250 CAN transceiver made by PHLIPS is adopted in this system. SJA1000 CAN controller is a CAN controller chip launched by PHILIPS, it can perform all the functions in physical layer and data link layer regulated by CAN protocol and it has all the features required in completing the high performance communication protocols. P82C250 is the

4911

interface device of the CAN controller SJA1000 and CAN physical bus. It provides the differential transmitting capability for bus and differential receiving capability for CAN controller. In order to strengthen the anti-jamming ability of the control nodes and avoid the crosstalk among lines, it is connected with the P82C250 through SJA1000, isolating nodes on the bus from each other to protect the CAN controller. Besides, both ends of the bus should be connected with a 120 matching resistor to improve the reliability and anti-jamming ability of the system communication. The single chip clock in the system is provided by SAJA1000 in order to keep both synchronous.
6N137 IN OUT

^>
DAC0S32 VOUT <

Figure 5. data connection

TXO A0-A7 SJA1000

=5

t*

TXD

Fig. 5 is the connection map of DAC0832 in the circuit; the eight figures connect to eight IO ports of the microcomputer. The resolution is associated directly with the bits of DAC. This article adopts DAC0832 and has 256 subdivision steps. The specific subdivision steps or the control gears of electric machine are regulated by software. D. Power Management Module In this system, 10V, 12V and 5V power are used. +5 V DC power is provided by microcontroller, DAC0832 digital to analog converter connected with +12 V DC power, and +10 V power supplied for Reference voltage. Once powered up, the entire circuit works properly.
IV. SOFTWARE DESIGN

PCA82C250 6N137 =0 OUT IN

RXO

<^>

RXD

Figure 4. connection betweeen Controller and Transceiver

In the Fig. 4, two pieces of 6N137 are respectively connected with RXO the TXO in SJA1000, the TXD and RXD in PCA82C250 are connected with 6N137 to connect the controller and transceiver and protect the circuit. C. DAC module The DAC0832 is an advanced CMOS/Si-Cr 8-bit multiplying DAC designed to interface directly with the 8080, 8048, 8085, Z80, and other popular microprocessors The circuit uses CMOS current switches and control logic to achieve low power consumption and low output leakage current errors. Special circuitry provides TTL logic input voltage level compatibility. Double buffering allows these DACs to output a voltage corresponding to one digital word while holding the next digital word. This permits the simultaneous updating of any number of DACs. This article adopts DAC0832 to make subdivision driving of the electrical machine. In the process of experiment, step wave digital signals which generate from microcomputer chip are switched to analogue signals by DAC0832 digital-to-analog converter. And those analogue signals drive the motor through the power amplifier. In practical applications, we need control the drive of five motors and make five conversion chips integrate in one chip so as to achieve synchronous control of the five motors.

The software of Can interface communication is divided into three parts, they are initialization of Can, data sending and data receiving. The initialization of Can is mainly about the setting of communications parameters of Can. The control registers that need to be initialized include mode register, time division register, codes receiving register, mask register, bus timing register and output controller. It is only when Can controller is in the reset condition that all the registers can write the program about access to send data and write the data that is ready to send directly into the send buffer zone. Receiving program simply reads information from the receive buffer and store it in user-defined data storage area. The processes about information sending from Can controller to Bus and information receiving from Bus to can controller are both automatically completed by Can controller. A. SJA1000 Initialization SJA1000 must be initialized before being used. As is shown in Fig. 6, after SJA 1000 coming into reset mode, set the appropriate register, exit the reset mode after the completion, and enter the normal operating mode.

4912

STARTS t SJA1000 Into the reset mode^ Set the baud rate register BTRO and BTR1*' Set node number ACR and Receive Mask Register AMR^1 Set output mode register OCR^ Exit reset mode, enter the operating mode^1 END.'

and the development cycle of project, it can also be embedded assembler, embedded in the key position, making the program to close to the compilation of the work efficiency.
V. CONCLUSION

Figure 6. Initialization flowchart

In this article, the innovation is the flexible use of the can bus system structure. Connect the can bus interface circuit with the original circuitry, and use DAC0832 digital to analog converter which is used in common to control multiple motors in synchronization. In the realization of the process, the software input several groups of digital signals, after conversion, output the analog voltage, after a power amplifier; amplify the signal, control each motor into 12 stalls subdivision. The CAN bus has many advantages such as data reduction, high reliability, real-time. These advantages make the system more reliable, closely and stability in the software design,
ACKNOWLEDGEMENT

B.

Receiver Realization of The Program

After the SJA1000 coming into work mode, the system can send messages or receive the information. The system uses the interrupt mode, the flow chart is shown in Fig. 7. After SJA1000 receiving or sending information, it will automatically generate an interrupt, external interrupt line of P89c669 goes low, After P89c669 receiving the interrupt, read the SJA1000 Interrupt register after P89c669 reading interrupt flag register in SJA1000, SJA1000 interrupt output pin / INT automatically is high. According to the status flag, P89c669 determines the interrupt type that occurred and then makes the appropriate treatment.
Interrupt service routine

This work is supported by Doctoral Fund of Ministry of Education of China (20090132120013) and Science and Technology Research of Qingdao under Grant (10-3-4-1-4-jch) and Ocean University of China Special Fund projects of young teachers.
REFERENCES [1] Robert s J, Corke P. Automation of Underground Truck Haulage. Proc of the Fourth Int 1 Syrnp on Mine Mechanization and Automation. 1997: B5- 23- B5- 32 [2] Lu Tongjun, Meng Xian chao, Wu Ping chuan and so on. Based PLC controlled robotic loading slag Machine, mechatronics. 1999, ( 2) : 29-32 [3] Wang liming CAN Bus System Design and Application. Beijing: Electronic Industry Press, 2008, 3. [4] Philips. SJA1000 stand-alone CAN controller product specification[EB/OL].Http://www.zlgmcu.com,2000 [5] Xiazezhong,Xuemin,can bus and can bus-based high-level protocol CAN open[J].PLC&FA,2005,(2);51-53. [6] Rao Yuntao, Zou Jijun, Wang Jinhong, et al. Principles and Applications of CAN field bus technology Surgery [M]. Beijing: Beijing Aerospace University Press, 2007: 149 - 153. [7] Zhao Bin. System test plan /Report PT_CAN physical layer [R] . [s. n] ,2007. [8] Fan Qiao, Liu j in, Cheng Sheng. Micro controller integrated stepper motor micro-stepping drive system, micromotor, 1996, (3): 3 0 - 3 1 [9] Lvang. Salvo-based embedded DC servo motor control system [J] micro-computing Machine information, 2005,7:18 - 20 [10] Cedric Davies, Pawan Lingras. Genetic algorithms for rerouting shor2 test paths in dynamic and stochastic networks [ J ]. European Journal of Operational Research, 2003, 144: 27 - 38.

Send interrupt

Other interrupt

SendCentral air

Store message

Write data to the transmit buffer

< T Over? J > ^

Set temporary signs Release receive buffer

Figure 7. Transceiver program flow chart

The programming environment is KeilluVision2, which is development software under Windows XP system. The Keil uVision2 is a 51 C-compatible microcontroller development software produced by Keil Software companies in the United States, being close to the traditional C language syntax to develop. Compared with the assembly, C language is more obvious in function structure, readability and maintainability. It also greatly improves the efficiency

4913

You might also like