《電子技術應用》
您所在的位置:首頁 > 模擬設計 > 設計應用 > 找出微處理器ADC電壓的十六進制編碼值
找出微處理器ADC電壓的十六進制編碼值
摘要: 用一種簡單的公式來計算ADC輸出的十六進制值,簡化8位微處理器的設計。
Abstract:
Key words :

  這種設計方案針對低檔八管腳flash存儲的8位微處理器,例如Freescale的MC68HC908QT4A,但是它也同樣適用于任何一款擁有ADC模塊的8位微處理器。在芯片內,ADC轉換輸入的模擬電壓成數字信號格式。數字信號格式為8位的十六進制編碼值,如$00。微處理器從ADC端口采集輸入模擬信號范圍從VSS對應的 $00到VDD對應的$FF。基于這些十六進制編碼,在VSS和VDD之間的輸入電壓呈現出總共256個電平的線性變換。換句話說,輸入電壓越高,十六進制編碼值就越大。

  最困難的地方在于寫匯編代碼實現算法的程序員必須知道不同輸入模擬電平(例如1.6V)對應什么十六進制編碼值。涉及到微處理器規格,甚至聯系生產廠商也不能給出滿意的答案。

  然而,本文提出解決這個問題的方案。假定微處理器工作電源電壓為VDD,應用下面這個簡單公式得到十六進制編碼值:VIN/(VDD/255)=result value="hex" code(見編者按)。注意,在更高的十六進制編碼轉換精度之前,必須保證轉換出的十六進制值能夠覆蓋整個模擬信號范圍。下面的例子計算表明了使用已知電源電壓5V的微處理器時,測量輸入模擬信號電壓為1.6V的十六進制編碼值:1.6V/(5V/255)=81.6=82,或者$52。

  編者按:

  作者還提供了兩個附件,一個查詢表(PDF格式)和一個Excel格式的表格,讀者可以對照這些附件與公式相互映證。最后,作者還在“反饋環”這篇文章為本篇文章提供了一些注釋。

       英文原文:

  Find hex-code values for microcontroller’s ADC voltages

  Ease 8-bit microcontroller programming with a simple formula to calculate hex values of ADC output.

  Harry Gibbens Jr, Deafworks, Provo, UT; Edited by Charles H Small and Brad Thompson -- EDN, 4/12/2007

  This Design Idea is for low-end, eight-pin, flash-memory, 8-bit microcontrollers, such as the MC68HC908QT4A from Freescale, but it would apply to any 8-bit microcontrollers that use the ADC feature. In a nutshell, the ADC converts an input-analog-voltage level to a digital-signal format. The digital-signal format has an 8-bit hex-code value, such as $00. The microcontroller “sees” the input-analog-voltage level from its ADC ports ranging from $00 at VSS to $FF at VDD. Based on those hex-code values, there are a total of 256 ticks. The input voltages between VSS and VDD represent a straight-line linear conversion. In other words, the higher the input voltage, the higher the hex-code value.

  The difficulty is that a programmer who needs to write assembly code for a programming algorithm must know what the hex-code value is for a different input-analog-voltage level—1.6V, for example. Referring to the microcontroller’s specs and even contacting its manufacturers do not yield satisfactory answers.

  However, this Design Idea presents a solution to the problem. Given the microcontroller’s power operating-voltage source, VDD, use the following simple formula to obtain the hex-code value corresponding to an identified input-analog-voltage level: VIN/(VDD/255)=result value="hex" code (see Editor's note). Note that you must round off the result value to a whole number before converting to a hex-code value for better accuracy. The following sample calculation finds the hex-code value for a measured input-analog-voltage level of 1.6V when using a known microcontroller’s VDD of 5V:1.6V/(5V/255)=81.6=82, or $52

  Editor's Note:

  Correction and addition (4/27/2007): Due to an editing error, we originally printed the formula as "VIN×VIN/(VDD/255)." In addition, the author has provided two attachments, a lookup table (PDF) and an Excel spreadsheet that allows you to interact with the formula. Finally, the author has posted some comments in the "Feedback Loop" section for this article.

此內容為AET網站原創,未經授權禁止轉載。
主站蜘蛛池模板: 国产亚洲婷婷香蕉久久精品| 国内精品久久人妻互换| 久久久无码精品午夜| 欧美乱妇狂野欧美在线视频| 亚洲熟妇无码AV不卡在线播放 | 久久免费公开视频| 校花被折磨阴部流水| 亚洲日本乱码一区二区在线二产线| 男人与禽交的方法| 公的大龟慢慢挺进我的体内视频 | 国产国产人免费人成成免视频| 亚洲欧美自拍明星换脸| 国产精品视频久| 99re这里只有热视频| 天堂资源wwww在线看| jizz.日本| 好男人网官网在线观看| 一级做a爰片性色毛片黄书| 成年人电影在线播放| 久久久久久亚洲精品成人| 日本欧美大码aⅴ在线播放| 久久精品一本到99热免费| 最色网在线观看| 亚州免费一级毛片| 最近日本字幕免费高清| 亚洲人成电影青青在线播放| 欧美成人猛男性色生活| 亚洲日韩欧美综合| 欧美精品香蕉在线观看网| 亚洲精品欧美精品日韩精品| 熟女精品视频一区二区三区| 免费a级毛片在线播放| 粗大黑硬长爽猛欧美视频| 再深点灬舒服灬太大了快点h视频 再深点灬舒服灬太大了添a | а天堂中文地址在线| 嫩小xxxxx性bbbbb孕妇| 一本精品中文字幕在线| 小猪视频免费观看视频下载| 一本久久a久久精品vr综合| 岛国片在线观看| xxxx俄罗斯大白屁股|