<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>KL25Z Cortex M0+ interrupts</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/30953/kl25z-cortex-m0-interrupts</link><description> 
Hi, 

 
I&amp;#39;m trying to generate an interrupt with the ADC but I just dont
know how. My ADC is working well but right now im polling it. 

 
I set the NVIC-&amp;gt;ISER[0] =0x00000FFFF in order to make sure that
interruptions are enabled. The AIEN bit is set</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: KL25Z Cortex M0+ interrupts</title><link>https://community.arm.com/thread/120258?ContentTypeID=1</link><pubDate>Tue, 18 Mar 2014 09:15:00 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c3c22c55-d6b2-4760-9fb2-27566bcd4a31</guid><dc:creator>Westonsupermare Pier</dc:creator><description>&lt;p&gt;&lt;p&gt;
When posting source code, please review the posting notes, and use
PRE tags, otherwise all we see is a wall of code.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: KL25Z Cortex M0+ interrupts</title><link>https://community.arm.com/thread/107578?ContentTypeID=1</link><pubDate>Tue, 18 Mar 2014 08:09:36 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:fb697f89-7045-4341-9512-c41d8bd1ee3c</guid><dc:creator>jose Gomez</dc:creator><description>&lt;p&gt;&lt;p&gt;
This Code works in case anyone needs it.&lt;/p&gt;

&lt;p&gt;
#include &amp;lt;MKL25Z4.H&amp;gt;&lt;br /&gt;
#include &amp;quot;Delay.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Ports.h&amp;quot;&lt;/p&gt;

&lt;p&gt;
const uint32_t blue_mask = 1UL &amp;lt;&amp;lt; 1;&lt;br /&gt;
const uint32_t red_mask = 1UL &amp;lt;&amp;lt;18;&lt;br /&gt;
const uint32_t green_mask = 1UL &amp;lt;&amp;lt;19;&lt;/p&gt;

&lt;p&gt;
const uint32_t mini_green = 1UL &amp;lt;&amp;lt;4;&lt;br /&gt;
const uint32_t blue_green = 1UL &amp;lt;&amp;lt;5;&lt;/p&gt;

&lt;p&gt;
unsigned int temp3=0;&lt;/p&gt;

&lt;p&gt;

//----------------------------------------------------------------------------&lt;br /&gt;

//MAIN function&lt;br /&gt;
//----------------------------------------------------------------------------&lt;br /&gt;

