CAN I read 100Khz frequency using MC9S12XHZ512 Micro-controller ?
The MCU busclock can work up to 40MHz. You need minimally 2busclocks to recognize edge. So, if I think about 2 clocks for rising edge and 2 clocks for falling edge then maximum frequency you can measure is 40MHz/4 = 10MHz. The issue is how you want to calculate it. Let's consider 100.000kHz frequency of rising edges. In this case you have 10us to process the value which means 400buscycles @ 40MHz busclk.
In dependence on processing time you can:
As an example I have attached two example project for another MCU but the same approach.
BTW; please do not ask me how to do it in Processor Expert. I do not use it.
If you see this answer as correct answer please mark it as correct and helpful to help others to find good answers faster. Thank you in advance.
Best Regards, Ladislav
I would like to add. There are two methods of frequency measurement.
1) Counting of BUSCLK/PRESCALER periods of internal timer between two incoming external pulses. This is suitable for lower frequencies. For higher frequencies it is not suitable because there is to high difference between two measurable frequencies.
The measurement precision is df which can be expressed as: df = BUSCLK / ((n^2 + n) * PRESCALER); n = measured number of TCNT periods
For example: BUSCLK = 16MHz, PRESCALER = 1
2) counting incoming external pulses during defined period. It is clear that this measurement is not suitable for low frequencies which require long test period.
So you have to do some compromise if you want to measure wide frequency range or create more complex solution.
Retrieving data ...