rangerskm
Full Member level 4
- Joined
- Jan 23, 2013
- Messages
- 199
- Helped
- 0
- Reputation
- 2
- Reaction score
- 0
- Trophy points
- 1,296
- Activity points
- 2,663
hi friends i got error in compiling the below code
error i got
Code:
//************ INTERUPT TO 7 SEGMENT LED /INTERUPT 1 AS INCREMENT & 2 AS COUNTER / *****************//
#include <LPC21xx.H>
//#include "lpc21xx_keil.h"
#include <stdio.h>
// olimex LPC-P2129: buttons on P0.1/P0.3 (active low)
#define BUT1PIN 1
#define BUT2PIN 3
#define BUT3PIN 7
#define BUT4PIN 20
// olimex LPC-P2129: LEDs on P1.17-P1.24 (active low)
int keydetect(void) ;
void sevensegint(void);
void sevensegcountr(void);
void led(void);
void keypad(void);
void select(int);
static int i;
int n;
unsigned int ROW,COL;
static void delay(void )
{
volatile int g,k;
for (g=0;g<200;g++)
for (k=0;k<20000;k++);
}
void delay1 (void) { /* Delay function */
unsigned int cnt , cnt1;
for (cnt = 0; cnt < 2000000; cnt++);
for (cnt1 = 0; cnt1 <2000000; cnt1++);
}
int main(void)
{
IODIR1 = 0X01FE0000;
IOCLR1 = 0X01FE0000;
IODIR0 = 0x000FFF0A; /*P0.8..19*/ //intialization for 7 segment
IOSET0 = 0x000FFF00;
n = 0x00004000;
IOCLR0 = n;
MAMCR = 2; // MAM functions fully enabled
/* Turn on 7 segment LED */
// IODIR0 = 0x0000000A;
while (1)
{
if (IOPIN0 & (1<<BUT1PIN)) { // true if button released (active low)
sevensegint(); // clear I/O bit -> LED on (active low)
}
else {
IOCLR1 = 0x001E0000;
}
if (IOPIN0 & (1<<BUT2PIN)) { // true if button released (active low)
sevensegcountr(); // clear I/O bit -> LED on (active low)
}
else {
IOCLR1 = 0x001E0000; // set I/O bit -> LED off (active low)
}
if (IOPIN0 & (1<<BUT3PIN)) { // true if button released (active low)
led(); // clear I/O bit -> LED on (active low)
}
else {
IOCLR1 = 0x001E0000;
}
if (IOPIN0 & (1<<BUT4PIN)) { // true if button released (active low)
keypad(); // clear I/O bit -> LED on (active low)
}
else {
IOCLR1 = 0x001E0000;
}
}
}
void sevensegint()
{
i = ++i;
select(i);
}
void sevensegcountr()
{
unsigned int n;
IODIR0 = 0x000FFF00; /*P0.8..19*/
IOSET0 = 0x000FFF00;
n = 0x00000000;
IOCLR0 = n; /* Turn on LED */
select(n);
}
void led()
{
MAMCR = 2; // MAM functions fully enabled
IODIR1 = 0x01FE0000;
IODIR0 = 0x0000000a;
IOPIN0= 0xffffffff;
//IOPIN1= 0xffffffff;
i=0;
//IOCLR1 = 0x01FE0000;
IOSET1 = 0x01FE0000;
delay();
delay1();
delay1();
IOCLR1 = 0X01FE0000;
IOCLR1 = 0X01F00000;
delay();
IOSET1 = 0x01FE0000;
delay();
delay1();
delay1();
IOCLR1 = 0X01FE0000;
IOCLR1 = 0X01F00000;
}
void select(int j)
{
switch(j)
{
case 1:
IOCLR0 = 0x00004F00;
delay();
delay();
delay();
IOSET0 = 0x000FFF00;
break;
case 2:
IOCLR0 = 0X00002400;
delay();
delay();
delay();
IOSET0 = 0x000FFF00;
break;
case 3:
IOCLR0 = 0x00003000;
delay();
delay();
delay();
IOSET0 = 0x000FFF00;
break;
case 4:
IOCLR0 = 0x00001900;
delay();
delay();
delay();
IOSET0 = 0x000FFF00;
break;
case 5:
IOCLR0 = 0x00001200;
delay();
delay();
delay();
IOSET0 = 0x000FFF00;
break;
case 6:
IOCLR0 = 0x00000200;
delay();
delay();
delay();
IOSET0 = 0x000FFF00;
break;
case 7:
IOCLR0 = 0x00007800;
delay();
delay();
delay();
IOSET0 = 0x000FFF00;
break;
case 8:
IOCLR0 = 0x00000000;
delay();
delay();
delay();
IOSET0 = 0x000FFF00;
break;
case 9:
IOCLR0 = 0x00001000;
delay();
delay();
delay();
IOSET0 = 0x000FFF00;
break;
}
}
void keypad()
{
int j,key[4][4]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; // TO GET SINGLE VALUE FROM TWO DIMENSIONAL ARRAY
IODIR0 = 0x000ffff0; // SELECTING KEYPAD AS WELL AS 7 SEGMENT AS OUTPUT P0.4 TO P0.19
while(1)
{
ROW = COL =0;
keydetect(); // CALLING THE FUNCTION TO FIND THE INPUT
IOCLR0 = 0x0000ff00; // SETTING EACH SEGMENT OF 7 SEGMENT & TO DISABLE THE VIEW
IOSET0 = 0x00040000; // ENABLING ONLY THE THIRD 7 SEGMENT CONNECTED TO P0.18 // 0x000F0000
j = key[ROW][COL]; //GET THE VALUE FROM THE FUNCTION
IOCLR0 = 0x0000ff00; // RESET TO 7 SEGMENT TO BLANK //
switch (j) // PRINTING 0 TO F
{
case 0:
IOSET0 = 0x0000bf00;
break;
case 1:
IOSET0 = 0x00008600;
break;
case 2 :
IOSET0 = 0x0000db00;
break;
case 3:
IOSET0 = 0x0000cf00;
break;
case 4:
IOSET0 = 0x0000e600;
break;
case 5:
IOSET0 = 0x0000ed00;
break;
case 6:
IOSET0 = 0x0000fd00;
break;
case 7:
IOSET0 = 0x00008700;
break;
case 8:
IOSET0 = 0x0000ff00;
break;
case 9:
IOSET0 = 0x0000ef00;
break;
case 10:
IOSET0 = 0x0000f700;
break;
case 11:
IOSET0 = 0x0000ff00;
break;
case 12:
IOSET0 = 0x0000b900;
break;
case 13:
IOSET0 = 0x0000bf00;
break;
case 14:
IOSET0 = 0x0000f900;
break;
case 15:
IOSET0 = 0x0000f100;
}
}
}
int keydetect(void) // FUNCTION FOR DETECTING WHICH KEY HAS PRESSED TAKING ROW & COLOM VALUE
{
unsigned int TEMP1,i,TEMP;
TEMP1=0x00000010;
for(i=0;i<4;i++) // POLLING FOR FINDING WHICH ROW AND COLOM
{
IOSET0=0X000000F0; // ENABLING P0.4 TO P0.7 AS O/P
IOCLR0=TEMP1; // TO SELECT THE ROW 0,1,2,3 (LOOP)
TEMP=0;
TEMP=IOPIN0 & 0x0000000F; // TO FIND WHCH COLOM HAS BEEN SELECTED
if(TEMP!=0x0000000F)
{
if(TEMP==0X0000000E) //IF COLOM 0 IS SELECTED ROW VALUE WILL BE TAKEN FRM THE VARIABLE ROW
COL=0;
else if(TEMP==0X0000000D)
COL=1;
else if(TEMP==0x0000000B)
COL=2;
else if(TEMP==0x00000007)
COL=3;
break;
}
ROW++;
TEMP1<<=1; // TO MOVE TEMP1 VALUE SO THAT IT CAN CHANGE THE ROW VALUE
}
return 0;
}
error i got
compiling int_all.c...
int_all.c(10): error: #5: cannot open source input file "LPC21xx.H": No such file or directory
#include <LPC21xx.H>
int_all.c: 0 warnings, 1 error
".\nsk.axf" - 1 Error(s), 0 Warning(s).
Target not created