Can someone give me a sample code for writing an ISR for MPC56xx family in Codewarrior 5.9.0? I want to write ISRs for the timer and ADC.
Thanks
Hi Cmux,
There are some ISR examples available directly in CodeWarrior for MPC55xx/56xx v2.9 (both HW/SW mode).
Please see the directory below:
<CW for MPC55xx and MPC56xx 2.9>\(CodeWarrior_Examples)\your_derivative\INTC-HWvector-VLE
<CW for MPC55xx and MPC56xx 2.9>\(CodeWarrior_Examples)\your_derivative\INTC-SWvector-VLE
The project generated by the project wizard initializes INTC controller into SW mode by default.
And uses specific routine to initialize vector table ( INTC_InstallINTCInterruptHandler() ) in contrast to the examples above.
Stanish
Hi Stanish,
Thanks for your reply. I picked up the example code (SW mode) and made changes to it to accommodate my code. I am able to run the PIT ISR but when I configure the ADC for interrupts I do not get any interrupts. I have added the ADC ISR function to the Interrupt Vector Table in IntclsrVectors.c and my ADC init function is the following
void initADC(void) {
ADC.MCR.R = 0x00000000; /* Initialize ADC one shot mode*/
ADC.NCMR[0].R = 0x00000001; /* Select ANP0 input for normal conversion */
ADC.CTR[0].R = 0x00008606; /* Conversion times for 32MHz ADClock */
ADC.IMR.R = 0x00000002; /* ADC End of Conversion interrupt enabled */
ADC.CIMR[0].R = 0x00000001; /* End of conversion interrupt enabled for channel 0 - Camera */
INTC.PSR[62].R = 0x02; /* ADC EOC interrupt vector with priority 2 */
}
I am using ANS0 as my ADC channel. Is there anything I am missing in the initialization?
--
Cmux