Mbed working as USB-Serial interface using MODSERIAL library. This is working well as interface between CHR-6dm position sensor and its PC soft (AHRSInterface)
Revision 0:a1601df537a8, committed 2011-04-15
- Comitter:
- kinemax
- Date:
- Fri Apr 15 08:00:21 2011 +0000
- Commit message:
Changed in this revision
diff -r 000000000000 -r a1601df537a8 MODSERIAL.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MODSERIAL.lib Fri Apr 15 08:00:21 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/AjK/code/MODSERIAL/#6c9b57c14868
diff -r 000000000000 -r a1601df537a8 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Apr 15 08:00:21 2011 +0000 @@ -0,0 +1,32 @@ +#include "mbed.h" +#define BAUD 115200 +#define TX_PIN p9 +#define RX_PIN p10 + + #include "MODSERIAL.h" + + DigitalOut led1(LED1); + DigitalOut led2(LED2); + DigitalOut led3(LED3); + DigitalOut led4(LED4); + + MODSERIAL pc(USBTX, USBRX); + + MODSERIAL uart(TX_PIN, RX_PIN); + + + int main() + { + pc.baud(BAUD); + uart.baud(BAUD); + //pc.printf("Start\n\r"); + + // Transparent uart<->usb - working ! + while(1) + { + if( pc.readable()) + {led1=1; led4=0; uart.putc(pc.getc());} + if( uart.readable()) + {led4=1; led1=0; pc.putc(uart.getc());} + } + } \ No newline at end of file
diff -r 000000000000 -r a1601df537a8 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Apr 15 08:00:21 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912