int main (void) {&lt;/p&gt;

&lt;p&gt;
unsigned int temp2=0;&lt;/p&gt;

&lt;p&gt;
SystemCoreClockUpdate(); /* Get Core Clock Frequency */
SysTick_Config(SystemCoreClock/1000); /* Generate interrupt each 1 ms
*/&lt;/p&gt;

&lt;p&gt;
/* SIM-&amp;gt;SCGC5 |= (1UL &amp;lt;&amp;lt; 12); Enable Clock to Port D */
// PORTA = 9, PORTB=10, PORTC=11, PORTD=12, PORTD=13 SIM-&amp;gt;SCGC5 |=
(1UL &amp;lt;&amp;lt; 9) | (1UL &amp;lt;&amp;lt; 10) | (1UL &amp;lt;&amp;lt; 12); /* Enable
Clock to Port A &amp;amp; B &amp;amp; D */&lt;/p&gt;

&lt;p&gt;
//***************************************************************
//ADC Configuration //**SCGC6 - System Clock Gating Control Register
6 (SIM_SCGC6) SIM-&amp;gt;SCGC6 = (1UL &amp;lt;&amp;lt; 27); // ADC0 Clock Gate
Control - 1 Clock enabled&lt;/p&gt;

&lt;p&gt;
ADC0-&amp;gt;SC1[0]=0x40; // 6- AIEN=1, 5-DIFF=0, 4-0-ADCH=00000
ADC0-&amp;gt;SC1[1]=0x40; // 6- AIEN=1, 5-DIFF=0, 4-0-ADCH=00000&lt;/p&gt;

&lt;p&gt;
ADC0-&amp;gt;SC2 = 0x00; // ADTRG:0, ACFE:0, ACFGT:0, ACREN:0,
DMAEN:0, REFSEL:00 ADC0-&amp;gt;SC3 = 0x00; //CAL:0, NA:0, NA:0, ADCO:0,
AVGE:0, AVGS:0&lt;/p&gt;

&lt;p&gt;
ADC0-&amp;gt;CFG1 = 0x0C; //ADLPC:0, ADIV:00, ADLSMP:0, MODE:11,
ADICLK:00 ADC0-&amp;gt;CFG2 = 0x00; //MUXSEL:0, ADACKEN:0, ADHSC:0,
ADLSTS:00&lt;/p&gt;

&lt;p&gt;

//********************************************************************&lt;/p&gt;

&lt;p&gt;
//There is a PCR register for each pin of every port
PORTB-&amp;gt;PCR[0] = (1UL &amp;lt;&amp;lt; 8); // Pin PTD1 is GPIO - This is
the blue LED // PORTD-&amp;gt;PCR[1] = (1UL &amp;lt;&amp;lt; 8); // Pin PTD1 is
GPIO - This is the blue LED PORTD-&amp;gt;PCR[4] = (1UL &amp;lt;&amp;lt; 8); //
Pin PTD4 is GPIO - Pin 6 J1 connector PORTB-&amp;gt;PCR[18] = (1UL
&amp;lt;&amp;lt; 8); // Pin PTB18 is GPIO - this is the red LED
PORTB-&amp;gt;PCR[19] = (1UL &amp;lt;&amp;lt; 8); // Pin PTB18 is GPIO - This is
the greel LED //****Prueba1 - Configurar el PTB0 como GPIO&lt;/p&gt;

&lt;p&gt;
PORTA-&amp;gt;PCR [1] = (1UL &amp;lt;&amp;lt; 8); // Pin PTA1 is GPIO - Pin 8
J1 connector PORTA-&amp;gt;PCR [2] = (1UL &amp;lt;&amp;lt; 8); // Pin PTA1 is
GPIO - Pin 8 J1 connector PORTA-&amp;gt;PCR [12] = (1UL &amp;lt;&amp;lt; 8); //
Pin PTA12 is GPIO - Pin 8 J1 connector&lt;/p&gt;

&lt;p&gt;
//Configure pins as outputs (1) //PORTA&lt;/p&gt;

&lt;p&gt;
//PORTB //FPTB-&amp;gt;PDDR = 0X000C0000; /* 0X000C0000 enables PTB18
and PTB19 as Output */ FPTB-&amp;gt;PDDR = (pin_18 | pin_19); //enables
PTB18 and PTB19 as Output&lt;/p&gt;

&lt;p&gt;
//PORTC //No cofiguration will be done by now&lt;/p&gt;

&lt;p&gt;
//PORTD //FPTD-&amp;gt;PDDR = 0X00000002; /* enable PTD1 as Output */
FPTD-&amp;gt;PDDR = (pin_1 | pin_4); // enable PTD1 and PTD4 as
Output&lt;/p&gt;

&lt;p&gt;
//Configure pins as inputs (0) //PORTA FPTA-&amp;gt;PDDR =
0X00000000;//(pin_12 | pin_2 | pin_1); // Configure PTD2 and PTD12 as
inputs&lt;/p&gt;

&lt;p&gt;
//PORTB //No cofiguration will be done by now&lt;/p&gt;

&lt;p&gt;
//PORTC //No cofiguration will be done by now&lt;/p&gt;

&lt;p&gt;
//PORTD //No cofiguration will be done by now&lt;/p&gt;

&lt;p&gt;

//*******************************************************************
//Interrupt configuration
//*******************************************************************
//NVIC-&amp;gt;ISER[0] = 0X00008000; //Configuracion del ADC0 //
NVIC-&amp;gt;ICPR[0] |= (1&amp;lt;&amp;lt;15); //Borra las interrupciones
pendientes del ADC0 // NVIC-&amp;gt;ISER[0] |= (1&amp;lt;&amp;lt;15); //habilita
la interrupcion del ADC0 // NVIC-&amp;gt;IP //ADC0_IRQn = 15, /**&amp;lt;
ADC0 interrupt */ NVIC_ClearPendingIRQ(ADC0_IRQn);
NVIC_EnableIRQ(ADC0_IRQn); //NVIC_SetPriority(ADC0_IRQn,1);&lt;/p&gt;

&lt;p&gt;

//******************************************************************8&lt;/p&gt;

&lt;p&gt;
//Turn off pins FPTA-&amp;gt;PDOR = 0XFFFFFFFF; // Turn off PortA
FPTB-&amp;gt;PDOR = 0XFFFFFFFF; // Turn off PortB FPTD-&amp;gt;PDOR =
0X00000002; // Turn off PortD 1 FPTD-&amp;gt;PDOR = 0XFFFFFFFF; // Turn
off PortD&lt;/p&gt;

&lt;p&gt;
while(1) {&lt;/p&gt;

&lt;p&gt;
// This part should lite as yellow FPTB-&amp;gt;PCOR = 0X000C0000; //
turns on green and red FPTD-&amp;gt;PDOR = 0X00000002; // turns off blue
Delay(1000);&lt;/p&gt;

&lt;p&gt;
ADC0-&amp;gt;SC1[0]=0x48; // 6- AIEN=1, 5-DIFF=0, 4-0-ADCH=01000&lt;/p&gt;

&lt;p&gt;
// This part should lite as blue FPTD-&amp;gt;PCOR = 0X00000002; //
turns on blue FPTB-&amp;gt;PDOR = 0X000C0000; // turns off red and green
Delay(1000);&lt;/p&gt;

&lt;p&gt;
FPTD-&amp;gt;PCOR = 0X00000002; // turns on blue FPTB-&amp;gt;PDOR =
0X000C0000; // turns off red and green Delay(1000);&lt;/p&gt;

&lt;p&gt;
}&lt;br /&gt;
} //************************************************&lt;br /&gt;
//ADC0 IRQ ISR&lt;br /&gt;
//************************************************&lt;br /&gt;
void ADC0_IRQHandler(){&lt;/p&gt;

&lt;p&gt;
NVIC_ClearPendingIRQ(ADC0_IRQn); FPTB-&amp;gt;PCOR = 0X00040000; //
turns on red temp3 = ADC0-&amp;gt;R[0];&lt;/p&gt;

&lt;p&gt;
}&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: KL25Z Cortex M0+ interrupts</title><link>https://community.arm.com/thread/81765?ContentTypeID=1</link><pubDate>Mon, 17 Mar 2014 21:50:49 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d2fba8ca-1cde-454f-b2c7-6a663e70d9ab</guid><dc:creator>jose Gomez</dc:creator><description>&lt;p&gt;&lt;p&gt;
Thank you guys. I found the info at the freescale web site. I will
post my code in case someone else hase same issue.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: KL25Z Cortex M0+ interrupts</title><link>https://community.arm.com/thread/68577?ContentTypeID=1</link><pubDate>Mon, 17 Mar 2014 12:07:50 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:88254c40-3c51-43ff-bf79-252655592f22</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
The &lt;b&gt;Chip Manufacturer&lt;/b&gt; (Freescale?) - surely?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: KL25Z Cortex M0+ interrupts</title><link>https://community.arm.com/thread/62651?ContentTypeID=1</link><pubDate>Mon, 17 Mar 2014 08:58:24 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:741a5a7a-bdc1-4349-81bf-01448fcd5de3</guid><dc:creator>Westonsupermare Pier</dc:creator><description>&lt;p&gt;&lt;p&gt;
Presumably via the vector table in startup_MKL25Z.s, and
ADC0_IRQHandler?&lt;/p&gt;

&lt;p&gt;

C:\Keil473\ARM\Boards\Freescale\FRDM-KL25Z\Blinky\startup_MKL25Z4.s&lt;/p&gt;

&lt;p&gt;
Does FreeScale have no documentation and examples?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>