Many electronic devices require user input for setting the application properties. Typical input devices include pushbuttons, potentiometers, and touchscreens. To minimize overall project cost, you may have to select low-range microcontrollers, FPGAs (field-programmable gate arrays), or PLDs (programmable-logic devices). These devices don’t provide a wide range of peripherals and often lack analog-to-digital-conversion capability, which can prove annoying when trying to acquire user input. This Design Idea describes a method for adding a low-end ADC to a single programmable-logic I/O pin. The circuit charges a capacitor through a resistor while measuring the time to charge the capacitor to a certain voltage.

Before each measurement, the capacitor discharges to 0V. A single I/O pin can perform both the discharging and the timing. For an FPGA or a PLD, you can perform a discharge by setting the I/O as an output pin and forcing a zero at that pin. You can charge the capacitor by setting the I/O as an input pin, which gives it a high impedance. The capacitor charges through the potentiometer (Figure 1).

Meanwhile, a counter starts, and the CPLD monitors the input voltage. As soon as the capacitor voltage reaches the threshold, the counter stops at a value that is a measure of the charging time. The charging time or counter value relates to the clock frequency, the value of the resistor, the value of the capacitor, and the input threshold voltage:

If you assume that the capacitor value, the input threshold voltage, and the clock frequency remain fairly constant over the operating range, the charging time is linearly dependent on the value of the resistor. If you replace the resistor with a potentiometer, a counter value depends on the potentiometer position. The application uses a Xilinx XC9500 XL CPLD (Figure 2).

The I/O, which VHDL (very-high-speed-IC hardware-description language) declares as a tristate buffer, first shorts the capacitor. Hardware limits the output short-circuit current of the I/O pins to ±10 mA, so the capacitor’s shorting should last long enough to guarantee a full discharge. You can calculate the minimum shorting time using the capacitor value, short-circuit current, and discharge voltage, assuming that the threshold voltage must discharge from the capacitor:

The discharge delay can be realized with a small counter. After the discharge time, the I/O pin acts as an input, which causes the capacitor to charge through a pullup potentiometer. Meanwhile, the internal counter starts. When the capacitor voltage reaches the input threshold voltage, the counter stops. Eight LEDs show the 8-bit value. In this application, a 10-kΩ potentiometer in series with a 1-kΩ resistor charges a 22-nF capacitor. The input clock of the PLD is 1.8432 MHz. The input threshold is 1.5V at a supply of 3.3V. This arrangement allows a measurement range between a counter value of 25 and 270, equivalent to a resolution of almost 8 bits.

Figure 3 shows the capacitor charging/discharging waveform.

Every IC’s I/O pin has a certain bias sink or source current, causing a voltage drop over the charging resistor. This situation limits the charge voltage to VDD–RCHARGE×IBIAS. In other words, if the charging resistance is too large, the capacitor doesn’t charge above the input-pin threshold voltage, stopping the circuit’s operation. Similar applications for microcontrollers or PLDs (references 1 through 5) include adding multiple inputs to a single I/O pin and using a different pullup-resistor value for each input. By discriminating the charging times for each resistor, the PLD can decide which resistor or combination of resistors the user has actuated.

Another application for microcontrollers is temperature measurement. By replacing the pullup resistor with a PTC (positive-temperature-coefficient) or an NTC (negative-temperature-coefficient) resistor, you can derive the temperature from the charging time after calibration. You can also use these devices to make true analog-to-digital measurements. By replacing the pullup resistor with a voltage-controlled current source, an input-voltage change causes a linear change in the charging time, providing a real analog-to-digital conversion.

References
  1. Eggers, Torsten, and Thomas Schmidt, “AN10187 Low-cost A/D-Conversion with Philips LPC Microcontrollers,” Philips Semiconductors, Oct 4, 2002.

  2. Using an I/O Port Pin as an A/D Converter Input,” Holtek.

  3. AVR400: Low Cost A/D Converter,” Atmel, .

  4. Quiring, Keith, “Implementing An Ultralow-Power Thermostat With Slope A/D Conversion,” Texas Instruments, Jan 2006.

  5. CoolRunner-II Low Cost, Low Power Thermometer for Embedded Designs,” Xilinx, Nov 29, 2004.

