Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

wireless moving robot

Status
Not open for further replies.
hi all,

i am new to embedded systems designing...

i am trying to move the robot in all directions using ir rays...

i am ready with the receiver part i.e of ir sensor ...

but i am lagging with the knowledge of transmitter coding and how to pass the signals with that code i.e 0's,1's ..

can any one help me out from this problem..

and also help me what to be studied to know about the wireless technologies i.e how to code and pass the signals..
 
Google search for "rc5 protocol" This protocol is used in some of the TV remote controls.
I am not sure about the transmitter coding.
But I have 1 receiver coding, I have used this 2 years before for a project "Wireless mouse using TV Remote control"
Below is the code.

Code:
TEMP	equ 10H		        ;Temp variable
COUNT	equ 11H		        ;Count
ADDR	equ 12H		        ;Device address
CMD	equ 13H 		;Command
TEMP1	equ 14H                 ;Temporary Variable 1
FLIP    equ 00H                 ;Flip bit
TOG     equ 01H                 ;Temp bit for flip
MODE    equ 02H                 ;Mouse mode/Keyboard mode default:mouse
VALID   equ 03H                 ;Valid bit
IR      equ B3h         ;P3.3   ;IR Receiver connected to this pin
;/**********************************************************************/
	
	org 00H			;Start of prog

	clr a
	mov r0,#7FH
clrram:                         ;Clearing Internal RAM
	mov @r0,a
	djnz r0,clrram
	mov sp,#50H             ;Stack Pointer setup
	mov TMOD,#20H           ;Serial port setup
	mov SCON,#50H           ;Receive enable
	mov TH1,#0FDH           ;9600, 8-N-1
	mov TL1,#0FDH
	clr TOG                 ;clear temp bit
	clr MODE                ;Set the default mode
	setb TR1                ;Start serial clock

        CALL initial_test
	
main:
	jb IR,$			;Wait for first bit
        mov r7,#255           ;3.024mS delay
        djnz r7,$
        mov r7,#255
        djnz r7,$
        mov r7,#255
        djnz r7,$
        mov r7,#255
        djnz r7,$
        mov r7,#255
        djnz r7,$
        mov r7,#100
        djnz r7,$
	mov c,IR		;Read Flip bit
	mov FLIP,c
	clr A
	mov COUNT,#5	        ;Count for address
fadd:
        mov r7,#255           ;1.728mS delay for each bit
        djnz r7,$
        mov r7,#255
        djnz r7,$
        mov r7,#255
        djnz r7,$
        mov r7,#4
        djnz r7,$
	mov c,IR
	rlc a
	djnz COUNT,fadd
	mov ADDR,A		;Save the address
	clr a
	mov COUNT,#6	        ;Count for Command
fcmd:
        mov r7,#255           ;1.728mS Delay for each bit
        djnz r7,$
        mov r7,#255
        djnz r7,$
        mov r7,#255
        djnz r7,$
        mov r7,#4
        djnz r7,$
	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
	jb MODE,key             ;Use mouse mode if Mode bit is 0
	acall mouse
	ljmp main
key:                            ;or keyboard mode if Mode bit is 1
	acall keyboard
nvalid:
	ljmp main

mouse:                          ;Routine for Mouse operation
	mov a,CMD
	cjne a,#0CH,mskip
	mov a,TEMP
	cjne a,CMD,m_valid
	ret
m_valid:
	clr a
	mov c,FLIP
	rlc a
	mov TEMP1,a
	clr a
	mov c,TOG
	rlc a
	cjne a,TEMP1,m_valid1
	ret
m_valid1:
	mov c,FLIP
	mov TOG,c
	mov a,CMD
	cjne a,#0CH,mskip
	mov a,#30H
	acall tx
	jnb RI,$
	clr RI
	mov a,SBUF
	cjne a,#'m',keymode
	clr MODE
	ret
keymode:
	setb MODE
	ret

