You are on page 1of 8

BLOCK DIAGRAM OF PROJECT

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 equ 10H

;Temp variable

COUNT equ 11H

;Count

ADDR equ 12H

;Device address

CMD

equ 13H

;Command

FLIP

bit 00H

;Flip bit

TOG

bit 01H

;Temp bit for flip

IR equ P3.3

;IR Receiver connected to this pin

MOTport
equ P2
are connected

org 00H

;Port at which switches

;Start of prog

mov MOTport,#00H ;switch all relays off!


mov sp,#50H

;Stack pointer initialization

clr TOG

;Clear temp bit

main:
jb IR,$
mov VAR1,#255
djnz VAR1,$
mov VAR1,#255
djnz VAR1,$
mov VAR1,#255
djnz VAR1,$
mov VAR1,#255
djnz VAR1,$

;Wait for first bit


;3.024mS delay

mov VAR1,#255
djnz VAR1,$
mov VAR1,#100
djnz VAR1,$
mov c,IR

;Read Flip bit

mov FLIP,c
clr A
mov COUNT,#5

;Count for address

fadd:
mov VAR1,#255
djnz VAR1,$
mov VAR1,#255
djnz VAR1,$
mov VAR1,#255
djnz VAR1,$
mov VAR1,#4
djnz VAR1,$
mov c,IR

;1.728mS delay for each bit

rlc a
djnz COUNT,fadd
mov ADDR,A

;Save the address

clr a
mov COUNT,#6

;Count for Command

fcmd:
mov VAR1,#255

;1.728mS Delay for each bit

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

;Save the old command

mov CMD,a

;Save the new command

mov a,ADDR

;Cheack for valid address

cjne a,#00,nvalid
mov a,TEMP
cjne a,CMD,valid;Check for valid command
nvalid:
ljmp main
valid:

;Key press check

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

;Check for FORWARD

mov MOTport,#05H
ljmp main
skip1:
cjne a,#4,skip2

;Check for LEFT

mov MOTport,#01H
ljmp main
skip2:
cjne a,#6,skip3

;Check for RIGHT

mov MOTport,#04H
ljmp main
skip3:
cjne a,#8,skip4
mov MOTport,#0AH

;Check for BACKWARD

ljmp main
skip4:
cjne a,#0CH,exit ;Check for Stop
mov MOTport,#00H
ljmp main
exit:
ljmp main

END

;End of program

You might also like