Trying to build a simple A to D application on the FRDM KL25 board. I am using ADC0 attached to pin PTC1. Using Codewarrior 10.3 and as I step through the code it goes directly to a default interrupt handler the moment I step into any command that attempts to initialize an ADC register. For example in the intialization ADC0_CFG1=0x4; will cause an interrupt which has no handler defined so it goes to default. I suspect I am making a simple error.
//Initialize PTC1 as ADC15 A to D
SIM_SCGC5|=SIM_SCGC5_PORTC_MASK; // Turn on clock for port C
// Convert the specific pins to the ADC module ( ADC is default).
PORTC_PCR(1)=PORT_PCR_MUX(0);
ADC0_CFG1=0x4; // 12 bit conversion, single ended, full speed bus clock normal operation <<<interrupt occurs here
ADC0_CFG2=0; <<< or here if I have the above line commented out...
Solved! Go to Solution.
Try this:
SIM_SCGC6 |= SIM_SCGC6_ADC0_MASK;
Jim Donelson wrote:
Try this:
SIM_SCGC6 |= SIM_SCGC6_ADC0_MASK;
That will fix your default_isr issue. The module's Clock Gate control must be enabled in the appropriate SIM_SCGCx register.