I am trying to get the PIC to read the command portion of the sony protocol. I checked on the oscilloscope that the signals were correct. I also was able to determine that the PIC was reading the first pulse of the incoming signal but I can not figure out how to get it to return the 7 digit command out the serial pin.
Code:
pulse var Word
x var byte
signal var word
ANSEL = %00000000
Start:
Pulsin PORTC.3, 0, pulse
if (pulse < 220) or (pulse > 260) then start
signal = 0
x = 1
Loop:
pulsin PORTC.3, 0, pulse
if (pulse > 90) then ADD_X
READ_IR:
x = x * 2
if (x = 255) then start
serout PORTC.2, 2, [#signal]
goto loop
ADD_X:
signal = signal + x
goto read_ir
end
Bookmarks