Hi,
The second Pulsin misses the high portion of the pulse because it "trigs" on a low to high to transition - in this case the same transition that ends the first Pulsin - so by the time the second Pulsin starts looking for a transition the transition have already occured.
Here's a more "manual" aproach which may work:
Code:
HighCount VAR WORD
LowCount VAR WORD
HighCount = 0
LowCount = 0
While GPIO.0 = 1 : WEND ' Wait for falling edge
While GPIO.0 = 0 ' Increment count while input is low
LowCount = LowCount + 1
WEND
While GPIO.0 = 1 ' Increment count while input is high
HighCount = HighCount + 1
Wend
The actual resolution obviosuly depends on the oscialltor speed etc but it shouldn't be hard to figure out how many "counts" equals one ms.
/Henrik.
Bookmarks