EmbeddedRelated.com
Forums

EXTINT

Started by jdauchot January 16, 2008
Hi all

I am resending this message again please can you help?

I am having problems using external ints again.

The code below works OK on a LPC2148 but NOT on a LPC2294
I use OLIMEX boards which has push button wired to EINT0 P0.16 on
both boards
When I push the button on the lpc2148 board works fine and the
interrupt gets cleared. But on the lpc2294, the interrupt fires but
never gets cleared and the interrupt continiously gets called.

I have two boards of each model , compiled the code using IAR and
GCC. I have read the arrata sheet for LPC2294 and followed the work
arounds.
/*****************************/
static void eint0_init(void)
{

PINSEL1 |= 0x00000001 ;
VPBDIV = 0 ;
EXTMODE = 1 ;
VPBDIV = 0 ;
EXTPOLAR = 1 ;
VPBDIV = 2 ;

EXTINT = 1 ;

VICIntSelect &= ~(1<< VIC_EINT0);
VICVectAddr7 = (unsigned long)eint0_handler;
VICVectCntl7 = 0x20 | VIC_EINT0;
VICIntEnable = (1<< VIC_EINT0);
}

static void eint0_handler(void)
{
OSSemPost(semE1);
EXTINT = 1 ;
VICVectAddr = 0;
}

Regards

An Engineer's Guide to the LPC2100 Series

> Hi,
>
> maybe the following code can help you. This is working fine on my
> LPC2294.
>
> #include int count=0;
>
> void weg (void) __irq
> {
> count++; // increment count
> EXTINT=0x01;
> VICVectAddr = 0; // Acknowledge VIC Interrupt
> }
>
> void init_EINT0(void)
> {
> PINSEL0 &=~0x0000000C; //Enable EINT0
PINSEL0 |= 0x0000000C; //on P0.1
EXTMODE = 0x03;
> EXTPOLAR = 0x03;
> VICIntEnable = 0x4000; // Enable EINT0 (Channel 14) Interrupt
> VICVectAddr1 = (int)weg; // Vector0 auf Serviceroutine weg
> VICVectCntl1 = 0x20 | 14; // Slot1-Interrupt for EINT0
> }
>
> int main()
> {
> int stop=0;
> init_EINT0();
>
> while(1)
> {
> if (count==5)
> {
> stop+=1;
> }
> }
> }
>
> I hope this will help you.
>
> Regards,
> Max
> --- In l..., "jdauchot" wrote:
> >
> > Hi all
> >
> > I am resending this message again please can you help?
> >
> > I am having problems using external ints again.
> >
> > The code below works OK on a LPC2148 but NOT on a LPC2294
> > I use OLIMEX boards which has push button wired to EINT0 P0.16 on
> > both boards
> > When I push the button on the lpc2148 board works fine and the
> > interrupt gets cleared. But on the lpc2294, the interrupt fires but
> > never gets cleared and the interrupt continiously gets called.
> >
> > I have two boards of each model , compiled the code using IAR and
> > GCC. I have read the arrata sheet for LPC2294 and followed the work
> > arounds.
> >
> >
> > /*****************************/
> > static void eint0_init(void)
> > {
> >
> > PINSEL1 |= 0x00000001 ;
> > VPBDIV = 0 ;
> > EXTMODE = 1 ;
> > VPBDIV = 0 ;
> > EXTPOLAR = 1 ;
> > VPBDIV = 2 ;
> >
> > EXTINT = 1 ;
> >
> > VICIntSelect &= ~(1<< VIC_EINT0);
> > VICVectAddr7 = (unsigned long)eint0_handler;
> > VICVectCntl7 = 0x20 | VIC_EINT0;
> > VICIntEnable = (1<< VIC_EINT0);
> > }
> >
> > static void eint0_handler(void)
> > {
> > OSSemPost(semE1);
> > EXTINT = 1 ;
> > VICVectAddr = 0;
> > }
> >
> > Regards
>
Hi,

maybe the following code can help you. This is working fine on my
LPC2294.

#include

int count=0;

void weg (void) __irq
{
count++; // increment count
EXTINT=0x01;
VICVectAddr = 0; // Acknowledge VIC Interrupt
}

