Timing Design and Simulation of Analog Switch Based on Single Chip Microcomputer

Publisher:丝语轻风Latest update time:2013-02-16 Source: dzscKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
     With the rapid development of modern industry, real-time monitoring of working parameters is becoming more and more important. Parameter monitoring is divided into two categories: electrical quantity and non-electrical quantity. For the measurement of non-electrical quantity parameters, the success of the measurement mainly depends on the quality of the sensor and the extraction of the signal. Since the capacitive sensor has the characteristics of simple structure, low power consumption, large measurement range, good stability, high sensitivity, long service life and non-contact measurement, it is very suitable for long-term use in harsh environments such as high humidity, high dust, strong radiation and ultra-low temperature. Therefore, for some slow-changing or tiny physical objects, it is more appropriate to use capacitive sensors for measurement.

     At present, the main method used to measure microcapacitance is the AC method. Its measurement principle is to continuously charge and discharge the measured capacitance through the excitation signal to form a voltage or current signal proportional to the measured capacitance, thereby measuring the measured capacitance value. The signal measured by this method has pulsating noise, and its pulsating component needs to be filtered out by a filter, but the introduction of the filter will reduce the speed of signal acquisition of the measurement circuit. Therefore, this paper designs a microcapacitance measurement circuit based on the charge amplification principle. The analog switch used in this circuit has a charge injection effect, which affects the resolution of the circuit. In order to solve this problem, this paper starts with the charge injection effect in the microcapacitance measurement circuit, analyzes the charge injection effect of the analog switch, designs the switch timing in combination with the single-chip microcomputer, and simulates the circuit designed based on Proteus and Keil software to verify the rationality of the design.

  1 Charge injection effect in microcapacitance measurement circuit

  The micro-capacitance measurement circuit based on the charge amplification principle is shown in Figure 1.

Microcapacitance measurement circuit based on charge amplification principle

Figure 1 Microcapacitance measurement circuit based on charge amplification principle

  In the figure, Vin is the excitation voltage source for charging and discharging, CX is the capacitance between the two plates of the sensor, i.e. the capacitance to be measured; S1~S5 are analog switches; op amp A1, capacitor Cf, resistor Rf and switch S3 constitute a charge amplifier; switches S4 and S5 and op amps A2 and A3 constitute two sample-and-hold devices, and A4 is an instrument amplifier. The analog switch is basically composed of an NMOS tube and a PMOS tube in parallel. It is a tri-stable circuit that can determine the state of the input and output terminals according to the level of the strobe terminal. When the strobe terminal is in the strobe state, the state of the output terminal depends on the state of the input terminal; when the strobe terminal is in the cut-off state, the output terminal is in a high-impedance state regardless of the input terminal level. [page]

    The charge injection effect of the analog switch is the main factor affecting the resolution of the circuit. The charge injection effect mechanism has two main aspects: one is caused by the channel charge, as shown in Figure 2(a). According to the principle of MOS devices, when a MOS tube is in the on state, the inversion layer of the SiO2-Si interface stores a certain amount of charge. When the switch is turned off, the charge flows out through the source and drain ends and flows into the measurement circuit; the other is caused by the charge stored in the parasitic capacitance between the gate source and the gate drain being released and flowing into the measurement circuit [3-4], as shown in Figure 2(b). The error caused by the charge injection effect is much larger than the value of the measured CX, causing the charge injection effect.

