Timing Peripheral

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Timing Peripheral

354 Views
marialopez
Contributor I

Hi! I am trying to learn how to use the HCS08 microprocessor on my own. I have seen this cool project online, but I haven't been able to solve it. Can anyone help me out? I will love to know the solution for it.   You can assume the bus clock is 4.19 MHz (The actual bus clock frequency may be slightly different on your board due to normal drift; you may need to do a small adjustment in your program to compensate the drift).  1. Using the DEMO board, write an application that uses the input capture to measure the frequency of a square waveform. The square wave is generated by a Function Generator in the lab. Connect the signal source (Function Generator) to the DEMO board, and demonstrate that you can measure its frequency accurately.  Note (something you also want to learn through this exercise):  1). The regular I/O functions in C (printf, etc.) may not work well with the embedded environment – there is no terminal for you to output your value. You can use a variable to save the period measurement (in number of pre-scaled bus clock cycles), and show the measurement using CodeWarrior’s debugger via its variable pane.  2). You only need to show the measurement through a variable value in clock cycles – no conversion from clock cycle to period (or frequency) is required. However, in order to generate a reliable output, you need to save a number of measured values – using a circular buffer, for example – and calculate the average. Remember that dividing (for the averaging operation) is not recommended for embedded operations. You can do shifting instead of dividing, as long as the number of value to be averaged is a power of 2. In addition, you want to keep the ISR very efficient, which means you want to keep the averaging operation outside the ISR.T

Labels (1)
Tags (2)
0 Kudos
Reply
0 Replies