void init_EINT0(void)
{
PINSEL0 &=~0x0000000C; //Enable EINT0 PINSEL0 |= 0x0000000C;
//on P0.1 EXTMODE = 0x03;
EXTPOLAR = 0x03;
VICIntEnable = 0x4000; // Enable EINT0 (Channel 14) Interrupt
VICVectAddr1 = (int)weg; // Vector0 auf Serviceroutine weg
VICVectCntl1 = 0x20 | 14; // Slot1-Interrupt for EINT0
}

int main()
{
int stop=0;
init_EINT0();

while(1)
{
if (count==5)
{
stop+=1;
}
}
}

I hope this will help you.

Regards,
Max
--- In l..., "jdauchot" wrote:
>
> Hi all
>
> I am resending this message again please can you help?
>
> I am having problems using external ints again.
>
> The code below works OK on a LPC2148 but NOT on a LPC2294
> I use OLIMEX boards which has push button wired to EINT0 P0.16 on
> both boards
> When I push the button on the lpc2148 board works fine and the
> interrupt gets cleared. But on the lpc2294, the interrupt fires but
> never gets cleared and the interrupt continiously gets called.
>
> I have two boards of each model , compiled the code using IAR and
> GCC. I have read the arrata sheet for LPC2294 and followed the work
> arounds.
> /*****************************/
> static void eint0_init(void)
> {
>
> PINSEL1 |= 0x00000001 ;
> VPBDIV = 0 ;
> EXTMODE = 1 ;
> VPBDIV = 0 ;
> EXTPOLAR = 1 ;
> VPBDIV = 2 ;
>
> EXTINT = 1 ;
>
> VICIntSelect &= ~(1<< VIC_EINT0);
> VICVectAddr7 = (unsigned long)eint0_handler;
> VICVectCntl7 = 0x20 | VIC_EINT0;
> VICIntEnable = (1<< VIC_EINT0);
> }
>
> static void eint0_handler(void)
> {
> OSSemPost(semE1);
> EXTINT = 1 ;
> VICVectAddr = 0;
> }
>
> Regards
>
Hi

I am using P0.16 wired to a push button.

Could there be a problem with that pin?

Regards

_____

From: l... [mailto:l...] On Behalf Of
maxkusnezow
Sent: 17 January 2008 07:22
To: l...
Subject: [lpc2000] Re: EXTINT

> Hi,
>
> maybe the following code can help you. This is working fine on my
> LPC2294.
>
> #include int count=0;
>
> void weg (void) __irq
> {
> count++; // increment count
> EXTINT=0x01;
> VICVectAddr = 0; // Acknowledge VIC Interrupt
> }
>
> void init_EINT0(void)
> {
> PINSEL0 &=~0x0000000C; //Enable EINT0
PINSEL0 |= 0x0000000C; //on P0.1
EXTMODE = 0x03;
> EXTPOLAR = 0x03;
> VICIntEnable = 0x4000; // Enable EINT0 (Channel 14) Interrupt
> VICVectAddr1 = (int)weg; // Vector0 auf Serviceroutine weg
> VICVectCntl1 = 0x20 | 14; // Slot1-Interrupt for EINT0
> }
>
> int main()
> {
> int stop=0;
> init_EINT0();
>
> while(1)
> {
> if (count==5)
> {
> stop+=1;
> }
> }
> }
>
> I hope this will help you.
>
> Regards,
> Max
> --- In lpc2000@yahoogroups .com,
"jdauchot" wrote:
> >
> > Hi all
> >
> > I am resending this message again please can you help?
> >
> > I am having problems using external ints again.
> >
> > The code below works OK on a LPC2148 but NOT on a LPC2294
> > I use OLIMEX boards which has push button wired to EINT0 P0.16 on
> > both boards
> > When I push the button on the lpc2148 board works fine and the
> > interrupt gets cleared. But on the lpc2294, the interrupt fires but
> > never gets cleared and the interrupt continiously gets called.
> >
> > I have two boards of each model , compiled the code using IAR and
> > GCC. I have read the arrata sheet for LPC2294 and followed the work
> > arounds.
> >
> >
> > /*****************************/
> > static void eint0_init(void)
> > {
> >
> > PINSEL1 |= 0x00000001 ;
> > VPBDIV = 0 ;
> > EXTMODE = 1 ;
> > VPBDIV = 0 ;
> > EXTPOLAR = 1 ;
> > VPBDIV = 2 ;
> >
> > EXTINT = 1 ;
> >
> > VICIntSelect &= ~(1<< VIC_EINT0);
> > VICVectAddr7 = (unsigned long)eint0_handler;
> > VICVectCntl7 = 0x20 | VIC_EINT0;
> > VICIntEnable = (1<< VIC_EINT0);
> > }
> >
> > static void eint0_handler(void)
> > {
> > OSSemPost(semE1);
> > EXTINT = 1 ;
> > VICVectAddr = 0;
> > }
> >
> > Regards
>
Hi,

