On Sunday 01 April 2007 09:33, Jan Soukup wrote: > Hi everybody, > > I want to read a PWM signal from accelerometer with a Tmote Sky module. But > as far as I just found out, when I use GPIO input, only the rising edge OR > the falling edge of the signal can be captured. Am I right? But I need to > measure both, because of time stamps to know the ratio of the periodes. Can > anyone help please? Can I use analog inputs of the ADC instead of Digital > IOs?
The msp430 will interrupt only on one type of transition at a time, either low-to-high or high-to-low. The settings are mutually exlusive; see the TI msp430 User's Guide, section 9.2 for more information. Depending upon the frequency and duty cycle ranges of the input PWM signal, you can create a reliable component that uses the GpioCapture interface to do what you want. Start by calling Capture.captureRisingEdge(), for example, and then when Capture.captured() is signalled, call Capture.captureFallingEdge(). The Capture.captured() signal gives you the TxR (timer register) value at the time of the capture, which you can use to calculate frequency, pulse duration, duty cycle, etc. If the signal frequency is slow you may need to use Msp430Timer for the appropriate timer so you can process Msp430Timer.overflow() events as well. I don't understand the ramifications of trying to read the duty cycle via the ADC so I can't comment on this strategy. All the best, Steve _______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
