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, 8 months ago. This question has been closed. Reason: Duplicate
SERIAL INTERRUPTS
I did my program with serial interrupts, but when i send a data to the serial in the microcontroller it's works well, but i stop sendding datas i have to go out from the interrupt but i ca't go out... i don;t know how i can't go out...
THIS IS MY PROGRAM
THIS PROBLEM HAPPEN IN SERIAL RECEPTION INTERRUPT...
#include "mbed.h"
DigitalOut led1(LED1);
DigitalOut led2(LED2);
DigitalOut led3(LED3);
Serial device(p9,p10);
void Tx_interrupt();
void Rx_interrupt();
int main() {
device.baud(9600);
device.attach(&Rx_interrupt, Serial::RxIrq);
device.attach(&Tx_interrupt, Serial::TxIrq);
NVIC_EnableIRQ(UART1_IRQn);
while(1) {
led3=1;
wait(0.3);
led3=0;
wait(0.3);
}
}
void Rx_interrupt() {
if(device.readable()){
led1=1;
led3=0;
wait(0.2);
led1=0;
wait(0.2);
}
return;
}
void Tx_interrupt() {
led2=1;
wait(0.3);
led2=0;
return;
}