Professional Documents
Culture Documents
POWER
SUPPLY
IR
REMOTE
TSOP
8051
MICRO
CONTROLL
ER
MOTOR
DRIVING
IC
TWO DC
MOTORS
WORKING OF PROJECT
In this project we are using TSOP 1738 to get the IR signal from TV
Remote and using AT89S52 microcontroller we are decoding the ir
remote code. Here we are decoding the RC5 remote, where RC5 is the
protocol in which the TV remote sends the data. Simply by using
microcontroller we are decoding the data. In RC5 protocol there are 14
bits looks like S1 S2 T A A A A A C C C C C C where S1 and S2 are
start bits default high and T is the toggle bit which toggles whenever a
new key is pressed and 5 As are address bits of the Remote and 6 Cs are
command bits of the corresponding button pressed in IR remote.
Here we are decoding the command bits and by comparing them we are
driving the motors connected to the controller through L293D which is a
dual H Bridge driver to run the motors accordingly to the pressed key.
VAR1 equ r7
;Temporary Variable
;Temp variable
;Count
;Device address
CMD
equ 13H
;Command
FLIP
bit 00H
;Flip bit
TOG
bit 01H
IR equ P3.3
MOTport
equ P2
are connected
org 00H
;Start of prog
clr TOG
main:
jb IR,$
mov VAR1,#255
djnz VAR1,$
mov VAR1,#255
djnz VAR1,$
mov VAR1,#255
djnz VAR1,$
mov VAR1,#255
djnz VAR1,$
mov VAR1,#255
djnz VAR1,$
mov VAR1,#100
djnz VAR1,$
mov c,IR
mov FLIP,c
clr A
mov COUNT,#5
fadd:
mov VAR1,#255
djnz VAR1,$
mov VAR1,#255
djnz VAR1,$
mov VAR1,#255
djnz VAR1,$
mov VAR1,#4
djnz VAR1,$
mov c,IR
rlc a
djnz COUNT,fadd
mov ADDR,A
clr a
mov COUNT,#6
fcmd:
mov VAR1,#255
djnz VAR1,$
mov VAR1,#255
djnz VAR1,$
mov VAR1,#255
djnz VAR1,$
mov VAR1,#4
djnz VAR1,$
mov c,IR
rlc a
djnz COUNT,fcmd
mov TEMP,CMD
mov CMD,a
mov a,ADDR
cjne a,#00,nvalid
mov a,TEMP
cjne a,CMD,valid;Check for valid command
nvalid:
ljmp main
valid:
clr a
mov c,FLIP
rlc a
mov TEMP,a
clr a
mov c,TOG
rlc a
cjne a,TEMP,valid1
sjmp nvalid
valid1:
mov c,FLIP
mov TOG,c
mov a,CMD
clr c
cjne a,#2,skip1
mov MOTport,#05H
ljmp main
skip1:
cjne a,#4,skip2
mov MOTport,#01H
ljmp main
skip2:
cjne a,#6,skip3
mov MOTport,#04H
ljmp main
skip3:
cjne a,#8,skip4
mov MOTport,#0AH
ljmp main
skip4:
cjne a,#0CH,exit ;Check for Stop
mov MOTport,#00H
ljmp main
exit:
ljmp main
END
;End of program