PDA

View Full Version : Pulsin Question



nobner
- 1st July 2010, 14:30
Hello,
i´ve got a question using PULSIN.
In my application a square-wave signal with 1KHz is applied to an PIC-input.(usind 18F6722)
My crystal is 8MHz.
I limited the PULSIN-Time by DEFINE PULSIN_MAX 1000
So I think, during this PULSIN-Time a few pulses are received, the amount is not critical.
Now my question is: Is only the first pulse measured and stored in the PULSIN-Variable or is the
PULSIN-Variable overwritten by each new received pulse?
If it is overwritten, what happens, when PULSIN_MAX time expires during a pulse is active?
Thanks in advance

HenrikOlsson
- 1st July 2010, 17:56
Hi,
It measures one pulse only. Once it sees the "end" of that pulse the code continues on the line following the PULSIN statement.

/Henrik.

ardhuru
- 1st July 2010, 18:03
The PULSIN command would measure the first complete high going, or low going pulse width it encounters, and then moves on to the next statement.

If there is no pulse (or is wider than the timeout define), a value of 0 would be assigned to the variable.

To answer the earlier question, it doesnt matter how many pulses are received during the time-out duration; only the first one would be measured, and the rest would be lost as the program moves on to the next line.

Regards,

Anand Dhuru

Acetronics2
- 1st July 2010, 18:13
Hi,

Also think, when giving PULSIN_MAX value, it also will be the maximum time for PULSIN to wait for an incoming pulse ... :rolleyes:

Alain

nobner
- 1st July 2010, 18:22
Thanks to all,
helped me very much to solve my problem!
Best Regards
Norbert