This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Doubt in basic techniques

Hi to all, I am new to ARM world. Now i am trying with lpc2148. I have to write program for 4x4 keypad. So i thought to start with a single push button. i have written code for 16x2 LCD display. Now i am trying to type any char on keypad and display it on LCD. My LCD is working fine. I have written a code for single key. i ran that program and got no error. But when i debugging it the control does not enter in the coding. its stopped on SWI_Handler B SWI_Handler line.
Using my code i am trying to read
Here's my code

#include<lpc214x.h>
#include<stdio.h>

void delay(void);
//void keydetection(void);
unsigned int i,j,k;

int main()
{
IODIR0=0x00000000;//make all pins as input
PINSEL0=0x00000000;//make all pins as GPIO's
k=0x00000000;//make k as 32 bit variable

while(1)
{
IOSET0=0x00000001;//setting P0.0 pin as high
k=IOPIN0;//reading the states of P0.0 pin nd storn to k
printf("%d",k);
if(IOPIN0 && 0x00000001)//checkin P0.0 as high or not
IOSET0=0x00000011;//if its correct then P0.1 as high
delay();
IOCLR0=0x00000001;
k=IOPIN0;
printf("%d",k);
if(IOPIN0 && 0x00000000)
IOSET0=0x00000000;
delay();
}
}

void delay(void)
{
for(i=0;i<40000;i++)
{
;
}
}


Not only for this coding i am asking this doubt. My friends used to get this problem somany time. What this error exactly trying to say? What should i commenly do if i get this error? and whats the commen way to avoid this error?

Parents
  • I forgot to mention something.

    It is normally best if you configure your editor to indent the code with spaces and not tabs, and that you then work very diligently with indenting your code properly. Proper indenting of the code very much affects the readability - and the readability very much affects the number of bugs you will have. If you can't read the code, you will not be able to see the bugs...

Reply
  • I forgot to mention something.

    It is normally best if you configure your editor to indent the code with spaces and not tabs, and that you then work very diligently with indenting your code properly. Proper indenting of the code very much affects the readability - and the readability very much affects the number of bugs you will have. If you can't read the code, you will not be able to see the bugs...

Children
No data