From: Dave H. <dhy...@gm...> - 2006-02-10 15:16:25
|
Hi Nicholas, On 2/10/06, NICHOLAS JONES <che...@ho...> wrote: > > I want to hook a gumstix up to two accelerometers using the PWM, but I'm = not > entirely sure on how to do it. I know that the robostix has PWM_3 and PW= M_1 > on it, and that GP16 and GP17 are for PWM, but how do I access them or go > about hooking it all up? Any suggestions, code samples, etc welcome. Im > using ADXL202E_a for the accelerometers. Well, the PWM stuff on the robostix are outputs, and you'll want to deal with inputs. The best way would be to take advantage of the ICP1 nd ICP3 pins. You can configure the hardware to capture one of the hardware timers when an edge occurs. In the interrupt handler fires, you can then change the polarity of the edge so that you can detec the other edge. You now have two hardware captured timestamps that you can subtract to determine the width of the pulse with a high degree of accuracy. The Robostix Tachometer sample does alot of what needs to be done, although it only captures the rising egde and doesn't reprogram the edge detector. http://www.gumstix.org/tikiwiki/tiki-index.php?page=3DRobostix-Tachometer -- Dave Hylands Vancouver, BC, Canada http://www.DaveHylands.com/ |