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

RF ID USING LPC2129

Hello sir...

This is my coding for RF ID using LPC2129...
am not getting output in Hyperterminal....but its error free only...
please help me soon......

am in need of your help guys...

Thank you...

Waiting for the reply....

#define CR 0x0D
#include <LPC21xx.H>

void init_serial (void);
int putchar (int ch);
int getchar (void);
//int getchar2(void);
int put_String(char* pString);
void put_char (int ch);
void delay(unsigned char time);

unsigned char test;
char *r,*a;
int i;
int main(void)
{ VPBDIV = 0x02; //Divide Pclk by two
init_serial();

while(1)
{ while((U0IER & 0x01));
//while(!(U0LSR & 0x01));
//*a=getchar();
//if(!(U0IER & 0x01))
//{
while(U0RBR != '\0')
//while(getchar()!='\0')
{ //while(!(U0LSR & 0x01));
*r= U0RBR;
r++;
} //r++;
//}
//delay(1);
// i=0;

// while(*r!='\0') //{

put_String(r); //i++;

//} //put_String(r); //putchar(getchar()); //Echo terminal
} }

void init_serial (void) /* Initialize Serial Interface */
{ //PINSEL0 = 0x00050000; /* Enable RxD1 and TxD1 */ PINSEL0 = 0x00050005; //PINSEL1 = 0x00050000; U1LCR = 0x00000083; /* 8 bits, no Parity, 1 Stop bit */ U0LCR = 0x00000083; U1DLL = 0x000000C2; /* 9600 Baud Rate @ 30MHz VPB Clock */ U0DLL = 0x000000C2; U1LCR = 0x00000003; /* DLAB = 0 */ U0LCR = 0x00000003; U0IER = 0x07; U0FCR= 0xC3; // U0RBR = 0X01;

}

//int putchar (int ch) /* Write character to Serial Port */
//{

// if (ch == '\n') { // while (!(U1LSR & 0x20)); // U1THR = CR; /* output CR */ // } // while (!(U1LSR & 0x20)); // return (U1THR = ch);
//}

int putchar (int ch) /* Write character to Serial Port */
{

if (ch == '\n') { while (!(U0LSR & 0x20)); U0THR = CR; /* output CR */ } while (!(U0LSR & 0x20)); return (U0THR = ch);
}

/* int getchar (void)
{

while (!(U1LSR & 0x01));

return (U1RBR); //return(100);
} */

int getchar(void)
{ //int *r; while(!(U0LSR & 0x01));

return (U0RBR); //return(100);
}

int put_String(char* pString) {

int i=0;

while(*pString) {

put_char(*pString++); i++;

}

return i;

}

/*int get_String(char* r1) { int i=0; while(*r1) { *r1=getchar(); r1++; i++; } return *r1; } */

void put_char (int ch) // Write character to Serial Port
{

while (!(U1LSR & 0x20)); U1THR = ch;
}

void delay(unsigned char time) { unsigned char i,j; for(i=0;i<=time;i++) for(j=0;j<=1275;j++);
}

0