Hi Since I have been asked to develop code to measure the frequency using XC161 microcontroller. Frankly I don't have any idea of implementing it. However so far I have used the ADC to sample the sine wave of low frequency. Should I use compare and capture module in order to detect the rising edge? (Unless Im talking ***) Your help would be greatly appreicated. AJ
Hi Chris Thank you for dropping some hints. I am now famaliar with DAVE software and it is quite useful. Basically my signal (sine wave) is connected to AN channel 1 so that my microcontroller sample data 25us. This is where I am currently struck at the moment. Frequency measurement is completely new subject to me. In the meantime Im still learning to use XC161's various modules. I admit it is the powerful microcontroller that I have ever worked with. I am still thinking of the suitable method to measure the frequency at the moment. AJ
forget the a/d stuff, just (if needed) square the pulse and feed it to a timer if fast, an interrupt of slow. Erik
What is the expected frequency range that you are trying to measure? How accurate do you have to be with the measurement? AN1 is not connected to an alternate function so are you thinking of a purely software method to do it? From your hardware is it possible to connect it in parallel (or buffered) to another port pin of the XC161?