how to measure the duration of a pulse applied to an I/O pin in spin?
Jarvan
Posts: 31
Is there a function like "pulse_in" in propeller c ?
Comments
Hi Jarvan,
You might want to explore the BS2 Functions object in the Propeller Object Exchange: http://obex.parallax.com/object/164
The pulse_in function in the Propeller C Simpletools library was designed after the PULSIN command used with the BASIC Stamp. The Spin object above also was designed after BASIC Stamp commands, and includes a PULSIN method.
If you want to understand how the Propeller's counter modules work under the hood to read pulses, take a look at the Propeller Education Kit Labs book version, chapter 7, page 167. There is an example object that uses counter modules in another cog to monitor PWM signals. Chapter 7 is pretty advanced, but if you start at chapter 1 and work your way there, you will have a great start on Spin.
Download the book from here: http://www.parallax.com/downloads/propeller-education-kit-labs-fundamentals-text
Download the example code from here: http://www.parallax.com/downloads/propeller-education-kit-labs-fundamentals-example-code
I hope this helps!
-Steph