Design of Capacitance Test Circuit Based on PlCl6LF874 Single Chip Microcomputer

Publisher:变形金刚Latest update time:2011-03-22 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

This article uses the PICl6LF874 microcontroller from Micmchip, an American company . This microcontroller uses a RISC reduced instruction set, Harvard bus structure, and pipeline instruction mode. It has the characteristics of strong anti-interference ability, low power consumption, high performance, and low price.

1 PICl6LF874 microcontroller

The PICl6 series of microcontrollers adopts a Reduced Instruction Set Computer (RISC) structure, breaking through the natural structural dependence of traditional microcontrollers on PCs; coupled with the Harvard bus memory structure, two-stage pipeline instruction structure, single-cycle instruction and other technologies, it has taken a unique approach to the microcontroller hardware structure and greatly improved the efficiency of system operation. In addition, in view of the characteristics of microcontroller applications, the PIC microcontroller also has some unique features in terms of power consumption, drive capability, peripheral module design, etc., making the PIC a convenient, practical and cost-effective microcontroller.

The PICl6LF874 series of microcontrollers includes a series of different types of devices. The main features are:

1) Reduced Instruction Set Technology The PIC instruction system is specially designed according to the characteristics of small computers, striving to achieve higher efficiency for each instruction and reduce the duplication of instruction functions. The number of instructions for high, medium and low-end PIC microcontrollers is 58, 35 and 33 respectively. This brings two benefits. On the one hand, it can greatly improve the utilization rate of the code and help improve the execution speed. On the other hand, it brings great benefits to users' learning, memory and application. Programming and debugging are relatively easier, and the same function requires less coding, saving development time.

2) Harvard bus structure Harvard structure is that the program memory and data memory are independently addressed, that is, the two are located in different physical spaces. The PIC series microcontrollers not only adopt the Harvard system structure, but also adopt the Harvard bus structure, thus giving full play to the potential advantages of the Harvard structure. It greatly improves the system's operating efficiency and data reliability.

3) Single-byte instructions Single-byte instructions are a revolutionary change to the single-chip microcomputer system. The instruction bits of high, medium and low-end PIC microcontrollers are 16 bits, 14 bits and 12 bits respectively. The addressing of ROM and RAM is relatively independent, and all instructions are implemented in single bytes, which not only makes data access safer, but also significantly improves its operating speed.

4) The two-stage pipeline instruction structure uses the Harvard bus structure, which separates the data bus and instruction bus inside the device and uses different bus widths. When an instruction is executed, the next instruction is fetched at the same time, so that higher efficiency can be achieved in each clock cycle.

5) Register group structure All registers of PIC, including I/O ports, timers and program counters, are in the form of RAM structure and can be accessed and operated in just one instruction cycle.

6) One-time Programmable (OTP) Technology OTP can achieve zero time to market and can be customized to meet specific needs. Product customization can significantly improve the product life cycle and enhance the market competitiveness of the product.

7) Low power consumption The supply voltage is 2.0~5.5V. When using a 4 MHz crystal oscillator and the supply voltage is 3V, the typical current consumption does not exceed 6 mA: when using a 32 kHz crystal oscillator and the supply voltage is 3 V, the typical current consumption is 20 mA, and the current consumption in sleep mode is less than 1μA.

8) Complete variety, easy to choose. The PIC series of microcontrollers has now formed a huge family with more than 50 models in three grades: high, medium and low. The functions are flexible and diverse, and can meet the different needs of various application occasions.

2 Capacitance Working principle of measurement module

The overall design principle block diagram of the capacitance measurement module is shown in Figure 1, including the power management circuit , PICl6LF874 single-chip microcomputer, capacitive sensor , signal conditioning circuit , PS021 capacitance digital converter and interface circuit connected to the computer.

The working principle of the capacitance measurement module is as follows: the capacitance sensor outputs a weak capacitance signal, and the capacitance signal passes through the signal conditioning circuit and enters the PS02l capacitance-to-digital converter. The capacitance measurement range of this device is from 0 to tens of nF (unlimited). After the internal conversion of the device, the required value is obtained by setting the internal register of PS02l; the data is transmitted to the PICl6LF-874 microcontroller through SPI, and the measured data is then sent to the host computer (computer) through the asynchronous serial communication interface USART of the microcontroller. Finally, the host computer application displays the measurement results and saves the test data.

3 System Hardware Connection

