Thanks for your help.
I tried your method today but my CmuCAM3 seems did not receive the command.
Would you please help me to tell me if my program is correct or not?
For the time being, concurrency is not a problem. I just want to ensure my
command is sent to CmuCAM3 through UART0 TX on Tmote Sky to UART1 of CmuCAM3
My purpose in this program is to send a "SF" to CmuCAM3.
Thanks
-----------------------------------------------------------------
configuration TestSerialAppC {}
implementation {
components TestSerialC as App, MainC, LedsC;
components new Msp430Usart0C() as usart0;
components HplMsp430GeneralIOC;
App.Boot -> MainC;
App.Leds -> LedsC;
App.usart -> usart0;
App.UsartResource -> usart0;
App.ADC3->HplMsp430GeneralIOC.ADC3;
App.ADC2->HplMsp430GeneralIOC.ADC2;
App.ADC1->HplMsp430GeneralIOC.ADC1;
App.ADC0->HplMsp430GeneralIOC.ADC0;
App.SDA->HplMsp430GeneralIOC.SDA;
}
-----------------------------------------------------------------
module TestSerialC {
uses {
interface HplMsp430Usart as usart;
interface Boot;
interface Resource as UsartResource;
interface Leds;
interface HplMsp430GeneralIO as ADC3; // SET LOW
interface HplMsp430GeneralIO as ADC2; // SET LOW
interface HplMsp430GeneralIO as ADC1; // SET LOW
interface HplMsp430GeneralIO as ADC0; // SET LOW
interface HplMsp430GeneralIO as SDA; // POWER PIN - SET HIGH
}
}
implementation {
event void Boot.booted() {
// set High to Power On CmuCAM3
call ADC3.set();
call ADC3.selectIOFunc();
call ADC3.makeOutput();
call ADC2.clr();
call ADC2.selectIOFunc();
call ADC2.makeInput();
call ADC1.clr();
call ADC1.selectIOFunc();
call ADC1.makeInput();
call ADC0.clr();
call ADC0.selectIOFunc();
call ADC0.makeInput();
call SDA.clr();
call SDA.selectIOFunc();
call SDA.makeInput();
while (call UsartResource.request() != SUCCESS);
}
event void UsartResource.granted() {
call usart.setModeUart(&msp430_uart_default_config);
call usart.enableUart();
call usart.tx('S'); // correct?
call usart.tx('F');
call usart.tx(0x00);
while (! call usart.isTxEmpty());
call UsartResource.release();
}
}
}
---------------------------------------------------------------------
On 10/11/07, Michael Schippling <[EMAIL PROTECTED]> wrote:
>
> You should probably start by learning the C language. This may help:
> http://en.wikibooks.org/wiki/C_Programming
>
> But a quick answer goes something like this:
>
> A 'C' string like "gv" is an array of chars (or bytes to most machines)
> so it may be declared and initialized thusly:
>
> char string[] = "gv";
>
> You can get to each byte by indexing the array:
>
> char byte1 = string[0];
> char byte2 = string[1];
>
> So byte1 one will be 'g' and byte2 will be 'v', where the hex values
> of those ASCII chars are 0x67 and 0x76 respectively (assuming I
> interpreted the number conversions correctly from this):
> http://www.asciitable.com/
>
> The assignment works both ways of course so you can build up
> a string like this (note that real C strings are defined to
> be terminated with a null (0) character):
>
> char newstring[3];
>
> newstring[0] = 'g';
> newstring[1] = 0x76;
> newstring[2] = 0x00;
>
> MS
>
> Sikar Chan wrote:
> > Hello
> >
> > I connected a CmuCAM3 to Tmote Sky via the UART0. I want to ask how to
> > convert a string like "gv" to bytes in order to send it to CmuCAM via
> > UART0.
> >
> > Thanks a lot
> >
> > Regards
> > Sikar Chan
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Tinyos-help mailing list
> > [email protected]
> > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help