0 Introduction When you are unwell, you often go to a hospital for treatment. The first procedure is to identify the serial number, and to measure body temperature in order to provide a basis for the diagnosis. The traditional mercury thermometer was used. When the weather was cold, the clothes were worn much. Sometimes it was worried about whether the thermometer under the armpit would break. The nurses also had to read the above indexing value with effort. This was designed for this purpose. An instrument: a thermometer that is safe, fast, and intuitive for temperature reading. The block diagram is shown in Figure 1.

In the picture: The temperature sensor uses LM35 precision temperature sensor, its output voltage is proportional to the Celsius temperature, altogether 4 routes.

Amplifier: Adopt CA3140 to form the amplifying circuit, amplify the mV signal that LM35 outputs as the DC voltage signal of 0~5V, as the analog input signal of the one-chip computer.

Microcontroller: Microcomputer control system for PIC16C71 microcontroller.

Display unit: It is a 4-bit high-brightness LED display, in which the first red shows the channel number, and the last 3 greens show the temperature value of 1 decimal place.

Keyboard: 4 keys, respectively, control 4 display channels, the initial state default to the value of the first channel.

1 PIC16C71 microcontroller PIC microcontroller is introduced by the United States Microchip Technology, represents the new trend of the world's microcontroller today, using the RISC RISC instruction set and the instruction bus and data bus separate Harvard bus structure. PIC16C71 18-pin dual inline integration Device, in addition to the CPU, there are 36 8-bit RAM, 1k EPROM, 1 timer/counter, 13 bi-directional independently programmable I/O pins, built-in self-oscillating watchdog, low power consumption. (Except operating current is very small, it also has SLEEP mode), strong output drive capability (can directly drive LED). Wide working voltage (2~6V), especially its internal has a 4-channel high-speed 8-bit A/D conversion, The reference voltage is software-programmable, it can be the power supply voltage of the chip, or the voltage on the RA3/AN3/VERF pin can also be selected. The port B also has a level change interrupt function (a keyboard can be directly externally attached). And other common types Compared with the 8-bit microprocessor, the CPU has a small size (18 feet), no need for external RAM, E-PROM, A/D converter, and an external interface of the display and keyboard and an output driver chip, which greatly simplifies the peripheral circuit. Reduced size while also achieving 2:1 code Shrinkage and 4:1 increase in operating speed. Its UV-erasable ceramic package type is ideal for development, while the low-cost one-time user-programmable device (OTP) is suitable for batch products. It has long been abroad. Is widely used, there is also a rising trend in the country.
Application of 2LM35 The LM35 precision integrated temperature sensor is a product of NS Corporation. Its output mV voltage is proportional to the Celsius temperature. It requires high precision without external adjustment or calibration. It can be powered by a single power supply and the supply current is only 60μA. The type is very small, only 3 pins (as shown in Figure 2), VOUT is the output voltage terminal, VS is the power supply terminal, GND is ground. For the temperature measurement range between 12 ~ 150 °C, it does not need a negative power supply and External pull-down resistor. VS is 4~20V DC.