I dont know if there is a problem with this pin. But try my code on
this port.

Regards,
Max

--- In l..., "Jean-Jacques Dauchot" wrote:
>
> Hi
>
>
>
> I am using P0.16 wired to a push button.
>
>
>
> Could there be a problem with that pin?
>
>
>
> Regards
>
>
>
>
>
>
>
> _____
>
> From: l... [mailto:l...] On
Behalf Of
> maxkusnezow
> Sent: 17 January 2008 07:22
> To: l...
> Subject: [lpc2000] Re: EXTINT
>
>
>
>
> > Hi,
> >
> > maybe the following code can help you. This is working fine on my
> > LPC2294.
> >
> > #include
> >
> > int count=0;
> >
> > void weg (void) __irq
> > {
> > count++; // increment count
> > EXTINT=0x01;
> > VICVectAddr = 0; // Acknowledge VIC Interrupt
> > }
> >
> > void init_EINT0(void)
> > {
> > PINSEL0 &=~0x0000000C; //Enable EINT0
> PINSEL0 |= 0x0000000C; //on P0.1
> EXTMODE = 0x03;
> > EXTPOLAR = 0x03;
> > VICIntEnable = 0x4000; // Enable EINT0 (Channel 14) Interrupt
> > VICVectAddr1 = (int)weg; // Vector0 auf Serviceroutine weg
> > VICVectCntl1 = 0x20 | 14; // Slot1-Interrupt for EINT0
> > }
> >
> > int main()
> > {
> > int stop=0;
> > init_EINT0();
> >
> > while(1)
> > {
> > if (count==5)
> > {
> > stop+=1;
> > }
> > }
> > }
> >
> > I hope this will help you.
> >
> > Regards,
> > Max
> >
> >
> > --- In lpc2000@yahoogroups .com,
> "jdauchot" wrote:
> > >
> > > Hi all
> > >
> > > I am resending this message again please can you help?
> > >
> > > I am having problems using external ints again.
> > >
> > > The code below works OK on a LPC2148 but NOT on a LPC2294
> > > I use OLIMEX boards which has push button wired to EINT0 P0.16 on
> > > both boards
> > > When I push the button on the lpc2148 board works fine and the
> > > interrupt gets cleared. But on the lpc2294, the interrupt fires but
> > > never gets cleared and the interrupt continiously gets called.
> > >
> > > I have two boards of each model , compiled the code using IAR and
> > > GCC. I have read the arrata sheet for LPC2294 and followed the work
> > > arounds.
> > >
> > >
> > > /*****************************/
> > > static void eint0_init(void)
> > > {
> > >
> > > PINSEL1 |= 0x00000001 ;
> > > VPBDIV = 0 ;
> > > EXTMODE = 1 ;
> > > VPBDIV = 0 ;
> > > EXTPOLAR = 1 ;
> > > VPBDIV = 2 ;
> > >
> > > EXTINT = 1 ;
> > >
> > > VICIntSelect &= ~(1<< VIC_EINT0);
> > > VICVectAddr7 = (unsigned long)eint0_handler;
> > > VICVectCntl7 = 0x20 | VIC_EINT0;
> > > VICIntEnable = (1<< VIC_EINT0);
> > > }
> > >
> > > static void eint0_handler(void)
> > > {
> > > OSSemPost(semE1);
> > > EXTINT = 1 ;
> > > VICVectAddr = 0;
> > > }
> > >
> > > Regards
> > >
> >
>
>
>
>
>
>
>



Hi Max



This code you sent works OK, thanks very much



But it does not make sense from the user manual regarding EXTMODE and
EXTPOLAR settings.

However you must follow the code below so that VPBDIV does not get corrupted



VPBDIV = 0 ;

EXTMODE = 3 ;

VPBDIV = 0 ;

EXTPOLAR = 3 ;

VPBDIV = 2 ;



I am trying to get EXINT2 to work now same problem



Regards



Jean-Jacques









_____

