【正文】
SK = 0x00; SEI(); //reenable interrupts //all peripherals are now initialized}void main(void){ init_devices(); //芯片初始化 SD2405_init(); //SD2405初始化 while(1) { Get_SD2405Time(); //獲取數(shù)據(jù) }外文資料The Software Control System Design for Robot Based on AVR MCUKai Yang, Junmei Zhang, Wenbin LI, Liu YangSchool of TechnologyBeijing Forestry UniversityBeijing, ChinaCorresponding author: Junmei Zhang, joyzhangjm@ Abstract—With the fast development of new principle in intelligent control, mobile robot has bee the focus in the field of robotics and automation for scholars. Robot petitions are active worldwide and expanded. Based on the petition requirements and rules of 2008 AsiaPacific Robot Contest, the control software of the petition robot is designed in this paper. In the control system, the AVR single chip puter and Clanguage are used to achieve the DC motor control, rudder servo control, and path planning of the robot. From an overall perspective, the structure of the program is clear and could meet the control requirements of the petition robot. The program can also meet the expected function.Keywords robot; control software; AVR SCM; path planningI. INTRODUCTION Robot is the highest manifestation of artificial intelligence and product of the development of automation technology. Robot petitions are active worldwide and expanded. This article is based on the 2008 AsiaPacific Robot Contest launched on robotics research. The task of the robot petition requirements and rules of the game is that the robot track on the path line to snatch at the object which is put on the top on the pillars. This design39。s control request in the standard site is that the robot can track the signal line steady and fast, arrives at specified location according to the predetermined way and realizes the snatch and so on a series of movements assigned [1]. Robot control system itself is plex. This article mainly involves software control. The whole control system is divided into the following tasks: DC motor control, multichannel rudder control, path planning and so on.II. DC MOTOR CONTROLA. The choice of control schemeThis design uses two DC motor as a system driver to control the movement of the robot left and right wheels. MCU control methods for motor are generally two types: analog control and digital control methods. Digital control method is to issue specific instructions to the motor control unit directly through the serial port of MCU in order to achieve the corresponding control requirements. The motors currently on the market are equipped with appropriate professional control module. The control module is one that contains the instruction decoding, PID adjustment, photoelectric encoder and other modules, with good antiinterference and control advantages of high accuracy[2]. Because of conditions, such as restrictions on the system board, considered from the stability and reliability of the overall system, this design chooses the digital control method.B. MCU serial munication theory and flowThe motor control mands are stored in a one dimensional array. Each time one controls the motor, which is to send an array of characters to the corresponding work is pleted by the AVR controlling universal synchronous and asynchronous serial receiver and transponder (USART) of chip. In this process, the control chip and motor control units use the way of asynchronous serial munication to carry on the correspondence. Control chip is as the host puter, while the motor control unit is as a data receiving terminal. The format of Character frame is 8 data bits, 1 stop bit, no parity bit, and the baud rate is the 9600 bit/s. As the USART interior includes a baud rate generator, its clock input is 8 frequency division or 16 frequency division of system clock input(depending on the asynchronous munication working pattern, when for double speed pattern is 16 frequency division, otherwise is 8 frequency division). The data transmission selects query mode to carry on. After sending data due out to buffer register, buffer register empty flag bit is kept sending the query. When this flag bit is 1, it means the transmission has pleted and next data can be transmitted. The Fig. 1 is the flowchart of serial munication.III. MULTICHANNEL RUDDER CONTROLAs the robot arm’s multiple joints need to control by the rudder, the MCU must be able to control multichannel rudder. From the correlation between pulse width and angle of rudder, we can see that the pulse width is very short relative to the pulse period and the time of pulse emergence is not necessarily. As long as in a pulse cycle, pulses appearing at any time are able to meet the requirement. Therefore, we can control a multichannel rudder by means of generating different output pulses at different times in a signal cycle [3]. Below taking timer overflow interrupt which generates PWM to control 6 rudders (this system only uses 2 rudders) simultaneously. We suppose the control signal output ports of 6 rudders are respectively to . The time of high level is respectively Th0 to Th5. The control step is as follows: Pull first, timer timing Th0. When the timer overflows and causes interrupt, is pulled down, while is pulled and timer times this process again and again until is pulled down. Then the timer times 20ms(Th0+ Th1+ Th2+ Th3+ Th4+ Th5) and pletes a signal cycle timing. The flowchart of rudder control value calculating program and the rudder control program see the Fig. 2 and Fig. 3 below.IV. PATH PLANNINGWhether robot could walk in accordance with preset routes, the key is that the robot could take a straight line and change direction accurately according to control requirement, and continue to walk along straight line after turning the direction. Without appropriate algorithms, the robot will walk a noticeable ‘s’shaped curve, not only affecting the speed, but also very easy to deviate fr