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

          關(guān) 閉

          新聞中心

          EEPW首頁 > 工控自動(dòng)化 > 設(shè)計(jì)應(yīng)用 > 直接測量微處理器總線時(shí)鐘的程序

          直接測量微處理器總線時(shí)鐘的程序

          作者: 時(shí)間:2007-10-30 來源:網(wǎng)絡(luò) 收藏
          用單控制環(huán)檢驗(yàn)HC08 SCS08微處理器的總線。

          Freescale公司的HC08和更新的HCS08微處理器系列具有通用外圍模塊。時(shí)鐘發(fā)生器也不例外。其范圍從任意I/O引腳的內(nèi)部時(shí)鐘到外部晶體或晶振。一旦選擇了時(shí)鐘源,可以有多種控制最終總線的選擇。例如,為MC9S08GB微處理器連接一個(gè)32,768Hz的晶體,允許使用FLL(鎖頻環(huán))產(chǎn)生最多18.874 MHz的總線。選擇源、除數(shù)和FLL允許多功能且復(fù)雜的設(shè)置。

          一旦寫入總線時(shí)鐘初始化程序,在繼續(xù)工程其它部分之前,也許想檢驗(yàn)總線是否以期望的速度運(yùn)行。本設(shè)計(jì)方案給出在任意I/O以總線1/9的精確速度輸出方波的程序(清單1和清單2)。僅連接一個(gè)頻率計(jì)數(shù)器到這個(gè)管腳,顯示總線頻率。只需做的是將小數(shù)點(diǎn)向右移動(dòng)一位。一旦檢驗(yàn)總線速度,可以信賴的寫器、I/O和其他時(shí)鐘有關(guān)的程序。

          只需要寫代碼,首先關(guān)中斷和關(guān)COP(共有片上處理器)。在總線時(shí)鐘初始化程序中,確保將想要使用的I/O初始化為輸出。然后,只跳到toggle clock,輸出總線頻率除10,直到斷電。本設(shè)計(jì)方案使用HC08版的PB0( 清單1)和HCS08版的PD0(清單2)。通過改變第一條線確定和第二條線選擇位,可以使用任何適合的I/O端口。本設(shè)計(jì)方案也命名了老符號(hào)PB的端口,替代如今常用的PTB。

          英文原文:

          Routines directly measure microcontroller-bus clock

          You can verify the bus frequency of the HC08 SCS08 microcontroller with simple control loops.

          Kerry Erendson, Bulova Technologies; Edited by Charles H Small and Fran Granville -- EDN, 10/25/2007

          The Freescale HC08 and newer HCS08 microcontroller families have versatile peripheral modules. Their clock generators are no exceptions. They range from the internal clock, which frees I/O pins, to external crystals or oscillators. Once you select the timing source, you have many options for controlling the final bus frequency. For instance, connecting a 32,768-Hz crystal to an MC9S08GB microcontroller allows you to use the FLL (frequency-locked loop) to generate many bus frequencies as high as 18.874 MHz. Selecting the source, the divisors, and the FLL settings allows versatility but also can get complicated.

          Once you write the bus-clock-initialization routine, you may want to verify that the bus is running at the speed you intend before moving on to the rest of the project. This Design Idea presents routines that output a square wave at exactly one-tenth the bus speed on any I/O port (Listing 1 and Listing 2). Just connect a frequency counter to this pin, and it will display your bus frequency. All you have to do is move the decimal point one place to the right. Once you verify the bus speed, you can confidently write the timer, serial-I/O, and other clock-dependent routines.

          You need to write code only to first disable interrupts and disable the COP (common on-chip processor). In your bus-clock-initialization routine, be sure to initialize the I/O port you want to use as an output. Then, just jump to the toggle clock, which outputs the bus frequency divided by 10 until power-down. This Design Idea uses PB0 in the HC08 version (Listing 1) and PD0 in the HCS08 version (Listing 2). You can use any available I/O port by altering the first line to identify the port and the second line to choose a bit. Also, this Design Idea names ports with the older notation PB, instead of today’s more fashionable PTB.

          英文原文地址:http://www.edn.com/article/CA6491147.html



          關(guān)鍵詞: 頻率 定時(shí) 串行 端口

          評(píng)論


          相關(guān)推薦

          技術(shù)專區(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); })();