From: l... [mailto:l...] On Behalf Of
maxkusnezow
Sent: 17 January 2008 08:25
To: l...
Subject: [lpc2000] Re: EXTINT



Hi,

I dont know if there is a problem with this pin. But try my code on
this port.

Regards,
Max

--- In lpc2000@yahoogroups .com,
"Jean-Jacques Dauchot" wrote:
>
> Hi
>
>
>
> I am using P0.16 wired to a push button.
>
>
>
> Could there be a problem with that pin?
>
>
>
> Regards
>
>
>
>
>
>
>
> _____
>
> From: lpc2000@yahoogroups .com
[mailto:lpc2000@yahoogroups .com] On
Behalf Of
> maxkusnezow
> Sent: 17 January 2008 07:22
> To: lpc2000@yahoogroups .com
> Subject: [lpc2000] Re: EXTINT
>
>
>
>
> > Hi,
> >
> > maybe the following code can help you. This is working fine on my
> > LPC2294.
> >
> > #include
> >
> > int count=0;
> >
> > void weg (void) __irq
> > {
> > count++; // increment count
> > EXTINT=0x01;
> > VICVectAddr = 0; // Acknowledge VIC Interrupt
> > }
> >
> > void init_EINT0(void)
> > {
> > PINSEL0 &=~0x0000000C; //Enable EINT0
> PINSEL0 |= 0x0000000C; //on P0.1
> EXTMODE = 0x03;
> > EXTPOLAR = 0x03;
> > VICIntEnable = 0x4000; // Enable EINT0 (Channel 14) Interrupt
> > VICVectAddr1 = (int)weg; // Vector0 auf Serviceroutine weg
> > VICVectCntl1 = 0x20 | 14; // Slot1-Interrupt for EINT0
> > }
> >
> > int main()
> > {
> > int stop=0;
> > init_EINT0();
> >
> > while(1)
> > {
> > if (count==5)
> > {
> > stop+=1;
> > }
> > }
> > }
> >
> > I hope this will help you.
> >
> > Regards,
> > Max
> >
> >
> > --- In lpc2000@yahoogroups .com,
> "jdauchot" wrote:
> > >
> > > Hi all
> > >
> > > I am resending this message again please can you help?
> > >
> > > I am having problems using external ints again.
> > >
> > > The code below works OK on a LPC2148 but NOT on a LPC2294
> > > I use OLIMEX boards which has push button wired to EINT0 P0.16 on
> > > both boards
> > > When I push the button on the lpc2148 board works fine and the
> > > interrupt gets cleared. But on the lpc2294, the interrupt fires but
> > > never gets cleared and the interrupt continiously gets called.
> > >
> > > I have two boards of each model , compiled the code using IAR and
> > > GCC. I have read the arrata sheet for LPC2294 and followed the work
> > > arounds.
> > >
> > >
> > > /*****************************/
> > > static void eint0_init(void)
> > > {
> > >
> > > PINSEL1 |= 0x00000001 ;
> > > VPBDIV = 0 ;
> > > EXTMODE = 1 ;
> > > VPBDIV = 0 ;
> > > EXTPOLAR = 1 ;
> > > VPBDIV = 2 ;
> > >
> > > EXTINT = 1 ;
> > >
> > > VICIntSelect &= ~(1<< VIC_EINT0);
> > > VICVectAddr7 = (unsigned long)eint0_handler;
> > > VICVectCntl7 = 0x20 | VIC_EINT0;
> > > VICIntEnable = (1<< VIC_EINT0);
> > > }
> > >
> > > static void eint0_handler(void)
> > > {
> > > OSSemPost(semE1);
> > > EXTINT = 1 ;
> > > VICVectAddr = 0;
> > > }
> > >
> > > Regards
> > >
> >
>
>
>
>
>
>
>







Hi Max



There is an issue with setting EXTMODE and EXTPOLAR corrupting VPBDIV (see
errata sheet for the 2294)



You need to set VPBDIV = 0 before setting EXTMODE and EXTPOLAR then set
VPBDIV back to its original value. In you case its 4.



I am still work on the problem but I think I got it to work know (see below)



I still need to set EXTMODE and EXTPOLAR to 3 to get EXTINT0 to work
otherwise it screws up



I use IAR Kickstart with this code , the GNU compiler does not work with
this code. Could someone on this group explain this?



static void eint0_init(void)

