Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 8 months ago.
rs232 in k64f
Hi all, I am doing serial communication with mbed, I have interfaced modem with lpc1768 and k64f. I am getting fine result with lpc1768 but k64f is not showing expected results. I am sending "AT" commands from mbed to modem, and then I am receiving the results. Lpc1768 is displaying the fine results on terminal, but k64f is receiving the garbage value.
include the mbed library with this snippet
#include "mbed.h"
int main()
{
char buf[100];
char r[25];
xbee.baud(9600);
xbee.format(8,Serial::None,1);
xbee.printf("AT$sr\n");
wait(1);
int i=0;
while(1)
{
while(!xbee.readable()){
;}
if(xbee.readable())
{
r[i] = xbee.getc();
printf("%c ",r[i]);
i++;
}
i=0;
}
}
In both devices baud rate is 9600 which is actually the baud rate of the modem. My code for both of the devices is similar as well:
You can see that it is a very simple code, I am sending the at command to receive the wireless signals, and then I am waiting for the results. Lpc1768 is displaying the expected results, but k64f is not receiving the data in proper format.