Free Print Subscription Printer-friendly version Email to a Friend

Routines directly measure microcontroller-bus clock

( 01 Feb 2008 )
By Kerry Erendson, Bulova Technologies

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.


Click here for Illustrations:


Listing 1, Listing 2

 
Free Print Subscription Printer-friendly version Email to a Friend
Article Rating 
Average Rate: No rating yet
 
Poor Quite Good Good Very Good Excellent
 
 
Related Content 
 
WEBCASTS
 
KNOWLEDGE CENTER
Fairchild Semiconductor :
 
 
Highest Rated  
Feedback Loop  
ADS BY GOOGLE 
 
 
 
ADVERTISEMENT
Press Release 
 
TECHNOLOGY NEWS
 
RESOURCE CENTER
 
 
PRODUCT NEWS
 
FEATURED SPONSORS


 
 
 
DESIGN CENTERS
 
ADVERTISEMENT
     
Reference Designs 
   
     
 
 
 

 
 
RSS
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   

POLL
How do you expect your company to perform this year?
Worse than last year
Same as last year
Better than last year
View results
 
Outlook and Trends 2008


     
     
Power Technology E-newsletter 
Dual-input, Single-output Power Supply Selector Switch Reduces System Size while Improving Integrity EDNA, February 08
Analog Devices completes sale of CPU voltage and PC thermal monitoring business to ON SemiconductorEDNA, January 08
Fairchild’s Green FPS Power Switches Increase Efficiency, Reduce EMI in Power Supply Designs EDNA, December 07
 
Test and Measurement E-newsletter 
Agilent Technologies and Anite Announce Strategic Partnership to Deliver 3GPP LTE Test Solutions for Wireless R&D EDNA, November 07
WiMAX Technology Leaders Aeroflex and Sequans Partner to Speed Product Development and Deployment of WiMAX Test EDNA, October 07
Tektronix’ IMS Solution Proves Successful in Industry Forum Tests EDNA, September 07
 
     
     
 
KNOWLEDGE CENTER
 
Fairchild Semiconductor :
 
Texas Instruments: DaVinci™ Technology
 
Texas Instruments: Safe Bet Series
 
INDUSTRY LINKS
 
Photonics Association (Singapore)
Singapore Industrial Automation Association (SIAA)
Taiwan Semiconductor Industry Association (TSIA)
 
 
 
OUR SPONSORS
 









Texas Instruments: New Technical Video360 Podcast Demonstrates Advantages of DaVinci™ Techonology

 

 
 
ADS BY GOOGLE