pawan kumar
Member level 4
- Joined
- Jan 31, 2012
- Messages
- 73
- Helped
- 5
- Reputation
- 10
- Reaction score
- 5
- Trophy points
- 1,298
- Location
- Chennai
- Activity points
- 1,894
#include<lpc214x.h>
void inituart1() //initializes both UARTS at 9600 baud
{
U1LCR=0x83;
U1DLL=0x61;
U1DLM=0x00;
U1LCR=0x03;
U0LCR=0x83;
U0DLL=0x61;
U0DLM=0x00;
U0LCR=0x03;
}
void send(unsigned char a) //sends a byte through U0
{
U0THR=a;
while(U0LSR!=0x60);
}
void senduart1(unsigned char a) //sends a byte through U1
{
U1THR=a;
while(U1LSR!=0x60);
}
unsigned char recuart1() // recieves a byte from U1
{
unsigned char p;
while ((U1LSR&0x01)!=1);
p=U1RBR;
return p;
}
unsigned char rec() // recieves a byte from U0
{
unsigned char p;
while ((U0LSR&0x01)!=1);
p=U0RBR;
return p;
}
int main()
{
PINSEL0=0x00050005; //initialized U0 and U1 as UART and not GPIO
PINSEL1 = 0x00000000;
PINSEL2 = 0x00000000;
inituart1();
while(1)
{
send(recuart1());
}
}
while(1) {
send(i);
i++;
if(i == 'Z'+1) {
i = 'A';
send(0x0D);
send(0x0A);
}
}
Of course you need to test the GPS outdoors.
that's really cheap.. I used to think a scope was never less than 600USD..this is news bro! but my project constraints now : I promised to show 50%completion of my final year project by 10th feb..I am not able to communicate any peripheral with ARM. it does with PC.I would ve been happier if it did not work with P.C either.I feel like having a choke throat after crossing half the river......
#include<lpc214x.h>
void init() //initializes both UARTS @9600,8bit, no pairity,1 stopbit
{
U0LCR=0x83;
U0DLL=0x61;
U0DLM=0x00;
U0LCR=0x03;
U1LCR=0x83;
U1DLL=0x61;
U1DLM=0x00;
U1LCR=0x03;
}
void senduart0(unsigned char a) //sends a byte through UART0
{
U0THR=a;
while(U0LSR!=0x60);
}
unsigned char recuart1() //recieves a byte from UART1
{
unsigned char p;
while ((U1LSR&0x01)!=1);
p=U1RBR;
return p;
}
int main()
{
unsigned char p;
PINSEL0=0x00050005;
PINSEL1 = 0x00000000;
PINSEL2 = 0x00000000;
init();
while(1)
{
p=recuart1(); //receive something in UART1
senduart0(p); //send the same to UART0
}
}
2. You should flip the connections of microcontroller side max232 while connecting to modem
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?