{



PINSEL1 |= 0x00000001 ;

VPBDIV = 0 ;

EXTMODE &= ~3 ;

EXTMODE |= 3 ;

VPBDIV = 0 ;

EXTPOLAR &= ~3 ;

EXTPOLAR |= 3 ;

VPBDIV = 2 ;



semE1 = OSSemCreate(0);



VICIntSelect &= ~(1<< VIC_EINT0);

VICVectAddr7 = (unsigned long)eint0_handler;

VICVectCntl7 = 0x20 | VIC_EINT0;

VICIntEnable = (1<< VIC_EINT0);





}



static void eint2_init(void)

{



PINSEL0 |= 0x80000000 ;

VPBDIV = 0 ;

EXTMODE &= ~4 ;

EXTMODE |= 4 ;

VPBDIV = 0 ;

EXTPOLAR &= ~4 ;

EXTPOLAR |= 4 ;

VPBDIV = 2 ;





semE2 = OSSemCreate(0);



VICIntSelect &= ~(1<< VIC_EINT2);

VICVectAddr8 = (unsigned long)eint2_handler;

VICVectCntl8 = 0x20 | VIC_EINT2;

VICIntEnable = (1<< VIC_EINT2);



}



static void eint0_handler(void)

{

EXTINT = 1 ;

OSSemPost(semE1);

VICVectAddr = 0;

}



static void eint2_handler(void)

{





/* Post the semaphore */

EXTINT = 4 ;

OSSemPost(semE2);

VICVectAddr = 0; // reset VIC



}



Regards



Jean-Jacques





Hi Jean-Jacques,

yes you are right, I had the same problem with EXTMODE and EXTPOLAR.
According to the manual they have to be 1 for EXTINT0.

Ive set my VPBDIV in the Startup code to 4. Why do I have to set it
again to 0 and then to 2?

Regards,

Max

> Hi Max
>
>
>
> This code you sent works OK, thanks very much
>
>
>
> But it does not make sense from the user manual regarding EXTMODE and
> EXTPOLAR settings.
>
> However you must follow the code below so that VPBDIV does not get
corrupted
>
>
>
> VPBDIV = 0 ;
>
> EXTMODE = 3 ;
>
> VPBDIV = 0 ;
>
> EXTPOLAR = 3 ;
>
> VPBDIV = 2 ;
>
>
>
> I am trying to get EXINT2 to work now same problem
>
>
>
> Regards
>
>
>
> Jean-Jacques
>
>
>
>
>
>
>
>
> Hi,
>
> I dont know if there is a problem with this pin. But try my code on
> this port.
>
> Regards,
> Max
>
> --- In lpc2000@yahoogroups .com,
> "Jean-Jacques Dauchot" wrote:
> >
> > Hi
> >
> >
> >
> > I am using P0.16 wired to a push button.
> >
> >
> >
> > Could there be a problem with that pin?
> >
> >
> >
> > Regards
> >
> >
> >
> >
> >
> >
> >
> > _____
> >
> > From: lpc2000@yahoogroups .com
> [mailto:lpc2000@yahoogroups .com] On
> Behalf Of
> > maxkusnezow
> > Sent: 17 January 2008 07:22
> > To: lpc2000@yahoogroups .com
> > Subject: [lpc2000] Re: EXTINT
> >
> >
> >
> >
> > > Hi,
> > >
> > > maybe the following code can help you. This is working fine on my
> > > LPC2294.
> > >
> > > #include
> > >
> > > int count=0;
> > >
> > > void weg (void) __irq
> > > {
> > > count++; // increment count
> > > EXTINT=0x01;
> > > VICVectAddr = 0; // Acknowledge VIC Interrupt
> > > }
> > >
> > > void init_EINT0(void)
> > > {
> > > PINSEL0 &=~0x0000000C; //Enable EINT0
> > PINSEL0 |= 0x0000000C; //on P0.1
> > EXTMODE = 0x03;
> > > EXTPOLAR = 0x03;
> > > VICIntEnable = 0x4000; // Enable EINT0 (Channel 14) Interrupt
> > > VICVectAddr1 = (int)weg; // Vector0 auf Serviceroutine weg
> > > VICVectCntl1 = 0x20 | 14; // Slot1-Interrupt for EINT0
> > > }
> > >
> > > int main()
> > > {
> > > int stop=0;
> > > init_EINT0();
> > >
> > > while(1)
> > > {
> > > if (count==5)
> > > {
> > > stop+=1;
> > > }
> > > }
> > > }
> > >
> > > I hope this will help you.
> > >
> > > Regards,
> > > Max
> > >
> > >
> > > --- In lpc2000@yahoogroups .com,
> > "jdauchot" wrote:
> > > >
> > > > Hi all
> > > >
> > > > I am resending this message again please can you help?
> > > >
> > > > I am having problems using external ints again.
> > > >
> > > > The code below works OK on a LPC2148 but NOT on a LPC2294
> > > > I use OLIMEX boards which has push button wired to EINT0 P0.16 on
> > > > both boards
> > > > When I push the button on the lpc2148 board works fine and the
> > > > interrupt gets cleared. But on the lpc2294, the interrupt
fires but
> > > > never gets cleared and the interrupt continiously gets called.
> > > >
> > > > I have two boards of each model , compiled the code using IAR and
> > > > GCC. I have read the arrata sheet for LPC2294 and followed the
work
> > > > arounds.
> > > >
> > > >
> > > > /*****************************/
> > > > static void eint0_init(void)
> > > > {
> > > >
> > > > PINSEL1 |= 0x00000001 ;
> > > > VPBDIV = 0 ;
> > > > EXTMODE = 1 ;
> > > > VPBDIV = 0 ;
> > > > EXTPOLAR = 1 ;
> > > > VPBDIV = 2 ;
> > > >
> > > > EXTINT = 1 ;
> > > >
> > > > VICIntSelect &= ~(1<< VIC_EINT0);
> > > > VICVectAddr7 = (unsigned long)eint0_handler;
> > > > VICVectCntl7 = 0x20 | VIC_EINT0;
> > > > VICIntEnable = (1<< VIC_EINT0);
> > > > }
> > > >
> > > > static void eint0_handler(void)
> > > > {
> > > > OSSemPost(semE1);
> > > > EXTINT = 1 ;
> > > > VICVectAddr = 0;
> > > > }
> > > >
> > > > Regards
> > > >