2 Analysis of Charge Injection Effect of Switch
    The electronic switch control timing design diagram is shown in Figure 3.

    First, disconnect S3, and the circuit is only affected by the charge injection effect of S3. When switch S3 is disconnected, due to the charge injection effect, the charge will flow to the output and inverting input of A1. The charge flowing to the output of A1 has little effect, causing only a momentary slight distortion of the output waveform, while the charge flowing to the inverting input of A1 affects the measurement result, but A4 adopts a differential design to better solve this part of the impact. [page]
    Charge injection effect on switches S1 and S2. As shown in Figure 3, S2 is turned off later than S3, and S1 is turned off later than S2. The charge injection effect when S2 is disconnected causes a small waveform distortion at point V1. When S1 is turned off, despite the charge injection effect of S2, V1 is set to the input voltage Vin. Therefore, the voltage on the measured capacitor Cx is not affected by the charge injection effect of S2; when S1 is disconnected, the injected charge will flow to the ground along the closed switch S2, and S1 will not affect the measured capacitor Cx. Therefore, S1 and S2 have basically no effect on the output.
 The charge injection effect on switches S4 and S5. When S4 and S5 are disconnected, the charge injection effect will cause a slight distortion in the output waveforms of A2 and A3, but it is small relative to the output value and can be ignored. In addition, the differential input structure of A4 will cancel out the charge injection effects of S4 and S5, so the charge injection effect of S4 and S5 will not affect the final output Vo.
    From the above analysis, it can be seen that the charge injection effect introduced when it is turned off is solved by reasonably designing the analog switch control timing.
3.1
Introduction to Keil C51
 Keil is a microcontroller compiler developed by Keil, Germany. Keil C51 is currently the most popular 51 microcontroller development tool. Keil's compiler now has versions that support classic 80C51 and 80C51 derivatives. The new version μVision2 seamlessly combines the analog debugger dScope used by μVision1 with the integrated development environment, with a more friendly interface, easier to use, and supports more microcontrollers. For users who use C language for microcontroller development, Keil C51 has become an essential development tool.
    Keil C51 software is one of the excellent software for microcontroller application development. Keil C51 provides an integrated development environment IDE (Intergrated Development Environment) Vision, including C51 compiler, macro assembler, connector, library management and a powerful simulation debugger. It supports assembly, PLM language and C language programming, with a friendly interface and is easy to learn and use. In the process of developing application software, editing, compiling, assembling, connecting, debugging and other stages are integrated in one environment. First, write the program with the editor, then call the compiler to compile, and then run it directly after connecting [5,6].
    This software is developed using Keil C51, and the program is highly readable.
3.2 Introduction to Proteus
    The Proteus embedded system simulation and development platform was developed by Labcenter Electronics in the UK. It is currently the most advanced and complete embedded system design and simulation platform in the world. It is currently the only EDA tool that can perform real-time simulation, debugging and testing of various microprocessors. In addition to the same functions as other EDA tools, such as schematic layout, automatic or manual PCB wiring, and circuit simulation, Proteus has the greatest feature that its circuit simulation is interactive. For microprocessor applications, programming can be done directly on a virtual prototype based on the schematic diagram, truly realizing system debugging, testing, and verification without a hardware target prototype, and achieving real-time debugging at the software source code level. If there is display and output, the input and output effects after running can also be seen. With the virtual instruments configured in the system, such as oscilloscopes and logic analyzers, a complete electronic design and development environment has been established. The Proteus product series can simulate microcontroller-based designs together with all peripheral electronic devices and instruments. Users can even use dynamic peripheral models such as LED/LCD, keyboards, RS232 terminals, etc. to interactively simulate the design in real time.
    Proteus is a circuit analysis and physical simulation software that runs on the Windows operating system. It has the characteristics of rich experimental resources, short experimental cycle, low hardware investment, low loss during the experimental process, and a high degree of closeness to the actual design [7-9].
4 Design and simulation of switch timing
    The schematic diagram of switch timing design is shown in Figure 4, in which the 80C51 chip is used, in which pins XTAL1 and XTAL2 are connected to the clock controller, the RST terminal is powered on, and the five output pins P1.0~P1.4 control switches S1, S2, S3, S4 and S5 respectively, and the power supply VCC is a +5 V DC power supply.

