For LRXAY-8 printer, a portable angle measuring device is designed to record the rotation angle of the printer’s spindle. The device has only three buttons: the “Set/Clear Start” key, ” ” key and “_” key, which can complete the angle measurement and the change and storage of measurement data. Printers play an important role in the information age and directly promote the spread of human civilization and culture. Even with the advent of the Internet era, electronic reading has gradually occupied the human life, but books with thousands of years of development history still occupy the high-end position of human reading, and the core content of human knowledge is still inherited by paper media. In industrial production, once the angle of the printer’s rotating shaft is in question, it will have a great impact on the quality of printing products, such as uneven inking, missing printing and so on. With the development of science and technology, the printing speed of printing press is also getting higher and higher. If the finished product has printing problems and is found by human, the cost of loss is too high at this time. According to the actual production needs, the angle controller not only requires accurate measurement results, but also requires the equipment to be portable and easy to detect at any time and anywhere. Therefore, portability and lightness will become the place where this design is different from other products. In addition, the device embedded AT93C46 memory chip, can store a large number of detection data, greatly facilitating the production management of staff. This design is mainly based on the development of instruments based on C51 single-chip computer, and uses the latest model of industrial angle encoder and memory chip. The power supply of the angle controller of the printing press is supplied by ordinary batteries, and the voltage is supplied to the single-chip computer through the step-down power supply chip. As the main control of the whole system, MCU development board needs to use the smallest system of MCU. LCD0802 display screen, AT93C46 memory chip, keys and Omron rotary coding sensor are connected through the I/O port of P 0-P4. When different keys are pressed, the MCU can operate the sensor to detect the pulse and calculate the actual rotation angle according to the specific program algorithm. The data can be input into the memory chip in real time, and the data can be changed by the keys. These operations or results can be seen on the LCD screen and the whole hardware circuit. The working process is shown in Figure 1. Single-chip computer is also called single-chip computer.
Its structural feature is to integrate all the basic functional components necessary for control applications into one circuit chip, such as CPU, RAM, ROM, timing/counter and programmable parallel I/O ports. These functional components are usually attached to the internal bus of the single chip computer, and transmit data information and control information through the internal bus [2]. In this experiment, only the smallest single-chip computer system composed of single-chip computer, power supply, crystal oscillator circuit and reset circuit can be used to form a working system. AT89C51 has four 8-bit parallel I/O ports, which are recorded as P 0, P 1, P 2 and P 3 respectively. P 0-P 3 ports can be used as quasi-bidirectional universal I/O ports for users. P 1-P 3 ports do not need external pull-up arrays, and P 0 ports need external pull-up resistors, as shown in Figure 2.
When in use, when one of the function buttons is pressed, the CPU repeatedly queries the status of all keys while executing the current main program. When the data of the second key is ready, an interrupt request is sent to the CPU on its own initiative. When the CPU receives the interrupt request, it suspends the executing program and transfers to the interrupt service program. When the interruption service is completed, it is returned to the original existing program to continue execution. Of course, multiple breakpoints can be nested in a main program, as shown in Figure 3. AT89C51 MCU has five interrupt sources, including two external interrupt sources and three internal interrupt sources. The interruption triggering modes are as follows: low level or negative jump pulses appear on the external pins, the number of pulses received in the counter reaches the overflow level, and the transmission or reception of a frame of serial data is completed.
The operation of interrupt system of single chip computer is realized by controlling register, as shown in Fig. 4. C51 has four control registers: TCON (Timing Control Register), thermostatic element SCON (Serial Port Control Register), IP (Interrupt Priority Control Register) and IE (Interrupt Allow Control Register). Omron rotary encoder converts the rotating mechanical displacement vector signal into electrical signal, which can effectively measure the angle of the angle controller. That is to say, the angle sensor is a sensor that can sense the measured angle and convert it into the available output signal. There is a hole in the body of the Omron encoder, which can match the rotating shaft. The encoder rotates one cycle to output a fixed number of pulses. When the axis rotates at a fixed angle, the angle sensor counts once. When turning in one direction, the count increases, and when the turning direction changes, the count decreases. When the angle sensor is initialized, its count value is set to 0. If necessary, you can reset it programmatically.
The circumference of the measuring wheel is L1, and the display angle is equal to (counting value (N) * 360.0 * L1) /(1000 * input circumference L). The angle controller of printing press has three keys: setting/clearing start, ” ” and “”, as shown in Fig. 5. Press the “Set/Clear Start” button for 3 seconds and enter the set state.
Use the ” ” button to choose the way of direct measurement or indirect measurement to measure the rotation angle of the printer. After obtaining the measured data, press the “Set/Clear Start” button to achieve data clearance. In the set state, the size of the number can be changed with the ” ” key (0-9). In the non-set state, press the’ ‘key and enter the storage state.
The measured angle value will be stored in the memory chip. After the measurement is completed, press the” key directly to view the data measured before. Update LCD display in real time. Processing A: Press the “Set/Clear Start” button to release immediately, and the system enters the Clear Start state; Press 3 seconds to enter the Set state. Processing B: In the setting state, switch the measuring mode by pressing the’ ‘key (the system has two measuring modes: directly measuring”D’ and indirectly measuring”L’) or modifying the size of the number (0-9); in the non-setting state, press the’ ‘key, then enter the”storage’ state. Processing C: Move to modify or set the cursor position in the set state. This product needs to achieve the purpose of accurate and fast angle measurement, as well as the change and storage of measurement data, so the signal acquisition of rotary encoder is very important. Pulses can be divided into positive and reverse pulses, i.e. A-and B-direction pulses. From the hardware point of view, the functional elements for detecting positive and negative inversion are not used in the circuit, but from the software point of view, this function can be realized by writing a “two-way calculation” program algorithm. In this way, the complexity of the circuit and the cost of the product can be reduced. For the acquisition of the number of pulses, the interruption function of the single chip computer can be used to count. The global variable is defined as the counting unit, and the interrupt settings drop edge is triggered. Then the global variable is added 1 [6] in the interrupt service program. Repeat the sum command until a equals the size of A, then take out the size of b, that is, B is the number of pulses collected. With the advent of computer technology, the world has begun to enter the information age. In the process of utilizing information, the first problem to be solved is to obtain accurate and reliable information, and sensors are the main ways and means to obtain information in the field of nature and production. In modern industrial production, especially in automated production process, various sensors should be used to monitor and control the various parameters in the production process, so that the equipment works in a normal or optimal state, and the product can achieve the best quality [7]. In the design, it is necessary to take into account the actual use of temperature, humidity, signal interference, audience and so on. Choosing a suitable sensor can greatly improve the stability of product use and the accuracy and accuracy of data measurement. Under the condition of market economy, in order to enable enterprises to obtain more and more profit margins in the fierce market competition, and to make the company better survive and develop, various enterprises have carried out and adopted many activities and measures to reduce costs. From the daily management, the purchase of raw materials, the selection of components, process simplification and other links to achieve, but few people will consider the source of product development and design of product cost control. According to the time division of its implementation, cost control can be divided into design stage, manufacturing stage and marketing stage. According to Pareto’s law, 80% of the cost is usually caused by 20% of the work.
The main cost of the product occurs in the manufacturing stage. Because the material and labor costs of the product are mainly formed in this stage, it is necessary to strengthen the cost control of the production process in this stage.
Designing stage has less cost, but once the design is completed and put into production, product cost has been determined. Therefore, if we want to save a lot, avoid waste and reduce costs, we should start to implement cost control at the design stage. Obviously, there is no need to select the highest performance products when choosing components, such as AT89C51, which is enough to meet the design requirements. In this way, it can not only avoid the waste of performance, but also reduce the cost of products. In addition, it can also obtain greater market competition advantage in price.