Hi Jean-Jacques,

yes you are right, I had the same problem with EXTMODE and EXTPOLAR.
According to the manual they have to be 1 for EXTINT0.

Ive set my VPBDIV in the Startup code to 4. Why do I have to set it
again to 0 and then to 2?

Regards,

Max

--- In l..., "Jean-Jacques Dauchot" wrote:
>
> Hi Max
>
>
>
> This code you sent works OK, thanks very much
>
>
>
> But it does not make sense from the user manual regarding EXTMODE and
> EXTPOLAR settings.
>
> However you must follow the code below so that VPBDIV does not get
corrupted
>
>
>
> VPBDIV = 0 ;
>
> EXTMODE = 3 ;
>
> VPBDIV = 0 ;
>
> EXTPOLAR = 3 ;
>
> VPBDIV = 2 ;
>
>
>
> I am trying to get EXINT2 to work now same problem
>
>
>
> Regards
>
>
>
> Jean-Jacques
>
>
>
>
>
>
>
>
>
> _____
>
> From: l... [mailto:l...] On
Behalf Of
> maxkusnezow
> Sent: 17 January 2008 08:25
> To: l...
> Subject: [lpc2000] Re: EXTINT
>
>
>
> Hi,
>
> I dont know if there is a problem with this pin. But try my code on
> this port.
>
> Regards,
> Max
>
> --- In lpc2000@yahoogroups .com,
> "Jean-Jacques Dauchot" wrote:
> >
> > Hi
> >
> >
> >
> > I am using P0.16 wired to a push button.
> >
> >
> >
> > Could there be a problem with that pin?
> >
> >
> >
> > Regards
> >
> >
> >
> >
> >
> >
> >
> > _____
> >
> > From: lpc2000@yahoogroups .com
> [mailto:lpc2000@yahoogroups .com] On
> Behalf Of
> > maxkusnezow
> > Sent: 17 January 2008 07:22
> > To: lpc2000@yahoogroups .com
> > Subject: [lpc2000] Re: EXTINT
> >
> >
> >
> >
> > > Hi,
> > >
> > > maybe the following code can help you. This is working fine on my
> > > LPC2294.
> > >
> > > #include
> > >
> > > int count=0;
> > >
> > > void weg (void) __irq
> > > {
> > > count++; // increment count
> > > EXTINT=0x01;
> > > VICVectAddr = 0; // Acknowledge VIC Interrupt
> > > }
> > >
> > > void init_EINT0(void)
> > > {
> > > PINSEL0 &=~0x0000000C; //Enable EINT0
> > PINSEL0 |= 0x0000000C; //on P0.1
> > EXTMODE = 0x03;
> > > EXTPOLAR = 0x03;
> > > VICIntEnable = 0x4000; // Enable EINT0 (Channel 14) Interrupt
> > > VICVectAddr1 = (int)weg; // Vector0 auf Serviceroutine weg
> > > VICVectCntl1 = 0x20 | 14; // Slot1-Interrupt for EINT0
> > > }
> > >
> > > int main()
> > > {
> > > int stop=0;
> > > init_EINT0();
> > >
> > > while(1)
> > > {
> > > if (count==5)
> > > {
> > > stop+=1;
> > > }
> > > }
> > > }
> > >
> > > I hope this will help you.
> > >
> > > Regards,
> > > Max
> > >
> > >
> > > --- In lpc2000@yahoogroups .com,
> > "jdauchot" wrote:
> > > >
> > > > Hi all
> > > >
> > > > I am resending this message again please can you help?
> > > >
> > > > I am having problems using external ints again.
> > > >
> > > > The code below works OK on a LPC2148 but NOT on a LPC2294
> > > > I use OLIMEX boards which has push button wired to EINT0 P0.16 on
> > > > both boards
> > > > When I push the button on the lpc2148 board works fine and the
> > > > interrupt gets cleared. But on the lpc2294, the interrupt
fires but
> > > > never gets cleared and the interrupt continiously gets called.
> > > >
> > > > I have two boards of each model , compiled the code using IAR and
> > > > GCC. I have read the arrata sheet for LPC2294 and followed the
work
> > > > arounds.
> > > >
> > > >
> > > > /*****************************/
> > > > static void eint0_init(void)
> > > > {
> > > >
> > > > PINSEL1 |= 0x00000001 ;
> > > > VPBDIV = 0 ;
> > > > EXTMODE = 1 ;
> > > > VPBDIV = 0 ;
> > > > EXTPOLAR = 1 ;
> > > > VPBDIV = 2 ;
> > > >
> > > > EXTINT = 1 ;
> > > >
> > > > VICIntSelect &= ~(1<< VIC_EINT0);
> > > > VICVectAddr7 = (unsigned long)eint0_handler;
> > > > VICVectCntl7 = 0x20 | VIC_EINT0;
> > > > VICIntEnable = (1<< VIC_EINT0);
> > > > }
> > > >
> > > > static void eint0_handler(void)
> > > > {
> > > > OSSemPost(semE1);
> > > > EXTINT = 1 ;
> > > > VICVectAddr = 0;
> > > > }
> > > >
> > > > Regards
> > > >
> > >
> >
> >
> >
> >
> >
> >
> >
>
>
>
>
>
>
>