This measurement circuit requires a control device to control the reading and writing of data. The PICl6LF874 microcontroller with simple structure, powerful functions and compatible with SPI serial interface is selected. Since the peripheral interface of PS02l is SPI, the microcontroller can control the operation of PS02l well, and the measurement data can be sent to the host computer through the USART serial interface. The connection of the microcontroller is shown in Figure 2, and the connection diagram of PS02l is shown in Figure 3.

4. Implementation of system software functions

The application software designed based on PS021 includes programs such as detection, control, data processing, database management and system interface. Under the conditions of program running speed and storage capacity, try to use software to realize the hardware functions of traditional instrument systems and simplify hardware configuration. In addition, the interface is the "window" of the test system and virtual instrument, and is the main way for the system to display functional information. Software design should not only realize functions, but also have a beautiful interface. After determining the hardware platform of the test system, the key is to choose a suitable software development tool to write the corresponding application software. The test module is developed in a graphical programming language. The development environment can provide an integrated development environment, which is easy to connect to the instrument hardware and has a good user interface. According to the principle of host computer application design, the software of the test system is obtained. By setting some parameters on the main interface of the software, the hardware circuit is connected to the host computer, and the measurement results can be displayed. The measurement results are displayed on the data display interface, as shown in Figure 4.

5 Experiments and Results

Use the above software to measure. Before measurement, the measurement system must be calibrated. During calibration, PS02l requires that the reference capacitor Cref and the measured capacitor Cmeas are in the same capacitance value range, that is, to ensure that the Cmeas/Cref ratio does not exceed 25% (PS02l limit value). The reference capacitor is a very important part and has a direct impact on the quality of the measurement and the temperature stability of the measurement. Recommended capacitor materials: CFCAP (multilayer ceramic capacitor of Taiyo Yuden) series, COG or NPO ceramic capacitors. Discharge Resistance Rdis is closely related to the discharge time, discharge time τ=0.7R(C+20 pF), and the time constant τ ranges from 2 to 10μs (recommended 5μs). Discharge Resistance value calculated according to the formula

In the experiment, fixed capacitors of 1, 2, 3, 5.1, 6.8, 8.2, 9.1, 12, 13, 15, 16.5, and 18 pF were selected as the measured capacitors. The size of the reference capacitor is determined according to the range of the measured capacitance, and then the discharge resistor value is determined according to the measured capacitance and the reference capacitance value, combined with the discharge time, and finally the appropriate measurement mode is selected for measurement. Under the calibrated system, a reference capacitor is connected to the reference end and the measured end respectively. At this time, the value displayed on the data display interface is the sum of the reference capacitance value and the parasitic capacitance value (the data displayed by Sensor 1 in Figure 3); then the measured capacitance is connected in parallel on the basis of the measured end reference capacitance. At this time, the measured data is the sum of the measured capacitance value, the reference capacitance value, and the parasitic capacitance value. The subtraction of the measured values ​​in the above two steps is the measured capacitance value. The final measured capacitance value statistics are shown in Table 1.

Table 1 reflects the relative error between the measured value and the nominal value of the measured capacitance. It is also known that the larger the capacitance value of the measured capacitance, the smaller the relative error between the measured value and the nominal value. Since the measured capacitance is affected by factors such as ambient temperature, the amount of solder, and the quality of the measured capacitance, there is a certain error. Multiple measurements are averaged to obtain a more stable capacitance value. Under the calibrated system, the fixed capacitance is measured to verify the accuracy of the measurement module. The measured value and the nominal value are very close. It can be considered that the error of the measured capacitance nominal value is small, and it is further known that the capacitance measurement module has a high measurement accuracy.

6 Conclusion

The PlCl6LF874 single-chip microcomputer can well control the capacitance measurement module, which has a good role in promoting the research of capacitive sensors. The single-chip microcomputer simplifies the circuit design and makes the measurement results reach a higher accuracy; at the same time, this measurement module can reduce the volume of the circuit board, thereby reducing the volume of the entire device; it greatly simplifies the circuit design process, reduces the difficulty of product development, and is of great significance to accelerate product development and reduce production costs. Experimental results show that this measurement module has good practicality.

Reference address:Design of Capacitance Test Circuit Based on PlCl6LF874 Single Chip Microcomputer

Previous article:Analysis of three-phase dual-switch PFC circuit and control strategy in CCM mode
Next article:Design of self-timing circuit based on bit line cyclic charging SRAM mode

Latest Analog Electronics Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号