4.1 Program Design
    Compile the program shown in Figure 5 on the Keil platform.
    The program code is as follows:
    #include
    #define uchar unsigned char
    #define uint unsigned int
    sbit s1=P1^0; //Control switch 1
    sbit s2=P1^1; //Control switch 2
    sbit s3=P1^2; //Control switch 3
    sbit s4=P1^3; //Control switch 4
    sbit s5=P1^4; //Control switch 5
    bit flag,flag1,flag2,flag3;
    uchar ds,ds1,ds2,ds3;
    uint jishi;
    void Initialization() //Initialization function
        {
        EA=1;
        ET0=1;
    TMOD=0X02; //Timer working mode is 2
    TH0=0x06; //Timing 250 ?滋s
    TL0=0x06;
        TR0=1;
    s1=0;
    s2=1;
    s3=1;
    s4=1;
    s5=1;
    flag1=1; flag2=0; flag3=0;
        }
        void inte() interrupt 1 using 3 //1s interrupt processing function
         {
         if(++jishi==40) //time interval 4000×250 ?滋s=1 s
         {
    jishi=0;
    if(flag1){ds1++;}
    if(flag2){ds2++;}
    if(flag3){ds3++;}
             }
         }
         void main ()
         {
    Initialization();
    while(1)
         {
          if(flag1)
             {
    if(ds1==4){s3=0;}
    if(ds1==11){s5=0;}
    if(ds1==12){s2=0;}
    if(ds1==13){s1=1;}
    if(ds1==20){s4=0;flag1=0;flag2=1;}        
             }
  if(flag2)
             {
    if(ds2==1){s3=1;}
    if(ds2==2){s5=1;}
    if(ds2==9){s2=1;}
    if(ds2==10){s1=0;}
    if(ds2==17){s4=1;flag2=0;flag3=1;ds2=0;}        
             }
          if(flag3)
             {
    if(ds3==7){s3=0;}
    if(ds 3==14){s5=0;}
    if(ds3==15){s2=0;}
    if(ds3==16){s1=1;}
    if(ds3==23){s4=0;flag2=1;flag3=0;ds3=0;}        
             }
         }
     }[page]
4.2 After writing the program code, load the program file into the current project for
    compilation. After the compilation is successful, perform the simulation. Click the Go menu item under the Debug menu to run the program continuously, and then switch to the Proteus interface. You can see that the circuit starts to simulate and run. The result is shown in Figure 6, achieving the expected function.

    By analyzing the simulation results and the real-time operation of the LED, the correctness of the program and peripheral circuit design of the entire system was verified, and the debugging efficiency was improved. The use of this simulation design method can greatly simplify the hardware circuit testing and system debugging process, and the use of this method to successfully develop the system virtual development before actual production can improve development efficiency, reduce development costs, and increase development speed.
References
[1] Bai Guohua. Research and study on capacitance sensor measurement circuit [D]. Taiyuan: North University of China, 2005.
[2] Qiu Guiping. ECT system measurement circuit simulation and data acquisition system design [D]. Harbin: Harbin University of Science and Technology, 2007.
[3] Zhou Lili. Research on MEMS capacitive micro-accelerometer detection circuit [D]. Hefei: University of Science and Technology of China, 2008.
[4] Wang Lei, Wang Baoliang, Ji Haifeng, et al. New weak capacitance measurement circuit of capacitance sensor [J]. Journal of Sensor Technology, 2002 (4): 273-277.
[5] Niu Yuguang. Principle and interface technology of single chip microcomputer [M]. Beijing: Electronic Industry Press, 2008.
[6] Jian Xianzhong, Yu Jing, Xiong Xiaojun, et al. LED dot matrix display system based on 80C51 and KEIL C51 [J]. Chinese Journal of Instrumentation, 2005, 26 (8) Supplement:
315-316.
[7] Wu Fengjie, Xie Chenyue, Xie Bin. Application of Proteus and Keil in single-chip microcomputer open experiment [J]. Electronic Measurement Technology, 2008, 31(6): 100-104.
[8] Liu Yingqun. Integration of Proteus and Keil to build single-chip microcomputer virtual laboratory [J]. China Modern Education Equipment, 2005(8): 11-13.
[9] Cao Jianshu, Zeng Linchun, Xia Yunsheng. Simulation of virtual waveform generator based on Proteus and Keil interface [J]. Journal of Beijing Institute of Petrochemical Technology, 2008, 16(3): 9-11.

