Hi Byeongjin,
Yes, you can use such construction. That is simplest method.
It works correctly on my side. I created new PE project with ADC and I placed MY_Function() code at start of Events.c file.
Could you please let mi know which compiler error you got?
Note: If this should be time critical task, there are two unwanted function calls (The AD1_Interrupt calls AD1_OnEnd() which calls MY_Function()) which will degrade execution time by stacking/unstacking.
I would like to recommend taking PE code just like inspiration and wrote ADC interrupt routine manually.
You may also inspire at our NXP official example codes:
3-Phase Hall Sensor BLDC S12ZVM Application – six step driving
http://www.nxp.com/docs/en/user-guide/MTRCKTSBNZVMHQSG.pdf
http://www.nxp.com/docs/en/application-note/AN4718.pdf
http://www.nxp.com/docs/en/application-note-software/AN4718SW.zip
3-Phase Sensorless BLDC S12ZVM Application – six step driving
http://www.nxp.com/docs/en/user-guide/MTRCKTSBNZVM128QSG.pdf
http://www.nxp.com/docs/en/application-note/AN4704.pdf
http://www.nxp.com/downloads/en/board-support-packages/MTRCKTSBNZVM128_SW.exe
3-phase Sensorless Dual-Shunt PMSM S12ZVM Application – FOC driving
http://www.nxp.com/docs/en/user-guide/MTRCKTSPNZVM128QSG.pdf
http://www.nxp.com/docs/en/application-note/AN5135.pdf
http://www.nxp.com/downloads/en/evaluation-development-boards-systems/MTRCKTSPNZVM128_SW.exe
3-phase Sensorless Single-Shunt PMSM S12ZVM Application – FOC driving
http://www.nxp.com/docs/en/application-note/AN5327.pdf
http://www.nxp.com/assets/documents/data/en/user-guides/AN5327-QSG.pdf
Note: please be aware that there is still typo error in this document (already reported) – the jumpers J57 and J60 should be in position 2-3.
http://www.nxp.com/docs/en/application-note-software/AN5327SW.zip
Note: We should avoid using float type since MCU do not have hardware support for that. The software emulation takes too long.
Note: The computation window may be extended by PMFFQCA_LDFQA[3:0] bit configuration. This field selects the PWM load frequency – Every 1..16 PWM opportunities.
I hope it helps you.
Have a great day,
Radek
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------