Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

help in programming at89s51

Status
Not open for further replies.

rohit_366

Newbie level 3
Joined
Mar 19, 2013
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,329
i am building a project on atmel 89s51 to find the range from obstacle using an ultrasonic range finder and convert the distance into vibrations using dc motors but i am not very familiar with kiel please help me about it asap as its my final year project...
 

Sent Block diagram of your project. Are you using obstacle for measure a distance or detect a object ?.
 

this is the link from where i am taking refrence but in this they have added 7 segment display but i need to convert the recived range data into motor speed acoording to range min range gives max rpm and max range gives minimum rpm
https://www.circuitstoday.com/ultrasonic-range-finder-using-8051

- - - Updated - - -

i am using hc sr04 ultrasonic range finder module i have tested it on my dev board with the same program but the display shows only 100 and not fluctuate with the varying distance.

- - - Updated - - -

and i am using obstacle for the measurement this project is to help visually impaired for their navigation through indoor environment
 

its a demo code to test the hardware but i don't know how to convert the distance measurement into vibrations i am using 6 volt dc motor used in mobile for generating vibrations
ORG 00H // origin
MOV DPTR,#LUT // moves the address of LUT to DPTR
MOV P1,#00000000B // sets P1 as output port
MOV P0,#00000000B // sets P0 as output port
CLR P3.0 // sets P3.0 as output for sending trigger
SETB P3.1 // sets P3.1 as input for receiving echo
MOV TMOD,#00100000B // sets timer1 as mode 2 auto reload timer
MAIN: MOV TL1,#207D // loads the initial value to start counting from
MOV TH1,#207D // loads the reload value
MOV A,#00000000B // clears accumulator
SETB P3.0 // starts the trigger pulse
ACALL DELAY1 // gives 10uS width for the trigger pulse
CLR P3.0 // ends the trigger pulse
HERE: JNB P3.1,HERE // loops here until echo is received
BACK: SETB TR1 // starts the timer1
HERE1: JNB TF1,HERE1 // loops here until timer overflows (ie;48 count)
CLR TR1 // stops the timer
CLR TF1 // clears timer flag 1
INC A // increments A for every timer1 overflow
JB P3.1,BACK // jumps to BACK if echo is still available
MOV R4,A // saves the value of A to R4
ACALL DLOOP // calls the display loop
SJMP MAIN // jumps to MAIN loop

DELAY1: MOV R6,#2D // 1uS delay
LABEL1: DJNZ R6,LABEL1
RET

DLOOP: MOV R5,#100D // loads R5 with 100D
BACK1: MOV A,R4 // loads the value in R4 to A
MOV B,#100D // loads B with 100D
DIV AB // isolates the first digit
SETB P1.0 // activates LED display unit D1
ACALL DISPLAY // calls DISPLAY subroutine
MOV P0,A // moves digit drive pattern for 1st digit to P0
ACALL DELAY // 1mS delay
ACALL DELAY
MOV A,B // moves the remainder of 1st division to A
MOV B,#10D // loads B with 10D
DIV AB // isolates the second digit
CLR P1.0 // deactivates LED display unit D1
SETB P1.1 // activates LED display unit D2
ACALL DISPLAY
MOV P0,A // moves digit drive pattern for 2nd digit to P0
ACALL DELAY
ACALL DELAY
MOV A,B // moves the remainder of 2nd division to A
CLR P1.1 // deactivates LED display unit D2
SETB P1.2 // activates LED display unit D3
ACALL DISPLAY
MOV P0,A // moves the digit drive pattern for 3rd digit to P0
ACALL DELAY
ACALL DELAY
CLR P1.2 // deactivates LED display unit D3
DJNZ R5,BACK1 // repeats the display loop 100 times
RET

DELAY: MOV R7,#250D // 1mS delay
LABEL2: DJNZ R7,LABEL2
RET

DISPLAY: MOVC A,@A+DPTR // gets the digit drive pattern for the content in A
CPL A // complements the digit drive pattern (see Note 1)
RET
LUT: DB 3FH // look up table (LUT) starts here
DB 06H
DB 5BH
DB 4FH
DB 66H
DB 6DH
DB 7DH
DB 07H
DB 7FH
DB 6FH
END

- - - Updated - - -

on doing everything the hardware shows only 100 on the 7 segment display and sometime nothing i dont know whether the 10 microsec pusle is not getting to the sensor right or what else is not ok the program works fine on compiling it shows 0 error 0 warning in keil IDE

- - - Updated - - -

pease check the delay 1 part whether it is giving 10 microsec trigger pullse or not if not please tell me how to increase it

- - - Updated - - -

i am using 11.0592 mhz crystal please check wether in delay1 subroutine i am giving 10usec with pulse or not
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top