Hello!
I want to use tmote to produce clock of 40KHz,so
I'm trying to capture msp430's clock for a several days, but failed. I think
using interfaces of TimerA0 could work, so I try to use interfaces
MSP430Capture as CaptureA0,MSP430TimerControl as ControlA0,and MSP430Timer as
TimerA. By using event void captured(uint16_t time) ,I want to lingt on the
LED, but it doesn't work.
Now ,I attach my code.
*in blink.nc
>configuration Blink {
>}
>implementation {
> components Main, BlinkM, SingleTimer, LedsC,MSP430TimerC,MSP430GeneralIOC;
> Main.StdControl -> SingleTimer.StdControl;
> Main.StdControl -> BlinkM.StdControl;
> BlinkM.Timer -> SingleTimer.Timer;
> BlinkM.Leds -> LedsC;
> BlinkM.MSP430GeneralIO -> MSP430GeneralIOC.Port33;
> BlinkM.MSP430Capture -> MSP430TimerC.CaptureA0;
> BlinkM.MSP430Timer -> MSP430TimerC.TimerA;
>}
*in blinkM.nc
>module BlinkM {
> provides {
> interface StdControl;
> }
> uses {
> interface Timer;
> interface Leds;
> interface MSP430Capture;
> interface MSP430Timer;
> interface MSP430GeneralIO;
> }
>}
>implementation {
> bool state=FALSE;
> command result_t StdControl.init() {
> call Leds.init();
> call MSP430Timer.setClockSource(3);//MSP430_CLK
> call MSP430Capture.setEdge(MSP430TIMER_CM_RISING);
> call MSP430Capture.setSynchronous(TRUE);
> call MSP430TimerControl.enableEvents();
> return SUCCESS;
> }
> command result_t StdControl.start() {
> return SUCCESS;
> }
> command result_t StdControl.stop() {
> return call Timer.stop();
> }
> event result_t Timer.fired()
> {
> return SUCCESS;
> }
> async event void MSP430Timer.overflow()
> {
> }
>async event void MSP430Capture.captured(uint16_t time)
> {
> state=!state;
> if(state)
> {
> call Leds.redOn();
> }
> else
> {
> call Leds.redOff();
> }
> }
>}
singleTimer.nc is the sample code, I haven't changed any words.
Please tell me where i was wrong. And if you tell me how to capture the MSP430
's clock or writing codes, that is best.
My English is not good, please forgive me ,and I will try my best to learning.
Thank you.
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help