Hi

Has anyone else had the same problems
Regards

--- In l..., "maxkusnezow" wrote:
>
> Hi Jean-Jacques,
>
> yes you are right, I had the same problem with EXTMODE and EXTPOLAR.
> According to the manual they have to be 1 for EXTINT0.
>
> Ive set my VPBDIV in the Startup code to 4. Why do I have to set it
> again to 0 and then to 2?
>
> Regards,
>
> Max
>
> --- In l..., "Jean-Jacques Dauchot"
wrote:
> >
> > Hi Max
> >
> >
> >
> > This code you sent works OK, thanks very much
> >
> >
> >
> > But it does not make sense from the user manual regarding EXTMODE
and
> > EXTPOLAR settings.
> >
> > However you must follow the code below so that VPBDIV does not get
> corrupted
> >
> >
> >
> > VPBDIV = 0 ;
> >
> > EXTMODE = 3 ;
> >
> > VPBDIV = 0 ;
> >
> > EXTPOLAR = 3 ;
> >
> > VPBDIV = 2 ;
> >
> >
> >
> > I am trying to get EXINT2 to work now same problem
> >
> >
> >
> > Regards
> >
> >
> >
> > Jean-Jacques
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > _____
> >
> > From: l... [mailto:l...] On
> Behalf Of
> > maxkusnezow
> > Sent: 17 January 2008 08:25
> > To: l...
> > Subject: [lpc2000] Re: EXTINT
> >
> >
> >
> > Hi,
> >
> > I dont know if there is a problem with this pin. But try my code
on
> > this port.
> >
> > Regards,
> > Max
> >
> > --- In lpc2000@yahoogroups
40yahoogroups.com> .com,
> > "Jean-Jacques Dauchot" wrote:
> > >
> > > Hi
> > >
> > >
> > >
> > > I am using P0.16 wired to a push button.
> > >
> > >
> > >
> > > Could there be a problem with that pin?
> > >
> > >
> > >
> > > Regards
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > _____
> > >
> > > From: lpc2000@yahoogroups
40yahoogroups.com> .com
> > [mailto:lpc2000@yahoogroups 40yahoogroups.com> .com] On
> > Behalf Of
> > > maxkusnezow
> > > Sent: 17 January 2008 07:22
> > > To: lpc2000@yahoogroups .com
> > > Subject: [lpc2000] Re: EXTINT
> > >
> > >
> > >
> > >
> > > > Hi,
> > > >
> > > > maybe the following code can help you. This is working fine
on my
> > > > LPC2294.
> > > >
> > > > #include
> > > >
> > > > int count=0;
> > > >
> > > > void weg (void) __irq
> > > > {
> > > > count++; // increment count
> > > > EXTINT=0x01;
> > > > VICVectAddr = 0; // Acknowledge VIC Interrupt
> > > > }
> > > >
> > > > void init_EINT0(void)
> > > > {
> > > > PINSEL0 &=~0x0000000C; //Enable EINT0
> > > PINSEL0 |= 0x0000000C; //on P0.1
> > > EXTMODE = 0x03;
> > > > EXTPOLAR = 0x03;
> > > > VICIntEnable = 0x4000; // Enable EINT0 (Channel 14) Interrupt
> > > > VICVectAddr1 = (int)weg; // Vector0 auf Serviceroutine weg
> > > > VICVectCntl1 = 0x20 | 14; // Slot1-Interrupt for EINT0
> > > > }
> > > >
> > > > int main()
> > > > {
> > > > int stop=0;
> > > > init_EINT0();
> > > >
> > > > while(1)
> > > > {
> > > > if (count==5)
> > > > {
> > > > stop+=1;
> > > > }
> > > > }
> > > > }
> > > >
> > > > I hope this will help you.
> > > >
> > > > Regards,
> > > > Max
> > > >
> > > >
> > > > --- In lpc2000@yahoogroups
40yahoogroups.com> .com,
> > > "jdauchot" wrote:
> > > > >
> > > > > Hi all
> > > > >
> > > > > I am resending this message again please can you help?
> > > > >
> > > > > I am having problems using external ints again.
> > > > >
> > > > > The code below works OK on a LPC2148 but NOT on a LPC2294
> > > > > I use OLIMEX boards which has push button wired to EINT0
P0.16 on
> > > > > both boards
> > > > > When I push the button on the lpc2148 board works fine and
the
> > > > > interrupt gets cleared. But on the lpc2294, the interrupt
> fires but
> > > > > never gets cleared and the interrupt continiously gets
called.
> > > > >
> > > > > I have two boards of each model , compiled the code using
IAR and
> > > > > GCC. I have read the arrata sheet for LPC2294 and followed
the
> work
> > > > > arounds.
> > > > >
> > > > >
> > > > > /*****************************/
> > > > > static void eint0_init(void)
> > > > > {
> > > > >
> > > > > PINSEL1 |= 0x00000001 ;
> > > > > VPBDIV = 0 ;
> > > > > EXTMODE = 1 ;
> > > > > VPBDIV = 0 ;
> > > > > EXTPOLAR = 1 ;
> > > > > VPBDIV = 2 ;
> > > > >
> > > > > EXTINT = 1 ;
> > > > >
> > > > > VICIntSelect &= ~(1<< VIC_EINT0);
> > > > > VICVectAddr7 = (unsigned long)eint0_handler;
> > > > > VICVectCntl7 = 0x20 | VIC_EINT0;
> > > > > VICIntEnable = (1<< VIC_EINT0);
> > > > > }
> > > > >
> > > > > static void eint0_handler(void)
> > > > > {
> > > > > OSSemPost(semE1);
> > > > > EXTINT = 1 ;
> > > > > VICVectAddr = 0;
> > > > > }
> > > > >
> > > > > Regards
> > > > >
> > > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> >
> >
>