# Development of a Membrane Liquid-Based Thin-Layer Cell Film Maker
## 3 System Design
### Measurement and Control System Design
#### 3.2.2 Software Design  
The software system is developed based on the C language environment of single chip microcomputer. In this process, the modular design thinking is adopted. The functions as well as interfaces of each functional module are designed respectively and packaged after passing the test. These models include the drive module of the stepper motor, the air pressure acquisition module, the liquid crystal communication and decoding module, the interpolation calculation module and so on. The user application calls these underlying driver functions in an orderly manner and performs corresponding operations according to the designed software workflow [24; 25; 26]. (1) Production process: the mechanical workflow is described in Section 2. This part explains the specific operation of the executive agencies in software. The main operation is the control of the polar coordinate manipulator, including using rotary stepper motor to control the polar angle of manipulator, and using the linear stepper motor to control the polar path of manipulator. In this application, the zero point of the polar angle is in vertical downward direction, and the zero point of the polar path is at  
Figure 8: Production flow chart. the zero point in radial direction. Each station has its corresponding polar coordinate value. Through testing and calibration, these values can be converted into pulse number coordinates of the motors relative to their respective zero points. Then, the arm end moves to the specified position by sending the number of coordinate pulses from the software. In another method, the Pulse Width Modulation (PWM) control method is adopted for the control of direct current motor, and the integrated PWM generation module is provided by the single chip microcomputer of C8051F series. The pulse width modulated waveforms with specified duty cycles can be generated automatically by changing the parameter value in the module. The higher the duty cycle, the faster the speed, then the corresponding breaking force of dispersing motor and the pressure of the air pump become larger as well. Figure 9 is a schematic view of the polar coordinate linear interpolation process. (2) Polar coordinate interpolation algorithm [27]: the slide is placed horizontally on the slide holder. When the slide is unloaded, move the lever on manipulator to push the slide, then the slide is panned to the inside of flip frame on the left. In order to prevent the mechanical interference and guarantee the smooth promotion during this pushing process, it is necessary to control the lever to make straight line operation. In the case of polar coordinates, the linear interpolation algorithm is required for this linear motion. For linear interpolation, firstly the coordinate system ought to be converted to the cartesian type. Based on the start p on \(P_{s}(x_{s},\ y_{s})\) and the end point \(P_{e}(x_{e},\ y_{e})\) of the interpolation, the length \(L\) of the line can be calculated as:  
\[L=\sqrt{\left(x_{e}-x_{s}\right)^{2}+\left(y_{e}-y_{s}\right)^{2}} \tag{1}\]  
Figure 9: Polar coordinate linear interpolation process. According to the resolution delta of the polar coordinate manipulator, the number of steps (\(n\)) required for interpolation is calculated as:  
\[n=\frac{L}{\textit{delta}} \tag{2}\]  
Here \(n\) can be seen as a judging condition for the completion of interpolation. The coordinates of the end point of the line can be expressed through the coordinates of the starting point:  
\[\left\{ \begin{array}{l}x_{e}=x_{s}+L\times cos\alpha\\ y_{e}=y_{s}+L\times cos\beta\end{array} \right. \tag{3}\]  
In the equation, \(\alpha\) and \(\beta\) are the angles between the line and \(x\) and \(y\) axes as:  
\[\left\{ \begin{array}{l}cos\alpha=\frac{x_{e}-x_{s}}{L}\\ cos\beta=\frac{y_{e}-y_{s}}{L}\end{array} \right.