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

          關 閉

          新聞中心

          EEPW首頁 > 工控自動化 > 設計應用 > 直接測量微處理器總線時鐘的程序

          直接測量微處理器總線時鐘的程序

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

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

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

          只需要寫代碼,首先關中斷和關COP(共有片上處理器)。在總線時鐘初始化程序中,確保將想要使用的I/O初始化為輸出。然后,只跳到toggle clock,輸出總線頻率除10,直到斷電。本設計方案使用HC08版的PB0( 清單1)和HCS08版的PD0(清單2)。通過改變第一條線確定和第二條線選擇位,可以使用任何適合的I/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



          關鍵詞: 頻率 定時 串行 端口

          評論


          相關推薦

          技術(shù)專區(qū)

          關閉
          看屁屁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); })();