【正文】
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 from t。0x0f; m_DEC_data[2]=m_DEC_data[0]*10+m_DEC_data[1]; return m_DEC_data[2];}//================================================================//函數(shù)功能:將十六進制DEC數(shù)據(jù)轉(zhuǎn)換成二進制BCD數(shù)據(jù),并返回該數(shù)據(jù)//================================================================uchar SD2405_DECtoBCD(uchar DEC_data)//change DEC_data to BCD_data { uchar m_DEC_data[3]; m_DEC_data[0]=DEC_data/10; m_DEC_data[0] =4; m_DEC_data[1]=DEC_data%10; m_DEC_data[2]=m_DEC_data[0]|m_DEC_data[1] ; return m_DEC_data[2];}//================================================================//函數(shù)功能:初始化SD2405數(shù)據(jù)//================================================================void SD2405_init(void){ SD2405_WriteData(0x10,0xa1);//wrt1=1;intfe=1;ints1=1 SD2405_WriteData(0x0f,0x84);//wrt2,wrt3=1; SD2405_WriteData(0x12,0x00);//清零數(shù)字調(diào)整寄存器 SD2405_WriteData(0x11,0x03);//1024hz SD2405_Start(); SD2405_SendByte(0x64); SD2405_WaitAck(); SD2405_SendByte(0x00);//設(shè)置寫起始地址 SD2405_WaitAck(); SD2405_SendByte(0x00);//second SD2405_WaitAck(); SD2405_SendByte(0x00);//minute SD2405_WaitAck(); SD2405_SendByte(0x80);//hour ,二十四小時制 SD2405_WaitAck(); SD2405_SendByte(0x01);//week SD2405_WaitAck(); SD2405_SendByte(0x01);//day SD2405_WaitAck(); SD2405_SendByte(0x01);//month SD2405_WaitAck(); SD2405_SendByte(0x00);//year SD2405_WaitAck(); SD2405_Stop();}//================================================================//函數(shù)功能:得到SD2405數(shù)據(jù)//================================================================void Get_SD2405Time(void){ uchar next,m_temp; uchar m_data[7]; SD2405_Start(