How to increase the 8-bit A/D in PIC16C711 to 11-bit

Publisher:pengbinyyyLatest update time:2010-02-09 Source: 机电论文Keywords:A/D Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
At present, the A/D embedded in the microcontroller is generally 8-bit to 10-bit, which is difficult to meet the high-resolution requirements in signal processing applications; and the external high-resolution A/D will significantly increase the cost, because the price of the A/D converter will increase exponentially with the increase of its bit number. This article introduces a method to improve the resolution of the A/D on the PIC16C711 microcontroller chip, increasing the 8-bit A/D on the PIC16C711 chip to 11 bits. This method is also applicable to other microcontrollers in the PIC series.

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.

Keywords:A/D Reference address:How to increase the 8-bit A/D in PIC16C711 to 11-bit

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

9-bit DA converter with added polarity input in 8-bit DAC
9-bit DA converter with added polarity input in 8-bit DAC Function of the circuit If an 8-bit DAC is used for bipolar output, the resolution of non-polar voltage is only 1/128. If the resolution is to be improved, the 8-bit DAC is still used, and only an inverting circuit is added to the output, and the full-sc
[Power Management]
9-bit DA converter with added polarity input in 8-bit DAC
Introduction to Commonly Used D/A Converters and A/D Converters
Introduction to Commonly Used D/A Converters and A/D Converters   Next we introduce other commonly used D/A converters and A/D converters for students’ use in design.   1. DAC0808   Figure 1 shows the circuit structure block diagram of the current-mode D/A converter DAC0808. The D/A converter constructed with de
[Analog Electronics]
Introduction to Commonly Used D/A Converters and A/D Converters
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号