The temperature range of this instrument is set to 12~63.8°C, including the range of human body temperature. The reason for setting 12°C is that LM35 does not need external negative power supply when ≥12°C; 63.8°C is set to avoid the operation of PIC microcontroller. Weak (no multiplication/division instruction), but can be left-shifted twice to achieve multiplication by 4, which is 255, which is the maximum value of the 8-bit A/D conversion. The output is +10.0mV/°C, which is 370mV at 37°C. The LM35's output of .63.8°C is 638mV. If the 638mV is amplified to 5V, the PIC16C71 achieves higher accuracy. The CA3140 is a high-accuracy linear integrated operational amplifier manufactured by American Radio, with CMOS input, low power consumption, and bipolar type. Transistor output (can output larger current), especially suitable for applications connected to the MCU. With low offset, low temperature drift and low noise performance, offset voltage is less than 100μV, offset current is less than 10nA, temperature drift below 1μV/°C Using the amplifier circuit shown in Figure 3. Since the amplifier's input resistance is high, the gain of the op amp is: AV = (R2 + RW1) / R1 and 5V corresponds to 638mV magnification should be 7.8, take R1 for 20kΩ; R2 is a 150kΩ standard resistor; RW1 is a 10kΩ multiturn potentiometer Accurate adjustment of magnification.R is 100Ω, RW2 is a 10kΩ multiturn potentiometer for zero calibration. The amplified voltage signal enters RA1~RA3 of the PIC16C71 as an analog input signal, and 5V is internally A/D converted. For 255 (0FFH), to obtain the corresponding temperature value, the result of A/D needs to be divided by 4 (255/4=63.8). For PIC microcontrollers, divide by 4 is very easy to implement, and then it is converted by binary. Displayed as a BCD code, take two integers and the first decimal point. Because the LM35 and CA3140 are high-precision linear devices, plus the adjustable characteristics of the CA3140 zero and gain, so in the range of about 37 °C, and It is perfectly possible to achieve high accuracy with one decimal place reserved.
3 DISPLAY AND KEYBOARD 3.1 DISPLAY Because the PIC16C71's A and B ports both have a high ability to sink and supply current, each I/O port can sink 25mA and supply 20mA, and the total absorption/drive current at port B is 150/100mA, port A is 80/50mA, this ability is obviously suitable for driving 7-segment LED display. RB7~RB0 is connected with each segment and LED of the LED. At this time, RA3~RA0 is defined as output, and each leg passes through A transistor is connected to the LED. One of the four transistors is turned on to determine which bit is currently displayed. The LED is a 7-segment LED with a common cathode highlight. Each bit is displayed for 5ms. The display cycle for scanning 4 bits is 20ms. The frequency is 50Hz, which can meet the needs of human eye observation. The 5ms time base is obtained by dividing the 4.096MHz oscillation by 1:32 and then added to TRM0. The initial value of TRM0 is set to 96, (256-96) × (32 × 4/4096000) = 5ms, so TRM0 generates an interrupt every 5ms. When the lower 4 of the OPTION register is 0100, the prescaler ratio of TRM0 is 1:32.

3.2 Keyboard Because RB7~RB4 has level change interrupt function, it can connect 4×4=16 keyboards with B port. This design only needs 4 keys, which are defined as #1, #2, #3, #4 respectively. .RB4 is set as input, and RB3~RB0 is set as output. The upper bit of OPTION allows weak pull-up of port B. Therefore, when no key is pressed, RB4 is high. Set RB2 output to “0”. If “#2” is pressed, RB4 goes low, and this level change can cause the B-port level to change and generate an interrupt. If "0" is output in turn from RB3-RB0, it can be detected whether there is a key press. When testing a certain key is pressed, the key is debounced and the key value is read. Only when the pressed key is released, a new round of scanning is started. Such a scanning method can prevent the keyboard from being mis-operated.

4 programming Because PIC one-chip computer adopts RISC simplification instruction set, PIC16C71 belongs to mid-range PIC one-chip computer, there are only 35 instructions, besides jumping instruction, the rest are all one-cycle instructions. For programming, it has no uniform format, and easy to learn Use, as shown in Figure 4, Figure 5 shows the flow chart of the main program and keyboard service routines. PIC microcontroller program is easy to write, but its program debugging is a must. There are two ways to debug: one is with real-time The online simulator is a simulation software package. In order to achieve 100% real-time online simulation, the basic system of PICMATE produced by Fujian Gaoqi Company is used, and the PROBE71 simulation template is used for simulation and debugging. It can fully achieve the design. The request.

5 Conclusion This system combines the features of the PIC MCU and the LM35 sensing element. A multichannel temperature measuring instrument with a simple peripheral circuit, low cost, and high practicality is designed. However, it can also enhance some other auxiliary functions. It can be used as a measuring instrument in other aspects through a few soft and hardware changes.

[references]

[1] Li Dongxing, Lin Peican, Chen Xiaomu. Application design of PIC16CXX series single-chip microcomputer [C]. Fuzhou: Gaoqi Electronic Technology Co., Ltd., 1996.

[2] Yu Guanghao, Wang Yihong, Wu Yifeng. Development and Application of PIC Series Microcontrollers[M]. Beijing: Publishing House of Electronics Industry. 2000, 4.

[3] Wu Feng. Development and Application of PIC Microcontroller[M]. Beijing: Beijing University of Aeronautics and Astronautics Press, 1999.

[4] Shanghai Electrical Apparatus Research Institute. Practical Electronic Components Manual [M]. Shanghai: Shanghai Science and Technology Press, 1998.

Author brief introduction: Shen Shibin, 1967-, Nanjing Normal University, Department of Control Science and Engineering Engineer, Experimentalist, mainly engaged in detection technology and automatic control teaching and research.

Big Wheel Electric Scooter

Big Wheel Electric Scooter,Big Wheel Off-Road Electric Scooter,Big Wheel Electric Scooter For Adults,Electric Scooter With Large Wheels

Jinyun County Longma Automobile Electric Co., Ltd. , https://www.longmaauto.com