Keywords:MCU Reference address:Timing Design and Simulation of Analog Switch Based on Single Chip Microcomputer

Previous article:Working Principle of DDS Chip AD9850 and Analysis of Its Interface with Single Chip Microcomputer
Next article:Design and implementation of IAP system based on C8051F microcontroller

Recommended ReadingLatest update time:2024-11-16 16:21

51 MCU nRF24L01 wireless module test key light remote control
Let's get to the point. The function of this experiment is to connect a sending module (the big board) to 4 buttons. By pressing these 4 different buttons to send 4 different commands, the receiving end (the small board) can be controlled to light up 4 different lights. _ ! First is the sending module: 1 void
[Microcontroller]
51 MCU nRF24L01 wireless module test key light remote control
About MCU Hardware Anti-interference
When developing electronic products with processors, how to improve anti-interference ability and electromagnetic compatibility? 1. The following systems should pay special attention to anti-electromagnetic interference: 1. Systems with extremely high microcontroller clock frequencies and extremely fast
[Microcontroller]
51 MCU external interrupt 0 controls the LED on and off
Use 51 MCU external interrupt 0 to control LED on and off #include reg52.h. typedef unsigned char u8; typedef unsigned int u16;   sbit key1=P3^2; sbit LED=P2^0;   void delay(u16 i) { while(i--); }   void int0init() { IT0=1; EA=1; EX0=1; }   void main() { int0init(); { while(1) { } } }   void ini
[Microcontroller]
Encrypted data transmission - implementing TEA encryption and decryption algorithm on MCU
When transmitting data, have you ever considered encrypting the data for transmission? If the data to be transmitted is encrypted in the serial port or wireless, wouldn't it increase the security of communication? Commonly used encryption and decryption algorithms such as DES and RSA are difficult to implement due to
[Microcontroller]
A collection of microcontroller design experience and skills (Part 4)
6. DSP of choice for audio and video processing   1 Introduction   DSP (Digital Signal Processing, referred to as DSP) is a unique microprocessor that uses digital signals to process large amounts of information. Its working principle is to receive analog signals, convert them into digital signals of 0 or 1, and the
[Analog Electronics]
A collection of microcontroller design experience and skills (Part 4)
Application solution of portable electrocardiogram monitor based on C8051F020 microcontroller
At present, ECG monitoring systems, which mainly collect ECG signals, analyze and diagnose them, have been widely used and play a great role in the prevention and diagnosis of cardiac system diseases. However, this type of ECG monitor can only be used when the patient is at rest or under special circumstances. The req
[Microcontroller]
Application solution of portable electrocardiogram monitor based on C8051F020 microcontroller
Features and advantages of avr microcontroller
AVR microcontroller is an enhanced RISC (Reduced Instruction Set CPU) high-speed 8-bit microcontroller with built-in Flash developed by ATMEL in 1997. AVR microcontrollers can be widely used in various fields such as computer peripherals, industrial real-time control, instrumentation, communication equipment, and h
[Microcontroller]
Infineon Technologies Launches New High-Performance Microcontroller AURIX™ TC4Dx
Infineon Technologies AG, a global semiconductor leader in power systems and the Internet of Things, recently announced the launch of the first product in the latest AURIX™ TC4x series, the AURIX™ TC4Dx microcontroller (MCU). Based on 28nm technology, the AURIX™ TC4Dx provides more powerful performance and
[Network Communication]
Infineon Technologies Launches New High-Performance Microcontroller AURIX™ TC4Dx
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号