Design of the Control System for Rehabilitation Horse Based on MCU STC89C52

It introduces a design of the control system for rehabilitation horse based on MCU STC89C52. The system’s control core is an 8-bit MCU STC89C52. First, the user input commands through the keyboard, then send commands to the DA conversion chip PCF8591 which can achieve the digital signal to analog signal output after dealing with MCU. Finally, PCF8591 send analog signal to the speed controller of DC motor in order to control the DC motor’s speed. Meanwhile, it builds a human-machine interface (HMI) to display the real-time speed of the horse through LCD.


Introduction
Horse riding can not only exercise the whole body, but also simulate most of the body points and accelerate blood circulation through the vibration; furthermore it has some special effects: exercising focus and regulating emotion. 1943, Hartel accepted surgery and drug treatment after suffering from polio, after treatment she could walked with a cane; but she resumed horseback riding. In 1952， she participated Olympics and obtained a silver medal [1]. Meanwhile, it is reported that more than 90% Miss Congeniality chose horse riding to keep shape at western countries [2]. From the beginning of May 2006, the Chinese Rehabilitation Research Center and the Beijing horse equestrian club work together to carry out the scientific research "domestic equestrian therapy training for disabled children " which indicates the official launch of the hippotherapy first introduced in the Mainland of China [3]. However, the real horse riding in real life will be constrained by time, space, horses, equipments, and many other conditions, in response to these shortcomings, the design of the rehabilitation horse can alleviate cervical disease, fatigue, hip and abdominal fat reduction, body shaping and so on. By analyzing the movement of the horse, this paper presents a digital DC speed control scheme which consists of a DC permanent magnet motor, DC motor speed controller and MCU control system. Meanwhile, to be able to display real-time movement of it, it has established a platform for human-machine interface (HMI).

Structure and function of control system
Structure of control system. The system's core controller is STC89C52. By collecting keyboard input, digital-analog conversion, and motor feedback, the user can control the horse directly. General diagram of the system is shown in Fig 1. Function of control system. The control system is mainly controlled by MCU, then connecting the DAC circuit which can implement the digital signal into analog signals output, after that, input the signal to DC motor speed controller in order to control motor's speed, to this end, three fixed modes: fast, medium and slow speed, and user-defined adjustment mode are set up. At the same time, the LCD would display the real-time speed of rehabilitation horse. In addition, the system is equipped with an emergency stop switch, so that it can be quickly stopped to ensure security. Control chip. In this system, it uses the 8-bit MCU STC89C52 which has the characteristics of highly reliable, ultra low-cost, low power and strong anti-interference [4]. It is compatible with MCU 8051, and supports for programming by assembly language and C language. In the internal of STC89C52, there are 8 KB Flash program memories, 2 KB of E 2 PROM, 512 Byte of RAM and 3 internal timers or counters which can be 8, 13, and 16-bit time / count. D/A converter circuit. The D/A converter is a device which is able to convert the digital signal into the analog signal (current or voltage), referred to as D/A converter or DAC. PCF8591T is an 8-bit A/D and D/A Converter produced by Philips Semiconductor [5]; it is a monolithic, single supply, low power, 8-bit CMOS data acquisition device with 4 analog inputs, one analog output and a serial I 2 C bus interface, moreover in the PCF8591, input and output of the address, control and data signals are transmits with a serial manner through the two-lane and two-way I 2 C bus, the maximum conversion rate is decided by the I 2 C bus maximum rate. The DAC circuit of the system is shown as Fig. 2.
The speed controller of DC motor. In this system, it chooses the speed controller of DC motor which has the PWM speed control. The controller is characterized by a low-voltage, DC, four-quadrant, regenerative and PWM speed control, using a dedicated MCU intelligent control, fast response, smooth operation, reliable protection functions and so on. In order to control the motor speed more accurately, the analog voltage signal, which converted by the DAC, will be sent to the controller to achieve speed control. It also has a function of feedback regulation to control the motor speed. The speed control connection of speed controller is shown in Fig. 3

Software design of control system
Allow for the system's portability and easy to maintain and expand, the system's software design uses C language. It includes the main program, keyboard handler program, D/A conversion program and interrupt service program. The system's main flow diagram is shown in Fig 4. The logical of main program is: after the controller electrified, first, reading data which is stored in E 2 PROM to boot reset and initialize parameters, and then enter the main loop. The program of keyboard handler: system uses a separate button configuration, so the keyboard handler is mainly to eliminate the keys' jitter. It is that after MCU's ports receive the power level change; the MCU dose not immediately identify the keys' state changes, but again to detect the port after a delay of 10 milliseconds, if the information is still changing, it indicates that this key is pressed (or released), which is actually avoided the jitter time when the key pressed (or released).
DA conversion is achieved through the PCF8591, while to realize the conversion of DA. First giving the definition of I 2 C bus driver, the bus can be used convenient and effective. After the definition, the DAC function could be programmed, which could accomplish the conversion of digital signal to analogy signal. Its flowchart is shown in Fig. 5. The interrupt service program includes internal timer interrupt and external interrupt. Internal timer interrupt is mainly responsible for calculating movement time, countdown time and so on. External interrupt is mainly responsible for pulse counting and emergency stop.

Experiment
In the experiment, simulation software is Proteus7 produced by Labcenter Electronics Company. Proteus's ISIS is a simulation system of EDA; it has some functions, such as analog circuit simulation, digital circuit simulation, simulating the system which consists of MCU and its peripheral circuit, keyboard and LCD simulation，and so on. In addition, it has many Virtual Instruments [7].
In the system, the control signal is inputted by key, then after deal with MCU STC89C52 and DAC PCF8591, the speed controller gets the analog signal (Voltage), meanwhile, the currently state of system display on LCD (Fig. 5).

Fig. 5. Simulation (v=80r/min)
The error analysis between the actual and the theoretical output voltage is shown in table 1 (the DC motor controller's error is about 1%). The system's error totally results from the control circuit and DC motor controller, and the error is about 2%. Though the comparison of the output voltage and theoretic voltage, we know it is more effective than using software design to realize the PWM function (whose error is about 10% [8]). So this system can realize the effective control of the DC motor.

Conclusion
We implement the function which is accurate control the speed of DC motor by digital signal, through debugging the control system whose control core is STC89C52. Meanwhile, some characteristics and advantages of the PWM controller ensure stable operation of the entire control system. And through LCD monitor to establish the human-machine interface which can realize very good human-machine dialogue.