Quote Originally Posted by Andy Wood View Post
Please check this line:

loop:
IF PORTA.4 THEN ' Wait until start of low pulse


Should it be:

IF PORTA.4 = 0 THEN ' Wait until start of low pulse

Andy
- As Skimask says: I am making sure it is not starting from the middle of a period