Hi all, does anyone knows an application note with a demo code to understand better the functioning of the S12XE Capture Module? I need to sample an input from an encoder and to calculate its frequency and I would't like to do it with a polling method.
I'm just reading the user manual, but an example would be a great help to quickly reach the goal.
Many thanks, Emanuele.
Hi,
I think polling mode is not suitable. Better is to use interrupt mode when you measure time between selected type of edges. An attached example present measurement of period (frequency) between two rising edges. Simple adjustment can be done to measure a period between each type of edges. Just calculation logic has to consider what represents a measured frequency. As an example I can mention principle when frequency of the measured system is not given by frequency between two edges but for example by duty cycle in some period. In this case we have to measure period between two given edges. For example if the frequency is given by period between two edges in given order then you have to measure only this period. If it is given by dutycycle within undefined period then you have to measure period between all edges and create calculation logic.
I have also attached a main.c functio for another type of MCU where I adjuste calculation method. It fixes some problems in method used in the XEP frequency measurement example.
Unfortunately, there is no application note published. I believe the examples are readable and easy to understand.
Some more examples you can find at: https://community.nxp.com/docs/DOC-329209
Best regards,
Ladislav
Hi lama, many thanks for your explanation and attachments. I had a typo writing 'would't' instead of 'wouldn't' and I agree with you that polling method is not a good solution especially if input signals are fast. I was just searching something like your example because the explanation on the user manual is not so easy to understand and no application note/code is available on the web.
Many thanks again and best regards, Emanuele.