I'm not sure what you are asking but here's a code snippet that captures the 4 bytes represented by the Hitachi (same as NEC) code.
Code:
IR VAR byte[4]
pulses VAR byte[33]
BitMask VAR byte
i VAR byte 'loop index
b VAR byte 'byte index
LeadIn VAR word 'start pulse
loop: PulsIn GPIO.1, 0, LeadIn
If LeadIn < 855 Then loop
If LeadIn > 1045 Then loop
For i = 0 TO 32
PulsIn GPIO.1, 1, pulses[i]
Next
For i = 1 To 32
If (pulses[i] < 40) Or (pulses[i] > 200) Then
Goto loop
EndIf
b = i >> 3 '0,1,2,3
If pulses[i] > 99 Then
IR[b] = IR[b] | BitMask 'set bit
EndIf
BitMask = BitMask << 1 '$01,$02,$04,$08,$10,$20,$40,$80
If BitMask = 0 Then BitMask = $01
Next
At this point IR[0:3] contain the data.
Bookmarks