The 8-bit MCU PIC16C711 launched by Microchip of the United States is a MCU with a high performance-price ratio. It is low-priced, small in package, uses CMOS technology, has OTP type, and is very convenient to develop. It contains 4 8-bit high-speed A/Ds. After expanding it to 11 bits, the performance-price ratio of the MCU application system can be greatly improved.
1. Hardware Circuit
The schematic diagram of the expansion is shown in Figure 1. Eight precision resistors R of equal value divide the 0-5V reference voltage into eight levels, each with a range of 0.625V. The eight taps are connected to the eight input terminals of the CD4051 eight-to-one analog switch, and the channel selection control terminals C, B, and A are controlled by RB2, RB1, and RB0 of the PIC16C711 microcontroller, respectively. IC2 and IC3 are high input impedance op amps, IC2 forms a follower, and IC3 forms a precision differential amplifier.
2. Working Principle
The 11-bit A/D conversion is achieved by PIC16C711 doing two 8-bit A/D conversions. PIC16C711 has four analog input channels RA0~RA3, which multiplex a sample-and-hold device into the A/D converter. The reference voltage Vref can come from the outside or from the internal VDD. The A/D converter is a successive approximation type, and the conversion result (8 bits) is stored in the ADRES register. Before the A/D conversion, it is necessary to select the appropriate channel and set enough sampling time. The user can control the conversion process by setting the A/D control registers ADCON0 and ADCON1, and the status of the A/D conversion will also be reflected in ADCON0.
First, send the voltage Vi to be converted to the RA0 channel of PIC16C711 for an A/D conversion. According to the digital quantity obtained by the conversion, the software calculates the position of Vi in the 8 gears, and subtracts the starting voltage of the gear where Vi is located from Vi. The difference is amplified by 8 bits to convert it into a 0-5V voltage signal, and then sent to the RA1 channel of PIC16C711 for an A/D conversion. The digital quantity obtained is the lower 8 bits of the 11-bit AD conversion, and the gear position CBA is the upper 3 bits, thus realizing 11-bit A/D conversion.
An example is as follows: Assuming the input voltage Vi is 3V, the program controls the RA0 channel of PIC16C711 to perform the first A/D conversion, and the result is 153, that is, 3/5×255=153, corresponding to the 8-bit digital quantity 10011001. Mask the lower 5 bits to get 10000000, and shift right 5 times to get 00000100. At this time, the lower 3 bits correspond to the gear position when Vi=3V voltage, that is, the 4th gear, CBA=100. The program outputs this gear position from RB2, RB1, and RB0 as the channel selection of the 8-to-one analog switch, so that CD4051 outputs 2.5V, that is, 5/8×4=2.5V. This voltage is followed by the IC2 op amp and then differentially amplified by IC3. When designing, adjust the resistance values of R11, R12, R13 and R14 to make the amplification factor 8 bits, and the amplifier IC3 outputs Vo = 8 (Vi-2.5) = 8 (3-2.5) = 4.0 V. Select RA1 channel for the second A/D conversion, and the result is 11001100, which is the lower 8 bits of the 11-bit A/D conversion result. The gear position 100 is the upper 3 bits of the 11-bit A/D conversion, and the result of the 11-bit A/D conversion is 10011001100.
III. Procedure
The following is a program segment that uses the PIC16C711 instruction system to complete an 11-bit A/D conversion.
BSF STATUS, RP0; Select page 1
MOVLW 00000010B; RA0 and RA1 are analog channels
MOVWF ADCON1 ; internal reference voltage
BCF STATUS, RP0; Select page 0
MOVLW 11000001B ; Select RA0 channel and internal clock
MOVWF ADCON0
MOVLW .125 ; Delay 125μs, wait for input
CALL WAIT ; stable
BSF ADCON0, GO; Start A/D
LOOP BTFSC ADCON0, GO; Determine whether A/D is completed
GOTO LOOP
MOVF ADRES, W; get the conversion result
ANDLW 0E0 ; shield the lower 5 bits
MOVWF D1 ; store in D1
BCF STATUS,C
RRF D1,1; shift right 5 times
RRF D1,1
RRF D1,1
RRF D1,1
RRF D1,1
MOVF D1,W
MOVWF PORTB ; gear output
MOVLW 11001001B ;Select RA1 channel
MOVWF ADCON0
MOVLW .60 ; Delay 60μs
CALL WAIT
BSF ADCON0, GO; Start A/D
LOOP1 BTFSC ADCON0, GO; Determine whether A/D is completed
GOTO LOOP1
MOVF ADRES, W; A/D conversion result is stored in D0
MOVWF D0
WAIT MOVWF TEMP ; Delay subroutine
NEXT DECFSZ TEMP,1
GOTO NEXT
RETURN
The 11-bit A/D conversion speed realized by this method is fast. PIC16C711 is basically single-cycle instruction. At 4MHz oscillation frequency, the instruction cycle is 1μs, the shortest time for one A/D conversion is 20μs; two A/D conversions are 40μs; two op amp conversion time is 20μs×2=40μs. The total conversion time is hundreds of μs.
The method introduced in this paper has a simple circuit, fast speed and convenient debugging. It has been used in the single-chip microcomputer resistance furnace temperature automatic control system developed by us and achieved the expected effect. It can be used for other single-chip microcomputers with 8-bit and 10-bit A/D with slight modifications, and has promotion value.
Previous article:Design of ink fountain operating table system based on PIC single chip microcomputer
Next article:Research on embedded motor controller based on PIC chip
Recommended ReadingLatest update time:2024-11-16 19:33
- Popular Resources
- Popular amplifiers
- A Complete Illustrated Guide to Operational Amplifier Applications (Written by Wang Zhenhong)
- MCU C language programming and Proteus simulation technology (Xu Aijun)
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
- Single chip microcomputer control technology (Li Shuping, Wang Yan, Zhu Yu, Zhang Xiaoyun)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Develop and study Hongmeng system-data collection
- Why can't CCS5.5 be installed?
- [National Technology N32G457 Review] DHT22 temperature and humidity detection
- What is the relationship between MCIMX6Y2CVM05AB and IMX6ULL?
- MSP430 FRAM Microcontrollers Enable Energy Harvesting
- Lesson 3: Exploring the Cellular Communication Module OpenCPU
- MSP-EXP430F5529LPPWM library function + clock configuration
- [Raspberry Pi 4B Review] Raspberry Pi 4 IP address setting, source replacement, adding power button and heat dissipation.
- Design of ESD protection structure for CMOS circuits
- AD sampling input problem?