SparkFun Forums 

Where electronics enthusiasts find answers.

Everything ARM and LPC
By naz
#84187
Hello all,
i'm using keil evaluation version.my objective is take data from gps module to lpc2148.i'm a beginner to ARM,i tried something,i don't know whether it is correct or wrong?.This is my code,please check and let me know
[code][color=green][/color]
#include<LPC214x.h>
#include<stdio.h>

void uart_init(void);
char getdata(void);
void putdata(char );
void led(int);
char ch,temp,array[];
int i=0;
extern __irq void serial1ISR(void);

int main()
{
char ch1;
while(1)
{
IODIR1 = 0x00FF0000;
led(23);
uart_init();
led(22);
getdata();
led(21);
ch1=ch;
putdata(ch1);
led(20);
}
}
void putdata(char ch1)
{
while(!(U1LSR & 0x20));
if(ch1 =='\n')
U1THR=0x0D;
else
U1THR=ch1;
}
char getdata()
{
char ch;
while(!(U1LSR & 0x01));
ch=U1RBR;
return(ch);
}
void led(int n)
{
long int d;
IOSET1|=1<<n;
for(d=0;d<1000000;d++);
IOCLR1|=1<<n;
}

void uart_init()
{
VPBDIV=0x00;
PLL0CFG=0x24;
PLL0FEED=0x55;
PLL0CON=0x03;
PINSEL0=0x00050000;
U1LCR=0x83;
U1DLL=97;
U1LCR=0x03;

U1IIR=0xCD;
U1FDR=0x00000010;
U1IER=0x01;


VICVectAddr1=(unsigned long)serial1ISR;
VICVectCntl1=0x20|7;
VICIntEnable=0x00000080;
}
__irq void serial1ISR(void)
{
temp=getdata();
if(temp!=0x0D)
{
array[i]=temp;
i++;

}
//VICIntEnable=0x00000000;
}
[/code]