It is very strange to be sending modem commands to a pc but okay if you must.
You are using UartStream which is split phase. You need to be catching the completion event (signal) from UartStream.sendDone. When the sendDone comes in you can then start up the next string you want to send. The way you have UartStream.sendDone right now doesn't make a whole lot of sense. If you don't know how this works you need to read the basic TinyOS documents and tutorials. Start with Phil's book. On Mon, Feb 13, 2012 at 12:13 AM, #BHARTI GOEL# <[email protected]>wrote: > Hi, > > I am trying to send a series of commands to the PC hyperterminal using > UART interface. Now when I send a single command it works fine. But when I > send a series of commands it stops working. I have tried to create delays > after each command but still it does not work. Can anyone tell me what I > can possibly do? > > Here is my code : > > module GSMmodemC @safe() > { > uses interface Boot; > uses interface Init as UartInit; > uses interface StdControl as UartControl; > uses interface UartStream; > uses interface Leds; > uses interface Timer<TMilli>; > > > } > implementation > { > > // COMMANDS TO BE SENT > char* uartsendBuf1 = "AT\n"; > char* uartsendBuf2 = "AT+CMGF=1\n"; > char* uartsendBuf3 = "AT+CMGS="; > char* uartsendBuf4 = "+6590140252"; > char* output = "Hello"; > char* input; > uint16_t inputlen; > uint8_t recevedByte; > > event void Boot.booted() { > > call UartInit.init(); > > call Timer.startPeriodic(3000); > call UartControl.start(); > > } > > > static void delay(uint32_t cycles) > { > while (--cycles > 0) > { > //nop(); > } > } > > event void Timer.fired() { > > > call UartControl.start(); > call UartStream.send(uartsendBuf1, 3); > /*call Leds.led1Toggle(); // This part > does not work > delay(5000); > call UartControl.start(); > call UartStream.send(uartsendBuf2, 10); > call Leds.led1Toggle(); > delay(5000); > call UartControl.start(); > call UartStream.send(uartsendBuf3, 8); > call Leds.led1Toggle(); > delay(5000); > call UartControl.start(); > call UartStream.send(uartsendBuf4, 11); > call Leds.led1Toggle(); > delay(5000); */ > } > > > > async event void UartStream.sendDone( uint8_t* buf, uint16_t len, > error_t error ) > { > > call Leds.led0Toggle(); > call UartStream.enableReceiveInterrupt(); > > } > > async event void UartStream.receivedByte( uint8_t byte ) > { > > if( (char* )byte == "a") > { > call Leds.led1Toggle(); > } > call Leds.led2Toggle(); > recevedByte = byte; > call UartControl.stop(); > > } > > async event void UartStream.receiveDone( uint8_t* buf, uint16_t len, > error_t error ) > { > > } > > } > > > _______________________________________________ > Tinyos-help mailing list > [email protected] > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > -- Eric B. Decker Senior (over 50 :-) Researcher
_______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
