Simple "count" question

Beavis3215Beavis3215 Posts: 221
long count	(	int 	pin,
long 	duration 
)		
Count number of low to high transitions an external input applies to an I/O pin over a certain period of time.

Parameters
pin	I/O pin number
duration	Amount of time the measurement counts transitions
Returns
The number of low to high transitions



This is out of the propeller.h manual.
Does anyone know the default units of "a certain period of time"?
I am assuming milliseconds, as most of the other examples of timing commands use milliseconds.

Suppose that pin 19 is already an input, and is being used elsewhere in the program. Would int t = count(19, 1000) and the other function of pin 19 be possible at the same time?
The Propeller is like cool and stuff..... uhhh.....huh huh.

Comments

  • 1 Comment sorted by Date Added Votes
  • Milliseconds would be correct.

    "Suppose that pin 19 is already an input, and is being used elsewhere in the program. Would int t = count(19, 1000) and the other function of pin 19 be possible at the same time?"
    Not in the same cog, since the count() function will run for the specified duration. Make int t global and use count() in a different cog.
    Florida, between St. Petersburg and the Gulf of Mexico

    Do not look directly into laser with remaining good eye...
Sign In or Register to comment.