When debugging code it can be handy to examine/alter variables and to check the state of input lines. So your main program can run and you have access to alter variables and run functions from a terminal. In this sample the main program is just a loop that flashes an LED. In that loop a periodic call is made to ShellTC which handles any commands from the serial terminal. The code is a bit quirky(it was originally written for a very resource limited device) but it works well enough to be useful, hence its published. More details in the main.cpp
.
Diff: sio.cpp
- Revision:
- 3:6a35fb789679
- Parent:
- 1:329a8125838a
- Child:
- 4:107d2d3294da
diff -r 1a5802e3eb30 -r 6a35fb789679 sio.cpp --- a/sio.cpp Wed Feb 04 20:53:21 2015 +0000 +++ b/sio.cpp Wed Feb 04 21:07:52 2015 +0000 @@ -62,14 +62,14 @@ //char theChar; char theChar = 0x00; //used to be a char... //h8 theChar = SIO_RDR; /* get received character */ -//theChar = pc.getc(); -theChar = LPC_UART0->RBR; //oct2012 expereiment +theChar = pc.getc(); +//theChar = LPC_UART0->RBR; //oct2012 expereiment // //see this for reg names http://mbed.org/users/4180_1/notebook/cc-io-register-names/ - do { - } while ((LPC_UART0->LSR & 0x20)==0) ; + //do { + // } while ((LPC_UART0->LSR & 0x20)==0) ; //write character to UART - LPC_UART0->THR = theChar ; + // LPC_UART0->THR = theChar ; //theChar = RCREG; //PIC // theChar = 0x42; //TODO2k12 this needs to be whats read from sio RXREG