PWM monitoring with spin?
Brian Carpenter
Posts: 728
So i have a· PWM signal coming from a device that would normally drive a servo.· instead, i want to be able to se the PWM with the Propeller and based on its width, have the propeller accomplish different tasks.· Where is the starting point in spin to do this?· what commands would i use.· I realize that i could use the BS2 functions object but i dont need all the other things associated with it.· Any help would be great.· Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It's Only A Stupid Question If You Have Not Googled It First!!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It's Only A Stupid Question If You Have Not Googled It First!!
Comments
In Spin, wait for the pulse to go high, then wait for the pulse to go low. At that point, read the counter (PHSx) and you'll get the width in 12.5ns steps (with an 80MHz clock). Zero the counter and you'll be ready for the next pulse.
Post Edited (TChapman) : 4/8/2007 7:10:05 AM GMT
What does this do differently from the example that Mike gave of using %01000
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It's Only A Stupid Question If You Have Not Googled It First!!
I am not clear on Mikes idea yet, I am still looking at it to see what that mode is and how it works, I think it is a POS in detector.
Post Edited (TChapman) : 4/8/2007 6:26:35 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It's Only A Stupid Question If You Have Not Googled It First!!
Page 6, Table 6 says that mode %11010 APIN = 1 accumulates PHSA when pin is a 1.
Page 16 says "Mode %01000 (POS detector) is identical to mode %11010 (LOGIC A)"
I think Mike is suggesting that the Apin be used as the input to the counter , when High the counter accumulates at the rate of FREQA.
Post Edited (TChapman) : 4/8/2007 9:04:19 AM GMT
Thanks for pointing out that modes %01000 and %11010 are the same.