ADC for programmable logic uses one capacitor的更多相关文章

  1. FPGA LVDS I/O as an Analog Programmable Comparator

    http://www.eetimes.com/author.asp?section_id=36&doc_id=1320289 Seeing the new ADC IP being bandi ...

  2. DAC Essentials

    http://e2e.ti.com/blogs_/b/analogwire/archive/tags/DAC%2bEssentials DAC Essentials: A new blog serie ...

  3. JTAG 引脚自动识别 JTAG Finder, JTAG Pinout Tool, JTAG Pin Finder, JTAG pinout detector, JTAGULATOR, Easy-JTAG, JTAG Enumeration

    JTAG Finder Figuring out the JTAG Pinouts on a Device is usually the most time-consuming and frustra ...

  4. 中国计算机学会CCF推荐国际学术会议

    中国计算机学会推荐国际学术会议 (计算机系统与高性能计算) 一.A类 序号 会议简称 会议全称 出版社 网址 1 ASPLOS Architectural Support for Programmin ...

  5. 关于CPLD与FPGA的对比分析

    1.PLD/FPGA/CPLD PLD(Programmable Logic Device):可编程逻辑器件,数字集成电路半成品,芯片上按照一定的排列方式集成了大量的门和触发器等基本逻辑元件,使用者按 ...

  6. OrCAD Capture使用记录

    1.安装 ①修改host_ID为主机名称(如果填不对,安装过程会提示你再填一次):其后跟的是机子的MAC地址,用ipconfig /all 可以查看. ②下一行的FLEMlm,后面跟的是文件cdslm ...

  7. 浅谈用ModelSim+Synplify+Quartus来实现Altera FPGA的仿真

    浅谈用ModelSim+Synplify+Quartus来实现Altera FPGA的仿真 工作内容: Mentor公司的ModelSim是业界最优秀的HDL语言仿真软件,它能提供友好的仿真环境,是业 ...

  8. CCF推荐国际学术会议

    类别如下计算机系统与高性能计算,计算机网络,网络与信息安全,软件工程,系统软件与程序设计语言,数据库.数据挖掘与内容检索,计算机科学理论,计算机图形学与多媒体,人工智能与模式识别,人机交互与普适计算, ...

  9. 10 notorious computer virus

    The history of computer virus is the same as computer history. With more and more powerful computers ...

随机推荐

  1. 大数据系列之kafka监控kafkaoffsetmonitor安装

    1.下载kafkaoffsetmonitor的jar包,可以到github搜索kafkaoffsetmonitor,第一个就是,里面可以下载编译好了的包. KafkaOffsetMonitor-ass ...

  2. UVA 1103 How Many O's?

    题目链接:UVA-11038 题意为给定n和m,求n和m之间(包含)的所有数包含的0的个数. 思路是,用cal(x)表示小于等于x的数包含的0的个数.则答案为cal(n)-cal(m-1). 再把求c ...

  3. .NET连接Oracle的方法

    .NET连接Oracle的方法 方式1:直接利用.NET的oracle驱动连接 引用System.data.oracleclient; using System.data.oracleclient; ...

  4. 在ubuntu 上安装pycharm

    1.首先在官网下载pycharm并进行提取,将提取的文件夹放在/usr下面(或者任意位置) 2.然后vi /etc/hosts 编辑 将0.0.0.0 account.jetbrains.com添加到 ...

  5. 在flask中返回requests响应

    在flask服务端,有时候需要使用requests请求其他url,并将响应返回回去.查阅了flask文档,About Responses,可以直接构造响应结果进行返回. If a tuple is r ...

  6. java基础16 捕获、抛出以、自定义异常和 finally 块(以及关键字:throw 、throws)

    1.异常的体系 /* ------|Throwable:所有异常和错误的超类 ----------|Error(错误):错误一般用于jvm或者硬件引发的问题,所以我们一般不会通过代码去处理错误的 -- ...

  7. 正则表达式对IP地址的限制

    正则表达式 ^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[ ...

  8. ~Delphi const 杂谈~

    来自:http://www.cnblogs.com/tibetwolf/articles/1785744.html ------------------------------------------ ...

  9. UAF漏洞学习

    产生原因: UAF漏洞的成因是一块堆内存被释放了之后又被使用.又被使用指的是:指针存在(悬垂指针被引用).这个引用的结果是不可预测的,因为不知道会发生什么.由于大多数的堆内存其实都是C++对象,所以利 ...

  10. [你必须知道的.NET]第十九回:对象创建始末(下)

    本文将介绍以下内容: 对象的创建过程 内存分配分析 内存布局研究 接上回[第十八回:对象创建始末(上)],继续对对象创建话题的讨论>>> 2.2 托管堆的内存分配机制 引用类型的实例 ...