Hi All,
I was using timer interrupt with PEx, but when I tried to install an isr manually it doesn't work.
That's my code:
void tpm1_interr(void *user_isr_ptr) { Bit2_NegVal(); //Output led TPM1_SC |= 0x10000000; //Clears TOF flag by writing a logical '1' } void Task1_task(uint32_t task_init_data) //Main task { _int_install_isr(LDD_ivIndex_INT_TPM1, tpm1_interr, NULL); TPM1_SC = 0xF; TPM1_CNT = 0x2; TPM1_MOD = 0x0000ffff; TPM1_C0SC = 0x00000050; TPM1_C0V = 0x0000ffff; for(;;) { _time_delay_ticks(300); } }
When I try to play the program the debugger goes at this unhandled exception isr:
PE_ISR(Cpu_Interrupt) { /* This code can be changed using the CPU component property "Build Options / Unhandled int code" */ PE_DEBUGHALT(); }
Why this is happening? My isr_install is wrong?
Thanks,
Original Attachment has been moved to: full-code-(isr-install).zip
Solved! Go to Solution.
HI
Sorry I forgot to add opensda debug support in this project. now I attached the updated version.
Have a great day,
Daniel
Hi
I attached an example to install interrupt handler, for your reference. You can set break point in Task1_task, at the last line, you can get the result, isr_ptr->TICK_COUNT is 200.
This task installs a new ISR to replace the timer ISR., It then waits for some time, finally printing out the number of times the ISR ran.
Have a great day,
Daniel
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Now i can run this on my FRDM, it's working fine!
Thanks a lot, have a nice day.
Wenderson
Hi
I think the vector number (in your code is LDD_ivIndex_INT_TPM1) is not right