Martin Smith
/
BufferTest
Program to show buffer fproblem
Revision 0:cdbac2e32a1b, committed 2010-12-23
- Comitter:
- ms523
- Date:
- Thu Dec 23 12:44:35 2010 +0000
- Commit message:
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r cdbac2e32a1b main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Dec 23 12:44:35 2010 +0000 @@ -0,0 +1,27 @@ +#include "mbed.h" + +Ticker Box_Comms; // Ticker to send a command every 250ms +Serial PC (USBTX,USBRX); // Comms with PC via USB cable +Serial Comms (p28,p27); // External comms via RS232 IC + +void isr_Comms(void) { + char reply[70]; // Array to store reply in + char Command[] = {0x01,'R',0x02,'P',0x03}; + int ReplyIndex=0; // Variable for indexing the read data + + for (int i=0;i<5;i++) { // Send the Command + Comms.putc(Command[i]); + } + while (Comms.readable()) { // While there is data on the line to read... + reply[ReplyIndex] = Comms.getc(); // Read it! + ReplyIndex++; + } + PC.printf("\n\rNumber of bytes received = %d,",ReplyIndex); +} + +int main() { + Comms.baud(38400); //Set up the Baud rates for the comms + Box_Comms.attach(&isr_Comms,0.25); //Call the isr_Comms function every 1/4 second + + PC.printf("Testing Started"); +} \ No newline at end of file
diff -r 000000000000 -r cdbac2e32a1b mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Dec 23 12:44:35 2010 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e