Interrupt Handlers . . . GOTCHA!
I wasn't able to get my C routine to run as an Interrupt Handler even if I used this driver library routine: ADCIntRegister(ADC_BASE,3,ADCIntHandler);
When I looked at some of the example programs, the interrupt handlers worked and they didn't use ADCIntRegister(). I realized you need to setup your own vectors in the Startup.s file.
For Example, in my main file:
//************************************************* // // The interrupt handler for the ADC interrupt. // //************************************************* void ADCIntHandler(void) { unsigned long ulData;
// // Clear the ADC interrupt. // ADCIntClear(ADC_BASE, 3);
// // Read the data from the ADC sequence 3 // ADCSequenceDataGet(ADC_BASE, 3, &ulData);
// // Rest of your code in here // }
Now change this in your Startup.s file:
;************************************************* ; ; The vector table. ; ;************************************************* Vectors
DCD IntDefaultHandler ; ADC Sequence 0 DCD IntDefaultHandler ; ADC Sequence 1 DCD IntDefaultHandler ; ADC Sequence 2 EXTERN ADCIntHandler ; VERY important! DCD ADCIntHandler ; ADC Sequence 3
Make sure you enable ALL your interrupts and you should be on your way! Hope this helps. -Ron
login or register to reply
|