IR data transfer

picaxester

Senior Member
Hi,
This has probably been done before, but I'll show you anyway.
The transmitter in the test circuit is an PICAXE08M. Connected to input 3 is a switch that pulls the input high when closed and a 4.7k resistor connected to ground. Output 2 goes through a 1k resistor to a NPN transistor whitch drives an IR LED through a 330 ohm resistor. Output 1 drives an led through a 1k resistor then to ground.
The receiver is the PICAXE08 with the 38khz decoder moodule connected like the pdf shows on input 3 with the 330ohm resistor, 4.7k resistor and 4.7uf cap with the download cable connected for debuging.
Every time the button the 08M transmitter is pressed it transmits the data and adds 15 to the data. The number sent will show up in the debug screen.

'PICAXE08M transmitter

b2 = 0

main:
pause 500
b2 = b2 + 15
let b0 = b2
main1:
if pin3 = 1 then IRout
goto main1


IRout:
high 1
pwmout 2,25,52 ' 38.4 kHz
pause 10
for b1 = 0 to 7
if bit7 = 1 then ir
high 1
pwmout 2,25,52
rturn: b0 = b0 * 2
pause 10
next b1
low 1
pwmout 2,0,0
goto main
ir:
low 1
pwmout 2,0,0
goto rturn


'PICAXE08 receiver

IRin:
if pin3 = 0 then go
goto IRin

go: pause 15
let b0 = 0
for b1 = 0 to 7
b0 = b0 * 2
if pin3 = 0 then skip
b0 = b0 + 1
skip: pause 10
next b1

debug b0
pause 100
goto IRin


eric
 
Top