Navid T
Full Member level 3
- Joined
- Jan 21, 2005
- Messages
- 186
- Helped
- 1
- Reputation
- 2
- Reaction score
- 0
- Trophy points
- 1,296
- Location
- Iran
- Activity points
- 1,385
Hi friends
I use this code to read from a device with 115200 baud rate and write to other device those data with 9600 bps, but it doesn't change from 115200 to 9600 and sends data with 115200. what should i do to change baud rate just after reading data?
I use this code to read from a device with 115200 baud rate and write to other device those data with 9600 bps, but it doesn't change from 115200 to 9600 and sends data with 115200. what should i do to change baud rate just after reading data?
Code:
while(1)
{
U1BRG=15;
U1MODE=0X8400; //ENABLE UART MODULE AND SOME SETTINGS
U1STA=0X8400;
for(i=0;i<5000;i++);
get_frame();
accx = make16(input[2],input[3]);
accy = make16(input[4],input[5]);
accx /= 5;
accy /= 5;
U1BRG=191;
U1MODE=0X8400; //ENABLE UART MODULE AND SOME SETTINGS
U1STA=0X8400;
for(i=0;i<5000;i++);
send(lsb(accx));
send(lsb(accy));
}//end of while(1)