Hi all,

We have found the problem. We wrote cbi(ETIMSK, TICIE3);, and it should be sbi(ETIMSK, TICIE3); to enable interrupts.

Anyway, thanks a lot,

Andres



From: "Andres Aberasturi" <[EMAIL PROTECTED]>
To: tinyos-help@Millennium.Berkeley.EDU
Subject: [Tinyos-help] Clock3 - Duty cycle
Date: Tue, 16 May 2006 16:28:13 +0200


Hi all,

We have micaz motes. We have installed TinyOS 1.1.7. We have bought a temperature sensor, whose data is measured through a duty cycle. Then we need a clock to measure it. We have write an application and it compiles right, but the micaz mote does not work. We have tested that the interrupt does not happen, we put a led in TOS_SIGNAL.

We do not know what the problem is. We have copied here the code of our module. Can anyone help us?

Thanks in advance,

Andres


module DutyCycleM {
 provides interface DutyCycle;
 uses interface Leds;
}
implementation {

 command result_t DutyCycle.start(uint8_t relojinit){

        uint8_t data = inp(TCCR3B);
        sbi(TCCR3B, ICES3); // Interrupt rising
        cbi(ETIMSK, TICIE3); // Interrupt enable
        outp(((data & 0xF8) | relojinit),TCCR3B); // Clock select

   return SUCCESS;
 }

 command result_t DutyCycle.stop() {
        uint8_t data = inp(TCCR3B);
        outp((data & 0xF8),TCCR3B); // Timer/Counter stop
        cbi(ETIMSK, TICIE3); // Interrupt disable
     return SUCCESS;
 }

 command result_t DutyCycle.changeClock(uint8_t reloj){

        uint8_t data = inp(TCCR3B);
        uint8_t buffer = inp(ETIMSK);
        cbi(ETIMSK, TICIE3); // Interrupt disable
        sbi(TCCR3B, ICES3); // Interrupt rising

        outp(((data & 0xF8) | reloj),TCCR3B); //0xF8 = 11111000

        outp(buffer,ETIMSK); // Interrupt before

        return SUCCESS;
 }

default async event result_t DutyCycle.dataReady(uint16_t done) { return SUCCESS; }

 TOSH_SIGNAL(SIG_INPUT_CAPTURE3) {
   uint16_t data = inw(ICR3L);

        call Leds.set(7);

        if (inp(TCCR3B) & 0x40)
                cbi(TCCR3B, ICES3); // Falling
        else
                sbi(TCCR3B, ICES3); // Rising

        sbi(ETIFR,ICF3); // Flag clear
   __nesc_enable_interrupt();
   signal DutyCycle.dataReady(data);
 }

}

_________________________________________________________________
¿Estás pensando en cambiar de coche? Todas los modelos de serie y extras en MSN Motor. http://motor.msn.es/researchcentre/

_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

_________________________________________________________________
Dale rienda suelta a tu tiempo libre. Mil ideas para exprimir tu ocio con MSN Entretenimiento. http://entretenimiento.msn.es/

_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to