PIC microcontroller mastery_A/D analog-to-digital conversion module details supplement

Publisher:qpb1234Latest update time:2018-06-21 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1.PIC16F876a result register


The 7-bit bit of the ADCON1 status register defines whether the output result is left-aligned or right-aligned. I am confused and don't understand what it is saying. I checked the DataSheet and found the following:


As can be seen from the above diagram, the alignment of the result register is to facilitate us to read the converted data. The diagram is not very detailed, we can take a look at the result register of AD.


The AD result register is 16 bits wide, but six bits are not used, so 10 bits of data are actually read.

2. List of registers related to AD conversion

All registers that control the AD module are shown in the figure below:


AD module basic control registers: ADCON0, ADCON1; mainly manage AD module power-on, clock selection, channel selection, result storage format selection, AD conversion start, etc.

Port configuration register: TRISA, PORTA; mainly defines the analog channel input port and locks the data flow direction (Input=1).

Result saving register.

Related interrupt registers: interrupt master switch, peripheral interrupt control switch, AD interrupt enable, AD interrupt flag;

3. Essentials of AD module design



1. Port configuration:
• Disable pin output driver • Configure pin as analog input pin2
. Configure ADC module:
• Select ADC conversion clock • Configure reference voltage • Select ADC input channel • Select result format • Start ADC module3
. Configure ADC interrupt (can also be polled):
• Clear ADC interrupt flag • Enable ADC interrupt • Enable peripheral interrupt • Enable global interrupt4 
. Wait for required acquisition time5 
. Set GO/DONE to start conversion.
6. Wait for ADC conversion to end by one of the following methods:
• Poll GO/DONE bit • Wait for ADC interrupt (enable interrupt)
7. Read ADC result8
. Clear ADC interrupt flag (if interrupt is enabled, this operation is required).


Reference address:PIC microcontroller mastery_A/D analog-to-digital conversion module details supplement

Previous article:PIC microcontroller watchdog
Next article:PIC microcontroller (PIC16F877A) perpetual calendar (temperature alarm, year, month, day, hour, minute, second, week)

Recommended ReadingLatest update time:2024-11-17 04:26

MAX8900:1.2A Switch-Mode Li+ Charger
The MAX8900_ is a high-frequency, switch-mode charger for single-cell lithium-ion (Li+) or lithium-polymer (Li-Poly) batteries. The device generates up to 1.2A of current to charge the battery from a 3.4V to 6.3V (MAX8900A) or 3.4V to 8.7V (MAX8900B) supply. The 3.25MHz switch-mode charger allows the use of very
[Power Management]
MAX8900:1.2A Switch-Mode Li+ Charger
Anritsu MS46322A vector network tester improves accuracy and measurement repeatability
The MS46322A is a family of economical ShockLine™ vector network testers with a frequency range of 1 MHz - 4/8/14/20/30/40 GHz. It is based on the patented ShockLine VNA chip-level technology, which simplifies the internal architecture of the high-frequency VNA, increases the frequency, reduces the cost of instrument
[Test Measurement]
Q&A: What is an artificial heart assist?
Q: What is an artificial heart? The implantable artificial heart assist device introduced in this article is suitable for patients with severe heart failure whose heart (left ventricle) pumping function is weakened due to myocardial infarction and cardiomyopathy. The artificial heart assist device is suitab
[Medical Electronics]
Q&A: What is an artificial heart assist?
Design of low-cost GPS receiving system based on ATmega16A
  In the industrial application of GPS, the data receiving system is the most basic equipment. At present, the data receiving system has a development trend of increasing intelligence and scalability, which is manifested in the increasingly high performance of the embedded MCU and the increasingly rich peripheral inte
[Microcontroller]
Design of low-cost GPS receiving system based on ATmega16A
Repair case of Rode RS SMF100A signal generator
Fault phenomenon Output level out of tolerance Testing process After testing, it was found that the output level of the instrument was below 3G, around 20G, the tolerance was large, and the amplifier, filter and microwave switch unit was damaged. Repair process Replace damaged components of the amplifier, filter,
[Test Measurement]
Repair case of Rode RS SMF100A signal generator
JAI A/S explains industry trends at VisionCon Shenzhen
JAI A/S explains industry trends at VisionCon Shenzhen Explaining the "Big Trend of Small Machine Vision Cameras" On August 17, 2022, Beijing time, machine vision expert JAI A/S demonstrated its latest industrial camera solutions at the VisionCon vision system design seminar held at the Crowne Plaza Shenzhen Nans
[sensor]
JAI A/S explains industry trends at VisionCon Shenzhen
Samsung Galaxy A20s passes Bluetooth certification, may have multiple versions
According to foreign media 91mobiles, the Samsung Galaxy A20s mobile phone recently passed the Bluetooth Technology Alliance (Bluetooth SIG) certification, with a total of 5 versions. It is understood that the Samsung Galaxy A20s phone has passed the Wi-Fi Alliance certification a few days ago, and then appeared on
[Mobile phone portable]
Samsung Galaxy A20s passes Bluetooth certification, may have multiple versions
China Mobile plans A-share IPO and has completed the guidance filing
On May 26, 2021, the Beijing Regulatory Bureau disclosed that China Mobile Limited (hereinafter referred to as "China Mobile") has signed the "Guidance Agreement on the Initial Public Offering and Listing of RMB Common Stocks (A Shares) between China Mobile Limited (as the guidance target) and China International Capi
[Mobile phone portable]
China Mobile plans A-share IPO and has completed the guidance filing
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号