Discussion in "8051 Discussion Forum" started by    tran2000    Sep 17, 2010.
Fri Sep 17 2010, 07:50 am
#1
Hey, i am doing a project for school and i am using the 8051 chip and assembly language. I need to somehow get the Sharp proximity IR sensors working so that once it triggers because of it being to close to a wall and it will cause my robot to turn or do something else. How would i go about doing this. Please help if possible. Thanks
Fri Sep 17 2010, 09:35 am
#2
there r ready made ir transmitter and reciever in a module normally uses in lifts (elevator)
cny75 is a optocoupler is response when anything comes in front of it window
Sat Sep 18 2010, 03:26 am
#3
Thanks for the help. I was just trying to see how i would program my C8051F330 to check my port for the high or low and then tell the program to jump to another routine or function. Sorry, i'm not the greatest at programming these things.
Sat Sep 18 2010, 10:03 pm
#4
programming depends on type of sensor you're using. You can make use of IR LED with Photo transistor to make a simple proximity detector. it will be of nominal range not a high range. for high range you can use IR proximity detector pairs. There are direct modules available in market.

[Topic moved to 8051 Discussion forum]
Sat Sep 18 2010, 10:05 pm
#5
it mean u want to help according to programming of C8051F330
ok first tell about your ir sensor ur going to use
 tran2000 like this.
Sat Sep 18 2010, 10:39 pm
#6
Thank you guys for all the possible help so far. I can't believe there are this many replies. I am doing this project for school and its a little harder for me because of my lack of programming assembly code knowledge.

I will be using the sharp analog ir sensors from sparkfun. I will be using three sensors so as soon as one sensor is triggered, it will jump to a routine to make the robot turn another direction. I just need to know how to set up a port to check for the high or low and then a jump command to go to a specific routine to turn left or right.

The sensor i will be using is here http://www.sparkfun.com/commerce/product_info.php?products_id=8959

And i will be using assembly language with the C8051F330 or C8051F342 MC.

Thanks again.
Sun Sep 19 2010, 12:29 am
#7
hi tran2000
it is better u don't see here for any one that do coding
you start it step by step
everyone has a less programming capabilities in start with respect to time these improved
any how u start with basics as u post the sensor link above
it is anlog output sensors so u need to adc programming
but before doing that u should do simple led blinking program to get started
i am uploading a pdf may be it is helpful to u to start
Sun Sep 19 2010, 08:42 am
#8
I know how to do some programming. I programmed my controller to use my H-bridge to move two motors on my robot. So i do understand how to program a little bit. But i need some help on how to add a jump bit so it can check a port on the controller for a high or a low signal and then if its high, jmp to a routine. Thats what i need help with, not the basics.
Sun Sep 19 2010, 01:29 pm
#9
ok i am supposing that u want to use p1.0 pin for checking then code is as following

org 00h
mov p1,#0ffh
back:
jnb p1.0,zero

; ur code shoulb be here if pin p1.0=1

jmp back
zero:
; ur code shoulb be here if pin p1.0=0
;
;
;
jmp back


[ Edited Sun Sep 19 2010, 01:30 pm ]
Sun Sep 19 2010, 09:16 pm
#10
Thank you. But i have a little questions. is that "mov p1" suppose to be mov p1.0? and i dont' have to use "setb p1.0" after "org 00h"

Could i use the code below and just create a routine for the Turnleft and Continue for the code below?

ORG 0H

SETB P1.5 ; make P1.5 an input

AJMP Turnleft

AGAIN: JNB P1.5, AGAIN ; get out when P1.5 = 0

AJMP Continue

END

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Astorne
Tue Apr 16 2024, 08:52 pm
Williamjaf
Tue Apr 16 2024, 12:25 pm
best_yyPa
Tue Apr 16 2024, 09:42 am
ErnestoExpop
Tue Apr 16 2024, 02:57 am
Jamesclepe
Mon Apr 15 2024, 11:10 am
Aliciaelora
Mon Apr 15 2024, 07:59 am
btaletvpcu
Mon Apr 15 2024, 04:36 am
UbvpwcTib
Mon Apr 15 2024, 03:13 am