Hi guys , well this one has got me thinking , and i am not sure how i may get around it , so a bit of advise on the code would be good

IR data train is as follows

seq is normally high , low for 9ms ,high for 4.5ms, low for 560us , high for data etc ,etc then at end it goes low for 9ms , high for 2.5ms, low for 560us , high for etc etc for 2nd key data block seq , and then repeats entire IR train

the problem is i need to measure duration of low of 9ms , then the high duration of 4.5ms

the high duration length ( 4.5ms or 2.5ms ) after the low 9ms determined if its the 1st or 2nd key within the same pulse also if its blank repeat of key 1

the first Pulsin command gets the pulse length of 9ms ok , but the 2nd pulsin command will not measure the high duration until the next high going pulse.

any suggestions on how to get the length of both the 9ms low and then the high 4.5ms pulse

The 2nd pulsin command as shown below is not working as required

cheers

Sheldon


Code:
leader  var word
leader1 var word


Main: 
 
  PULSIN GPIO.0,0,Leader  ' leader pulse is ~9mS low-going on port 0 
  IF Leader < 850  tHEN  main

  pulsin GPIO.0,1,Leader1      ' check for 1stkey seq only no repeat headers 
  
 if leader1 < 300 then Main  ' if high for < 300 (2.4ms then its the 2nkey)