Hi Gerald, Please see my answers below.
On Sun, Apr 17, 2011 at 3:45 PM, Gerald Stanje <[email protected]> wrote: > Hello, > > I use the interfaces HplAtm128TimerCtrl16 and Hpl128Compare. > > At the beginning I set: > Atm128TimerCtrlCompare_t compare; > Atm128TimerCtrlCapture_t capture; > > compare.bits.comA = 1; // OC3A toggle on compare match > compare.bits.comB = 1; // OC3B toggle on compare match > capture.bits.wgm32 = 1;// what is this? This is to configure waveform generation. There's a huge table that helps you set the correct value of the WGMn2 bit in the data sheet. The correct value pretty much depends on what you want to do. > capture.bits.cs = 1; // == clocksource of what? This sets the clock source of the timer. The table with the possible values and their meanings are in the data sheet. I don't think you would want to change whatever this bit is set to, otherwise you risk breaking things in TinyOS. > call TimerCtrl.setCtrlCompare(compare); > call TimerCtrl.setCtrlCapture(capture); > > call CompareB.set(6); > call CompareA.set(1000); > > at what time does the timer start to run? They are started at boot time by the initialization code, before tasks start running. > how could i reset the timer to zero? You can write 0 to the corresponding timer/counter register. However, it is not recommended for timers/counters that are used elsewhere in the system, because that could potentially break things. What you should do instead is "remembering" a reference time value, wait for the caputure event, and subtract the the reference time value from the captured one to figure out how much time had passed in between. > why does the interrupt of CompareA.fired still come after I called > CompareA.stop()? It should not come, because CompareA.stop() clears the interrupt flag. Are you sure that that the interrupt flag does not get gets reasserted somewhere else in your code? Janos _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
