It states...
Reads a pulse (either HIGH or LOW) on a pin. For example, if value is HIGH, pulseIn() waits for the pin to go HIGH, starts timing, then waits for the pin to go LOW and stops timing. Returns the length of the pulse in microseconds. Gives up and returns 0 if no pulse starts within a specified time out.
.....and it does that but it does not state that **stops the program while it waits for whatever lenght of time you have included.[/u]
Value = pulseIn(Pin, LOW, 2000000); // 2 seconds time.
This can present an issue pending on where and how it is used. (It did for me..)
By modifying the "wiring_pulse.c" file I was able to make it work as pulse lenght measuring function only without the time factor.
The original code commented out and the new below it. Perhaps this can be of use to others as well.
__/* __
[u] // wait for any previous pulse to end**[/u]
__ while ((*portInputRegister(port) & bit) == stateMask)__
** if (numloops++ == maxloops)**
** return 0;**
** // wait for the pulse to start**
__ while ((*portInputRegister(port) & bit) != stateMask)__
** if (numloops++ == maxloops)**
** return 0;**
** // wait for the pulse to stop**
__ while ((*portInputRegister(port) & bit) == stateMask) {__
** if (numloops++ == maxloops)**
** return 0;**
** width++;**
** }**
*/
__ if ((*portInputRegister(port) & bit) != stateMask)__
** return 0;**
__ while ((*portInputRegister(port) & bit) == stateMask)__
** width++; **
** // convert the reading to microseconds. The loop has been determined**
** // to be 20 clock cycles long and have about 16 clocks between the edge**
** // and the start of the loop. There will be some error introduced by**
** // the interrupt handlers.**
__ return clockCyclesToMicroseconds(width * 21 + 16);__