A test program to see why the RTOS doesn't like to play with the serial interrupt.

Dependencies:   mbed-rtos mbed

Files at this revision

API Documentation at this revision

Comitter:
the_programmer
Date:
Sun Jan 06 12:28:15 2013 +0000
Parent:
0:7cdb93589064
Commit message:
Working with serial interrupt and echo to PC

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 7cdb93589064 -r 54099c52b7dc main.cpp
--- a/main.cpp	Fri Dec 28 19:27:23 2012 +0000
+++ b/main.cpp	Sun Jan 06 12:28:15 2013 +0000
@@ -4,6 +4,7 @@
 
 DigitalOut led1(LED1);
 DigitalOut led2(LED2);
+DigitalOut led3(LED3);
 Serial probe(p9,p10);
 
 #ifdef DEBUG
@@ -14,21 +15,18 @@
 unsigned char serialBufferLoc = 0;
 
 void rxInterrupt(void){
-    NVIC_DisableIRQ(UART3_IRQn);
-    uint32_t IRR3 = LPC_UART3->IIR;
     led2=!led2;
-    serialBuffer[serialBufferLoc] = LPC_UART3->RBR;
-
-#ifdef DEBUG
-    pc.putc(serialBuffer[serialBufferLoc]);
-#endif
-
+    serialBuffer[serialBufferLoc] = LPC_UART3->RBR; //read the input
+    //serialBuffer[serialBufferLoc] = probe.getc(); //stops the controller
+    
+    LPC_UART0->RBR = serialBuffer[serialBufferLoc]; //write to the pc
+    //pc.putc(serialBuffer[serialBufferLoc]); //stops the controller
+    
     if (serialBuffer[serialBufferLoc] == 0x0A) {
-        pc.printf("cr found\r\n");
+        led3 =! led3;
     }
 
     serialBufferLoc++;
-    NVIC_EnableIRQ(UART3_IRQn);
 }
 
 void serialProbeInit(void){
@@ -54,7 +52,6 @@
         led1 = 1;
         wait(0.2);
         led1 = 0;
-        led2 = 0;
         wait(0.2);
     }
 }