Summary: Introduce a kind of medical instrument based on Small RTOS51 embedded operating system – -Intelligent enteric nutrient liquid infusion pump. Recommend function and hardware of the system to make up at first, then introduce how to make use of Small RTOS51 to design the system software especially. Finally, provide the test data of employing the intelligent enteric nutrient liquid infusion pump made of Small RTOS51 embedded operating system.
Keyword: Small RTOS51 real-time operating system Enteric nutrient liquid pump Embedded operating system Foreword Applied constant deepening in each field with various electronic systems, the requirements for electronic system are higher and higher, especially have stricter requirements to the performance in all respects such as the dependability, responding to in real time of the software design of the control system,etc.. The design program of the one-chip computer is no longer the operational mode of the front and back platform, but is the design philosophy of adopting the real-time operating system of many tasks. Because of using the embedded operating system, can resolve employing specifically into a plurality of tasks, simplify the design which employs the system software, make the real-time character of the control system get the assurance, make it reach ideal state. Much better the task is designed, contribute to improving stability and dependability of the system. At present, what China employed most are 8 one-chip computers relying mainly on 51 serial one-chip computers. In 51 serial one-chip computer systems, the embedded operating system that can be transplanted is few. Among them, Keil RTX51 attached does not have source code, it is very inconvenient to use; Though uC/OSII has source codes, there is example transplanted, however, it takes up to the resources of 51 serial one-chip computer systems too big, need, expand RAM outside, want, can guarantee each function person who reentry, use more reluctantly. Small RTOS51 be designed for little RAM system specially take the lead the intersection of type and kernel, take up resource to be little real-time character fine, it is very suitable to apply to this system. A systematic function and hardware are described 1. The function of a system is described For in a comaing or the patient that the gullet carried on the operation, need a kind of intelligent enteric nutrient liquid infusion pump importing enteric nutrient liquid to the patient on time, according to quantity, in order to achieve the goal of maintaining patient’s life. That this text recommend the intelligent intestines nutrition infusion pump ‘ Hereafter referred to as the nutrition pump Mainly realize the following functions: *As requested, can presume parameters such as the total amount, velocity of flow, temperature of nutrient liquid of input,etc., and can revise arbitrarily in the course of running; *According to the order, measure and control flow and velocity of flow of nutrient liquid automatically, and feedback the data to the main program; *According to presuming the temperature of nutrient liquid, measure and control the temperature of nutrient liquid automatically, and feedback the temperature data to the main program; *When the temperature, flow and velocity of flow which present nutrient liquid are unusual, give out the sound, mere alarm signal; *Use LCD to reveal various data, look over the quantity, temperature, flow and velocity of flow that have already input nutrient liquid at any time; *Nutrition pump power by 220VAC mainly, have, meet an urgent need rechargeable battery at the same time, one charge, can run more than 12 hours continuously, prepare to use when the hospital stops promptly. 1. The hardwares of 2 systems are described Circuit principle block diagram of pump of this nutrition.Top management CPU of the system adopts 89C51RD2 of Philips Company, the many tasks control of the implementation system; LCD adopts LCM12232B liquid crystal module of the high official position of Beijing, reveals the control parameter of the liquid; Control DAC of the temperature to adopt TLC5615 of TI Company, make the temperature error of nutrient liquid reach less than 0.1 ℃; The battery capacity and feedback value of the temperature imitate the voltage, adopt A/D, after changing, send into CPU; What A/D converter used is TLC1543 of TI Company; Meet an urgent need battery charge circuit, adopt the intersection of Linear and LTC4006 of Company, charge voltage as 12.6V, battery capacity 4000mAh; The flow of nutrient liquid is feedbacked, adopt the infrared ray to managing, is counted by CPU directly; The nutrition pump electrical machinery uses the direct current motor, adopting the way of controlling the electrical machinery to run with quiescent time will pay and close the ring to control to the rotational speed, in order to achieve the goal of controlling the liquid flow. About 2 Small RTOS51 Small RTOS51 is an embedded real-time operation kernel designed for 51 serial one-chip computer specially, can use its code directly while using Keil compiler, it has the following characteristic. Disclose the source code. So long as follow the permission agreement, anyone can obtain the source code free, benefit users’ secondary development. Portability. Users can compress the control order related to CPU to minimum, put most energy in the control procedure of CPU. Can use ANSI C to write the application program, not only has simplified the programming means, but also the convenient procedure transplants. Can solidify ing. Small RTOS51 designs for the embedded system, can imbed in the products, becomes a part of the products. The taking the lead type runs. Small RTOS51 can manage the tasks of 16 users, each task can set up different PRI. Small RTOS51 task with supreme PRI of always running. Stop managing. Adopt and cut off the management style, as having when advanced break is applied more for, hang up the task carried out at present. If the task with higher PRI is stopped waking up, the task of high PRI is carried out at once after cutting off the nestification to finish. It can reach 255 layers to count to cut off the nestification layer. If necessary, can also forbid the nestification management that is cut off. RAM demand is small. SmallRTOS51 designs for the system of little RAM, therefore the demand for RAM has several numerous byte only, there is little corresponding service of the system. The software of 3 systems is realized According to the function that the system should realize, divide the whole system into several tasks of running side by side, check in taking the lead operation the deployment of the task is to go on according to the level of task priority. In this text, divide the system into 9 tasks, depending on its PRI is sequentially from high to low systematic arrangement: Warning task, temperature-controled task, key in task, control task, electrical machinery run task, the intersection of flow control and task, clock task, liquid crystal, reveal task and the intersection of battery and electric consumption measure task mainly. Enter the main program after the electricity on the system, combine the task examining to the system at first, start 9 Cheng, systematic operation is taken over by Small RTOS51 at this moment. 3. A warning task Because of the nutrition pump stated herein, in the ones that mainly apply to the critical patient are nursed, so is placing the warning task on the most important position. The warning procedure is controlled by a overall variable setbaojing, it is measuring the temperature-controled procedure, flow control procedure and output value that the battery electric consumption measured the procedure constantly. Break down alarm signal as above-mentioned procedure, setbaojing is 1, the warning procedure makes buzzer and alarm lamp work immediately, and reveal the name breaking down on the liquid crystal screen, until someone debugs, can run normally. 3. 2 temperature-controled tasks Because the human body is very sensitive to the change of the temperature, and enteric nutrient liquid is in the small intestine input into people directly, so expecting very much to the temperature of system, for this reason, this system places the temperature-controled task on the second. The temperature parameter that will be presumed first is input into CPU, calculate through PI, sends out the digital signal, and then convert to analog quantity with TLC5615, control and heat the circuit to give nutrient liquid to heat. The actual temperature of nutrient liquid, is converted to the voltage signal by the feedback circuit of temperature, and then convert to the digital signal and feedback to CPU through A/D, is closed the ring to control by CPU. 3. 3 controls the input task The button is the important apparatus which realizes human-computer interaction, require the real-time character to be relatively high. In terms of design of the system software, not only will read the state of the button, will also need to deal with special circumstances such as shaking, double hit, one bunch of keys of the button,etc.. The system keys in the task procedure, this task uses the formation order KeyReadBuf of news [16 ], send the relevant information of the button to the master control program. 3. 4 mainly controls the task Mainly control the task to employ the systematic function OSQPendKeyTemp,KeyRead Buf,0 that SmallRTOS51 offers To check that record and key in the information that the task offers, once discover that there is relevant information in KeyReadBuf [16 ], operate the input procedure at once. According to the order of the button, control the electrical machinery to operate the procedure, flow control procedure, liquid crystal and reveal the operation of the procedure and stop, whenever a group of button informations are entered in the news formation, this procedure revises a order of running. 3.5 Task of running of the electrical machinery Electrical machinery run task in state that wait for, give it take place, imprison the corresponding order of words, begin, run as master control program. In the course of running, the electrical machinery runs the task receives the control of the master control program and control procedure of the flow, once there are orders stopping running, or the flow is unusual, stop the operation of the electrical machinery at once. 3. 6 flow control tasks The liquid quantity controls the task to be mainly had and control flow and velocity of flow of nutrient liquid of input by CPU. Under the normal running situation, the control procedure of the flow will reveal to the liquid crystal the procedure sends the information of flow and velocity of flow, reveal that has already input the quantity, flow and velocity of flow of nutrient liquid on the liquid crystal. Once abnormal condition takes place, for instance the velocity of flow is too fast, such troubles as nutrient liquid has not flowed of some time, the procedure sends out the order to run to the electrical machinery at once, stop operation of the electrical machinery, puts 1 of setbaojing at the same time, make the warning procedure run. 3. 7 clocks the task Clocking the task is mainly for offering a synchronous clock systematically, offer the basis of running synchronously to the system. 3. 8 liquid crystals reveal the task The liquid crystal reveals the task mainly measures the procedure to transmit from master control program, warning procedure, flow control procedure, battery electric consumption to the parameter in the news formation. Reveal the procedure through running, reveal relevant Chinese character and character on the liquid crystal, itself send the order to other tasks. 3. 9 batteries of electric consumption measure the task Once it happens that the electricity cuts out in 220VAC city, nutrition pump will switch over to built-in lithium battery and supply power automatically at once, the battery can be used for more than 12 hours continuously. The electric consumption of the battery will run automatically if the electric consumption of the battery measures the procedure, measure the electric consumption of the battery. In the situation with low electric consumption, the electric consumption of the battery will send out the alarm signal while measuring the procedure, but will not stop systematic operation voluntarily. 4 test datas With stated herein the intersection of intelligence and enteric the intersection of nutrient liquid and until daily the intersection of odd and nutrition bag carry on the experiment at the market at present pump. The above-mentioned experimental data show, the intersection of intelligence and enteric the intersection of nutrient liquid and quantity precision of infusion of pump this well-above 10% of the universal standards at the market at present, and can control the nutrient liquid bag of various brands within the range of enough precision. Conclusion In the design of the enteric nutrient liquid pump, have used Small TROS51, has simplified the difficulty of designing program greatly, strengthen dependability and security of the system, meet the systematic real-time character requirement. Originally design reaching the national standard, and already begun to use in facing the storehouse.