<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁(yè) > 模擬技術(shù) > 設(shè)計(jì)應(yīng)用 > 找出微處理器ADC電壓的十六進(jìn)制編碼值

          找出微處理器ADC電壓的十六進(jìn)制編碼值

          作者: 時(shí)間:2012-07-05 來(lái)源:網(wǎng)絡(luò) 收藏

          這種設(shè)計(jì)方案針對(duì)低檔八管腳flash存儲(chǔ)的8位,例如Freescale的MC68HC908QT4A,但是它也同樣適用于任何一款擁有模塊的8位。在芯片內(nèi),轉(zhuǎn)換輸入的模擬成數(shù)字信號(hào)格式。數(shù)字信號(hào)格式為8位的十六進(jìn)制值,如$00。端口采集輸入模擬信號(hào)范圍從VSS對(duì)應(yīng)的 $00到VDD對(duì)應(yīng)的$FF?;谶@些十六進(jìn)制,在VSS和VDD之間的輸入呈現(xiàn)出總共256個(gè)電平的線性變換。換句話說(shuō),輸入越高,十六進(jìn)制值就越大。

          本文引用地址:http://www.ex-cimer.com/article/186147.htm

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

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

            編者按:

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

          英文原文:

            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.



          關(guān)鍵詞: ADC 微處理器 電壓 編碼

          評(píng)論


          相關(guān)推薦

          技術(shù)專(zhuān)區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();