Hi, i'm working with Tmote Sky and i need to use the DAC pin to
do a set of measures. I want to enable the analog output
and set it to zero volt. When i receive a message i lift the voltage value
for, e.g, 10 ms and then set it to zero again (this way i can measure distances
between rising or falling edges due to different messages with
a real oscilloscope ).
I tried to use the MSP430DAC12C component, but my app hangs inesorably...
Below i post the steps i do in the program...


Please help me.. Thank you!!



/************************************/



interface MSP430DAC as Measure_PIN;
       
        
interface Timer as Measure_TIMER;//32 khz

command result_t StdControl.init() {
//...
call Measure_PIN.bind(DAC12_REF_VREF, //internal voltage reference
            DAC12_RES_8BIT, //resolution 8 bit
            DAC12_LOAD_WRITE, //write directly
            DAC12_FSOUT_1X, //1X voltage
            DAC12_AMP_MED_MED, //medium response time & power
            DAC12_DF_STRAIGHT,//unsigned int
            DAC12_GROUP_OFF);//group off, using only one DAC
    
        // second mandatory  step for measure init        
call Measure_PIN.enable();
//...
}



/************************* Measure_PIN ***********************************/
    event void Measure_PIN.enableDone(result_t success){
        call Measure_PIN.enableOutput();
        call Measure_PIN.set(0);//a sort of initialization
        return;
    }    


    event void Measure_PIN.disableDone(result_t success){
        return;
    }
    
    
    
    /************************* Measure_TIMER ***********************************/

  event result_t Measure_TIMER.fired() {
    call Measure_PIN.set(0);// HI2LO reset the voltage value
    return SUCCESS;
  }
 
 /************************* RECEIVE_ALARMS from RADIO ************************************/
  event TOS_MsgPtr ReceiveAlarms.receive(TOS_MsgPtr m) {
    alarm_tmp=m;
    
    if (state==ON){
            if (((AlarmMsg*)m->data)->src="">                 
                call Measure_PIN.set(0x70);//LO2HI lift the measure signalto half the max value 0xff
                call Measure_TIMER.start(TIMER_ONE_SHOT,2<<5);
                
            }
            post enqueueAlarm();
    
        }
  return m;
 }
/****************************************************/

Thank you very very much!!!!
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to