1.ADC:模拟数字转换器(Analog to Digital Converter)

Actually,ADC is analog signal change digital signal. It mean the input is analog signal but output is already become binary code (machine code)

2.ADC in AVR programming

-ADCH:Data high register(数据高位寄存)“output data ”

-ADCL:Data low register(数据低位寄存)“output data ”

-ADMUX(ADC多路选择寄存器)“set data”

-ADCSRA(ADC控制和状态寄存器)“set data”

-ADCW (sent value to data read)“output data ”[data_read=ADCW]

3.calculate the step size for ADC

step size=Vref(depend on your system voltage)/2^n(number of step-number of ADC bit)

For example,

Look below graph:In this graph Vref is 5V,but have different size of bit,so:

Vcc=5V

step size=5V/2^n

4.ADC Conversion Formula ADC (ADC的转换公式)

Dout=Vin/step size

For example:

For an 8 bit ADC,Vref=2.56V.If the analog input is 1.7V.The binary calculator process is:

2.56/2^8=10mV

Dout=1.7/10mV=170

so,170(decimal)-10101010(Binary)

5.ADC major characteristics
● Conversion Time

● Resolution
● Vref
● Parallel vs. serial

● Input channels

6.Internal ADC of ATMega 328

  • 10 bit resolution
  • 6 multiplexed single ended input channels
  • 13-260us conversion Time
  • Up to 76.9KSPS
  • Optional left Adjustment for ADC result readout
  • 3 voltage sources:internal 1.1V,AVcc,AREF
  • Free running or Single Conversion Mode
  • Interrupt on ADC Conversion Complete
  • Sleep Mode Noise Canceler

7.Hardware Consideration

If Vcc=5V,the voltage through Vcc go to two parallel circuits-AVREF and AVCC.

8.Special Function Registers of ADC
ADMUX – ADC Multiplexer Selection Register
:To select the input analog channels, source of clock reference, and result alignment of the ADCL and ADCH register
ADCSRA – ADC Control and Status Register A
:To control the operation of ADC and indicate the status of ADC conversion.
ADCL and ADCH – The ADC Data Register

:To store the ADC conversion output.

9.ADMUX

If I want to set REFS0=1

The code below 

ADMUX=ADMUX|(1<<REFS0);
//REFS1=0,REFS0=1

ADMUX=ADMUX|(1<<REFS1)|(1<<REFS0)

//REFS1=1,REFS0=1


If I want to choose ADLAR=1,

the code is

ADMUX=ADMUX|(1<<ADLAR);

//ADLAR=1

When ADLAR=1,the data start on the right

When ADLAR=0,the data start on the left

^_^写累了,不想写了

ATMega 328 analog interfacing相关推荐

  1. Arduino基础与进阶

    目录: 一.概述 1.关于Arduino 2.Arduino简介 3.Arduino内部结构 二.Arduino编程 1.Arduino开发环境 2.Arduino语言概述 3.Arduino基本函数 ...

  2. 单片机学习笔记(Arduino Uno r3)

    单片机学习笔记(Arduino  Uno r3) Aduino是什么? 分为硬件和软件两个部分,硬件和软件共同组成了Arduino,使用时须将Arduino硬件和软件配合使用 硬件:Arduino系列 ...

  3. 零成本学Arduino单片机之入门

    图1 Arduino单片机的Proteus仿真 我的Arduino博客:http://www.eefocus.com/zhang700309/blog/ 一.前言      Arduino是由Mass ...

  4. GRBL-1:平台搭建

    Grbl是一款针对Arduino/AVR328芯片的嵌入式G代码编译和运动控制器. Grbl是性能高,成本低,基于并口运动控制,用于CNC雕刻.它可以运行在Vanilla Arduino (Duemi ...

  5. ARDUINO多功能灾难现成搜救机器人

    原文发表在ARDUINO社区,现转移到CSDN 原文地址:http://www.arduino.cn/thread-23376-1-1.html 针对矿难.地震等灾难现场的搜救专用机器人,具有越障能力 ...

  6. Arduino Uno基础入门01(认识Arduino)

    1.1什么是Arduino Arduino是2005年诞生于意大利的一种可编程单片机电路板(一般称其为Arduino开发板,如图I-l所示),到现在已经有10多年的历史了.Arduino不同于普通的单 ...

  7. robot pose ekf

    参考链接 github源码 https://github.com/ros-planning/navigation/tree/kinetic-devel/robot_pose_ekf 创客智造教程 ht ...

  8. 3d打印c语言与g代码混合编程,[转载]三轴运动控制器、串口运动控制器、支持G代码、3D打印机、雕刻、源代码开放、...

    串口运动控制器,支持G代码.M代码 3D打印机.雕刻机.激光雕刻.木工雕刻.微型CNC.开源GRBL运动控制平台 电源电压:DC12V-24V CPU:Atmega328P 串口:RS232电平,通信 ...

  9. 基于USBASP给AVR单片机烧写Arduino bootloader和application固件

    基于USBASP给AVR单片机烧写Arduino bootloader和application固件 Arduino 微控制器的数字端口和模拟端口与 ATMEGA 328 芯片引脚的对应关系图如下.其中 ...

最新文章

  1. Postgresql相关数据库、表占用磁盘大小统计
  2. hadoop 提高hdfs删文件效率----hadoop删除文件流程解析
  3. 顺序表-删除所有元素值为x结点(另建表存放+复制到原表)
  4. 《WinForm开发系列之控件篇》Item18 FileSystemWatcher(暂无)
  5. 磁场对于电感路径检测的影响
  6. Apache POI和EasyExcel 第七集:EasyExcel的基本操作,读取和写入Excel,一行足矣
  7. JAVA基础知识(5)
  8. [云炬ThinkPython阅读笔记]2.3 表达式和语句
  9. 前端调试、兼容、适配指南与工具分享
  10. 谷胱甘肽口服、舌下含服、NAC对照实验
  11. 通过一个简单的例子学习Angular Injection Token工作原理
  12. 打开 谷歌浏览器exe_专治各种网银不服:两步开启微软Edge浏览器IE兼容模式
  13. 【VMCloud云平台】SCAP(一)规划
  14. 信息学奥赛C++语言:小青蛙回来了
  15. iOS 原生导航栏 修改导航栏文字颜色 大小
  16. JAVA 多线程 线程间的通讯
  17. 判别式模型 vs. 生成式模型
  18. 一阶电路误差分析_PDE有限差分方法(12)——对流方程数值格式的分析方法
  19. 【运维】在阿里云服务器上给Ubuntu安装桌面系统
  20. 服务器win10系统开机慢,Win10系统更新后开机变得很慢的解决方法

热门文章

  1. tcl43f3390-3d安卓(android)软件,TCL L43F3390A-3D通过U盘安装沙发管家教程
  2. 游戏服务器设计之观察者模式
  3. python123外汇兑换计算器_Python之计算器
  4. 多台电脑共享鼠标键盘软件
  5. Stata12 下载和安装
  6. Jenkins安装与配置及汉化
  7. 我的离职访谈报告——(摘录华为离职员工)
  8. 【NA】基于QR分解的特征值迭代法
  9. 股票价格走势的行业关联性
  10. 备份还原数据数据库(固定IP版)