Discussion in "ARM Development" started by    gaurav7577    Jul 11, 2014.
Fri Jul 11 2014, 03:57 pm
#1
hello everyone , pls tell me what went wrong in this code....code is self explanatory...thanks in advance
//this prog demonstrates when rising edge occurs at pin EINT0 P1 becomes 0x000000FF from 0x00000000
#include<lpc214X.H>
void ext0int(void)__irq;

int main(void)
{
	IODIR1 = 0XFFFFFFFF; //PORT1 PINS ARE DFINED AS O/P
	PINSEL0 = 0X0000000C; //P0.1 SELECTED AS EINT0
	PINSEL2 = 0X00000000; //P1 PINS ARE SELECTED AS GPIO 
	VICIntSelect = 0x00000000; // INTERRUPT IS DEFINED AS IRQ
	VICIntEnable = 0x00004000; // EINT0 IS ENABLED
	EXTMODE= 0X01; // EINT0 IS SELECTED AS EDGE TRIGGERED
	EXTPOLAR= 0X01; // AT RISING EDGE
	VICVectCntl0 = 0x0000002E; // INTERRUPT TYPE IS SELECTED
	VICVectAddr0 =(unsigned)ext0int;
	IOCLR1 = 0XFFFFFFFF;
	while(1);
}

void ext0int(void)__irq
{
	IOSET1 = 0X000000FF;
	EXTINT = 0X01; //FLAG HAS BEEN CLEARED
	VICVectAddr = 0x00; //DUMMY ADDRESS IS ASSIGNED
}


[ Edited Fri Jul 11 2014, 11:28 pm ]
Sat Jul 12 2014, 12:55 am
#2
The code may be self explanatory but the problem is not.
What is the problem ?
Sat Jul 12 2014, 01:41 am
#3
VICIntEnable = 0x00004000; // you are selecting interrupt number 14


I usually follow this method of enabling interrupt.
VICIntSelect &= ~(1 << 14);    /* interrupt is IRQ */
VICVectAddr14 = (unsigned)ext0int; /* coz its IRQ number 14 */
VICIntEnable = (1 << 14);   /* enable interrupt */
Sat Jul 12 2014, 12:22 pm
#4
Thanks a lot for ur rpls ...i m checking this code in keil4 in debug mode .....so when i make pin EINT0(P0.1) to logic 1 from logic 0 its not going into interrupt routine as it is supposed to execute ISR after giving rising edge to P0.1 ....m changing the pin status of P0.1 manually to give rising edge in peripherals window...whether this method for checking my code is correct ???
@Ajay ...i tried ur suggestions as well... still not working...m not getting what is the exact prob in code
Mon Jul 14 2014, 12:08 pm
#5
I forgot to mention VICVectCntl14 in my code, did you set that too? If you are running debugger then check if your code is coming to IRQ or not. check lpc startup file for this. If its not coming the probably interrupt is not getting initialized.
Mon Jul 14 2014, 09:46 pm
#6
Ya i have defined VICVectCntl register ....its not coming into isr ....i tried 2-3 codes from the internet also but facing same prob....plz solve this prob...actually i m using keil sw provided in cd with nex robotics LPC2148 dev board....is it ok??
n what else we hav to initialize while using interrupts ....m confused...everything seems perfect
Tue Jul 15 2014, 04:50 pm
#7
In my previous projects, I have been using NXP provided software for processor related support and they really work well. I could not find that package on their website anymore. I might share it here later.

But setting three registers should have enabled that interrupt:
VICVectAddr0, VICVectCntl0 and VICIntEnable

there is no big glue logic.
Tue Jul 15 2014, 05:09 pm
#8
i really appreciate ur efforts Ajay....thanks a lot for that...but plz don't leave this discussion unanswered from here
if u r having sample code give me ...i want solution...i tried so many codes from net as m not getting bug in my code but none of those worked...Thanks in Advance
Wed Jul 16 2014, 08:52 pm
#9
finally i got the solution..........i m such a fool ..i was giving interrupt by giving edge using IOSET and IOCLR register...i tried with IOPIN regiser its working fine.......hipeeeeeeeeeeeeeeeeeee.....Thank you ajay for ur help
Thu Jul 17 2014, 10:07 am
#10
Great!! silly mistakes always help you learn better. good luck!

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Michailqfh
Fri Mar 29 2024, 01:53 am
Bobbyerilar
Thu Mar 28 2024, 08:08 am
pb58
Thu Mar 28 2024, 05:54 am
Clarazkafup
Thu Mar 28 2024, 02:24 am
Walterkic
Thu Mar 28 2024, 01:19 am
Davidusawn
Wed Mar 27 2024, 08:30 pm
Richardsop
Tue Mar 26 2024, 10:33 pm
Stevencog
Tue Mar 26 2024, 04:26 pm