Re: PULSIN - Logic Level Voltage Transiion
Hi, CC
@ First, you have to undersand how Pulsin works ...
1) input is set to an ... Input !
2) software counter is initialised and waits for the required edge to come ...
3) leading Edge detected ... the counter ... counts ( unbelievable, eh ? )
4) trailing edge detected ... counter stops counting ( see 3 )
5) counter value is transferred to the target variable.
from that ....
1) you need a little delay between the Pulsin command and the effective counting can start ( presetting delay )
2) you need a little delay between the counting is finished and a new command to be executed ...
after that ...
Code:
WHILE TRIGGER=1:WEND 'MAKE SURE I DON'T START IN THE MIDDLE OF A PULSE
is not useful ... as the pulsin command triggers ... on a level CHANGE ... 
If measuring very short times ... your result will be either 3 or 4 ( example ) ... and precision will be VERY, VERY bad ...
So, ... it appears this way of measuring is " not so good " and you'd much better use the CCP module,in capture mode, with the 1/16 predivisor ... or if more samples required, a CD 4520 as an external 1/100 divider.
AND ... YES, you've hit the Basic languages functions ( not only PBP ) limitations ....
... so, you have to directly drive the Pic registers !!!
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Bookmarks