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.
7 years, 2 months ago.
rawSerial inte rrupt
#include "mbed.h"
DigitalOut led1(LED1);
DigitalOut led2(LED2);
RawSerial pc(USBTX, USBRX);
void callback_ex() {
// Note: you need to actually read from the serial to clear the RX interrupt
//pc.putc(pc.getc()); // This is ok,
int c = pc.getc();
//pc.putc(c);
pc.putc(0x00000041); // display AAA in PC's sscom
led2 = !led2;
}
int main() {
pc.attach(&callback_ex);
while (1) {
led1 = !led1;
wait(0.5);
}
}
when i input A from PC's sscom uart tools, PC's sscom uart tools display AAA, help pls.
1 Answer
7 years, 1 month ago.
Hello Xu Min,
Thank you for the follow up with the answer. I will post it here so that the question gets marked as answer and other will find this answer easier.
Xu Min writes:
Quote:
the answer is that PC's sscom tools send A followed by "\r\n", so enter the interrupt 3 times
Best regards,
Earl, team Mbed
the answer is that PC's sscom tools send A followed by "\r\n", so enter the interrupt 3 times
posted by xu min 06 Sep 2018