Design of Capacitance Test Circuit Based on PlCl6LF874 Single Chip Microcomputer

Publisher:数字思维Latest update time:2011-09-08 Keywords:PlCl6LF874 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
This article uses the PICl6LF874 microcontroller from the American Micmchip company. The microcontroller adopts RISC reduced instruction set, Harvard bus structure, and pipeline instruction method. It has the characteristics of strong anti-interference ability, low power consumption, high performance, and low price.

1 PIC16LF874 microcontroller

The PICl6 series of single-chip microcomputers adopts a reduced instruction set computer (RISC) structure, breaking through the natural structural dependence of traditional single-chip microcomputers 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 single-chip microcomputer hardware structure and greatly improved the efficiency of system operation. In addition, in view of the characteristics of single-chip microcomputer applications, the PIC single-chip microcomputer also has some unique features in terms of power consumption, driving capability, peripheral module design, etc., making the PIC a convenient, practical and cost-effective single-chip microcomputer.

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 the 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 Working Principle of Capacitance Measurement Module

The overall design principle block diagram of the capacitance measurement module is shown in Figure 1, which includes a power management circuit, a PIC16LF874 microcontroller, a capacitive sensor, a signal conditioning circuit, a PS021 capacitance-to-digital converter, and an interface circuit connected to a 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 single-chip microcomputer with simple structure, powerful functions and compatible with SPI serial interface is selected. Since the peripheral interface of PS02l is SPI, the single-chip microcomputer can control the operation of PS02l very well, and the measurement data can be sent to the host computer through the USART serial interface. The connection of the single-chip microcomputer 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.

Measurement results

5 Experiments and Results

Use the above software to measure. Before measuring, 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% (the limit value of PS02l). 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. The discharge resistor Rdis is closely related to the discharge time, the discharge time τ=0.7R(C+20 pF), and the time constant τ ranges from 2 to 10μs (5μs is recommended). Calculate the discharge resistor value 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.

Measured capacitance value

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.

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

Previous article:PIC single chip conversion and programming steps
Next article:Hands-free passive keyless access control system based on PIC16F639 microcontroller

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号