i agree , if i read this correct , i had a need to measure using pulsin the low to high then high to low , pulsin will measure the low pulse but not the immediate high to low to high duration
not all PICS have Hardware PWM . so the abilty to measure 2 pulse lengths at the same time would be VERY good
something like this command
pulsin1 pin , state , varable1 , varable2
pin = input port
State = If State is zero, the width of a low pulse is measured into varable 1, the duration of the following high pulse is held in varable2
If State is One, the width of a High pulse is measured into varable 1, the duration of the following Low pulse is held in varable2
If the pulse edge never happens or the width of the pulse is too great to measure, Var1 and var2 is set to zero.
Varable 1 , Varable 2
If an 8-bit variable is used, only the LSB of the 16-bit measurement is used. Pin may be a constant, 0 - 15, or a variable that contains a number 0 - 15 (e.g. B0) or a pin name (e.g. PORTA.0). The resolution of PULSIN1 is dependent upon the oscillator frequency. If a 4MHz oscillator is used, the pulse width is returned in 10us increments. If a 20MHz oscillator is used, the pulse width will have a 2us resolution. Defining an OSC value has no effect on PULSIN1. The resolution always changes with the actual oscillator speed
Also note chances are that you want to measure the next pulse as well and command would allow for use of pulsin looking for one state change not 2 directly preceding the above pulsin1 command
Possible ????????????????????
regards
Sheldon.
Bookmarks