mskip:
	cjne a,#01H,mskip1
	acall chk_valid
	jb VALID,ok1
	ret
ok1:
	mov a,#31H
	acall tx
	ret

mskip1:
	cjne a,#02H,mskip2
	mov a,#32H
	acall tx
	ret

mskip2:
	cjne a,#03H,mskip3
	acall chk_valid
	jb VALID,ok2
	ret
ok2:
	mov a,#33H
	acall tx
	ret

mskip3:
	cjne a,#04H,mskip4
	mov a,#34H
	acall tx
	ret

mskip4:
	cjne a,#05H,mskip5
	mov a,#35H
	acall tx
	ret

mskip5:
	cjne a,#06H,mskip6
	mov a,#36H
	acall tx
	ret

mskip6:
	cjne a,#26H,mskip7
	mov a,#37H
	acall tx
	ret

mskip7:
	cjne a,#38H,mskip8
	mov a,#38H
	acall tx
	ret
mskip8:
	cjne a,#10H,mskip9
	mov a,#37H
	acall tx
	ret
mskip9:
	cjne a,#11H,mskip10
	mov a,#38H
	acall tx
mskip10:
	ret


chk_valid:
	mov a,TEMP
	cjne a,CMD,ms_valid1
	ret
ms_valid1:
	clr a
	mov c,FLIP
	rlc a
	mov TEMP1,a
	clr a
	mov c,TOG
	rlc a
	cjne a,TEMP1,ms_valid
	clr VALID
	ret
ms_valid:
	mov c,FLIP
	mov TOG,c
	setb VALID
	ret	



keyboard:				;Routine for Keyboard operation
	mov a,TEMP
	cjne a,CMD,k_valid1
	ret
k_valid1:
	clr a
	mov c,FLIP
	rlc a
	mov TEMP1,a
	clr a
	mov c,TOG
	rlc a
	cjne a,TEMP1,k_valid
	ret
k_valid:
	mov c,FLIP
	mov TOG,c
	mov a,CMD
	clr c
	cjne a,#7,chk
chk:
	jnc greater
	add a,#30H
	acall tx
	ret
greater:
	cjne a,#0CH,next
	mov a,#30H
	acall tx
	jnb RI,$
	clr RI
	mov a,SBUF
	cjne a,#'m',keymode1
	clr MODE
	ret
keymode1:
	setb MODE
	ret

next:
	cjne a,#26H,next1
	mov a,#37H
	acall tx
	ret
next1:
	cjne a,#38H,next2
	mov a,#38H
	acall tx
	ret
next2:
	cjne a,#10H,next3
	mov a,#37H
	acall tx
	ret
next3:
	cjne a,#11H,next4
	mov a,#38H
	acall tx
	ret
next4:
	cjne a,#20H,next5
	mov a,#36H
	acall tx
	ret
next5:
	cjne a,#21H,next6
	mov a,#35H
	acall tx
	ret
next6:
	cjne a,#0DH,next7
	mov a,#39H
	acall tx
next7:
	ret


tx:				;Serial Transmit
	mov sbuf,a
	jnb TI,$
	clr TI
	ret

initial_test
        mov a,#'R'
	acall tx

        mov a,#'E'
	acall tx

        mov a,#'M'
	acall tx

        mov a,#'O'
	acall tx

        mov a,#'T'
	acall tx
                 
        mov a,#'E'
	acall tx
        ret
	END
 
hi all,

i am new to embedded systems designing...

i am trying to move the robot in all directions using ir rays...

i am ready with the receiver part i.e of ir sensor ...

but i am lagging with the knowledge of transmitter coding and how to pass the signals with that code i.e 0's,1's ..

can any one help me out from this problem..

and also help me what to be studied to know about the wireless technologies i.e how to code and pass the signals..
hi

i know one chip that can do it

but it is not using ir receiver

TX2B/RX2B
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top