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.
12 years, 11 months ago.
putc() and printf() on serial doesn't work!
I try the example in handbook for serial function on mbed LPC1768. I connect pin9 and pin10 to a pc's COM port and open the TeraTerm_VT on PC to capture the data send from mbed LPC1768 using putc() and printf(). The data captured appear corrupted. Did anyone try this before? Please advise me, I'm new here. Thanks in advance.
Here my code :-
#include "mbed.h"
Serial pc(p9, p10);
DigitalOut led(LED1);
int main()
{
pc.baud(9600);
while(1)
{
pc.putc('m');
led = 1;
wait(0.5);
pc.printf("Hello World");
led = 0;
wait(0.5);
}
}
2 Answers
12 years, 11 months ago.
Did you try the same via the USB<>Serial bridge of the mbed? That should work for sure.
Second question would be if you are sure the settings are correct of Tera Term? Should be 9600 baudrate, no parity, 8 databits and 1 stopbit, no flowcontrol. It looks to me like wrong settings there.
12 years, 11 months ago.
Quote:
I connect pin9 and pin10 to a pc's COM port...
I assume you did not connect the mbed pins directly to the PC's COM port did you ? Because the signal levels are quite (!!) different and you can easily damage your mbed. (COM port RS232 signals are in the range -3 to -15 to and +3 to +15 Volts!) You need a converter like MAX3232.