8051 code in C language which can be tested using KEIL, NO IDEA AT ALL!

Thread Starter

mkuls25

Joined Nov 24, 2010
10
I need to move one stepper motor forward and the other one backward at the same time that will make the motor turn right or left or indirectly I want to make the motor turn rght and left, please give me the code for it. I have to program it on 8051 microcontroller! Please help as soon as possible!
 
Read the forum rules, you must make an effort we're not a do your homework for you forum.

I'm still curious, how were you "forced" to do this? Is a kid stuck in a well and you're building the machine to get him out?
 

Thread Starter

mkuls25

Joined Nov 24, 2010
10
Read the forum rules, you must make an effort we're not a do your homework for you forum.

I'm still curious, how were you "forced" to do this? Is a kid stuck in a well and you're building the machine to get him out?
That's not a homework, I needed your help because I am in eleventh grade and I have an idea of C++, so my teacher had asked me to make a code for the above mentioned thing, that's why I am just unaware of how it functions! I just need the code so that I an give it to my friends who are also involved but they have a knowledge of hardware and not of software for which I am responsible, pleas understand! and help! It's a kind of an exhibit that they have to make for the PHYSICS EXHIBITION! and yes there is no judgement fot\r that we are no going to be awarded any thing for that! IT's kind of a compulsion! PLEASE HELP!
 

Thread Starter

mkuls25

Joined Nov 24, 2010
10
I need it as soon as possible, it's better that I get it today! I don't know why my teacher is using 8051, moreover this is the first time that I am working on a MICROCONTROLLER!
 

thatoneguy

Joined Feb 19, 2009
6,359
Same response as in other thread:

We generally do not provide completed code.

Show how far you have gotten with the project, and point out where you are having issues. Once that is done, we volunteers may help, we are NOT a homework completion service, but we are more than happy to help you step by step so you learn through the process. For this to happen, you need to show initiative, and show an ability to learn and apply what you have learned.

Too many people have gotten degrees by simply getting answers from others, which devalues a degree. You do not want your degree to be worthless, do you?
 

Thread Starter

mkuls25

Joined Nov 24, 2010
10
I absolutely agree to you, but I am just a kid, I assure you that after I finish my project I will definitely dwell into its depth, I have not gone too far I am just new! BTW I have one code that is for up and down and that is for some software like UMPS! It's for moving up and down, can you modify it? I'll post it!
 

Thread Starter

mkuls25

Joined Nov 24, 2010
10
Org0000h
glr a
mov p1,a
mov p2,a
mov p3,a

ba jnb p3.0,top
ljmp ba
top: Mov r2#255
back: Mov a,#25h
mov p1,a
acall delay
mov a,#29h
mov p1,a
acall delay
mov a,#0ah
mov p1,a
acall delay
mov a,#0,6h
mov p1,a
acall delay
djnz r2, back
mov p1,#0
setb p3,0
ljmp ba
delay: Mov r5,#8
h3: Mov r4,#8
h2: Mov r3,#8
h1: Djnz r3,h1
djnz r4,h2
djnz r5,h3
ret
end
 

retched

Joined Dec 5, 2009
5,207
That code is not using 'C' it is using Assembly language.

You are going to have a real hard time if you do not even know the difference between the two.

Have you tried searching the 8051 forums?

Or try a google search for CNC using 8051 or 8051 stepper driver.

Do you know if you are trying to control a bi-polar or uni-polar stepper motor?

If you do not know, you NEED to.

Find that out.

I would like to add:

BOY did you wait till the last minute. Should have got started a little earlier. Also, in the future, dont bite off more than you can chew.

Have you been in contact with the other people on the team?

Have you asked your parents or aunts or uncles if anyone has any experience with the 8051?

I have taken the time to search google for you.

Here:
http://www.8051projects.net/stepper-motor-interfacing/stepper-motor-connections.php

There is all you need to know to get it going, including C code.

You NEED to find out what type of stepper you are using.
 

Kermit2

Joined Feb 5, 2010
4,162
It may just be that you should admit to your teacher that you exaggerated your ability in programming with C+ and you are not able to do this project.

Poor planning in your situation, does not create any urgency to help on our end.
 

retched

Joined Dec 5, 2009
5,207
It may just be that you should admit to your teacher that you exaggerated your ability in programming with C+ and you are not able to do this project.

Poor planning in your situation, does not create any urgency to help on our end.
Agreed.

If you continue along this path of exaggeration without planning and good organization skills, you will end up dying of heart trouble early in life, or being medicated for panic-attacks throughout life.

Just because there is an internet, and it IS possible to learn anything does NOT mean you will understand and be able to absorb the information as displayed.

Can you fix my jet engine? Ill give you $10,000 plus parts.

You may think "Sure, I can find out how online and learn it as I go!"

You are completely disregarding one VERY IMPORTANT THING.

You are forgetting about experience. Experience counts more than free floating information.

Anyway, I hope you get it together.

The link I posted can get you in the right direction IF you know what type of stepper motor you are using.

You probably accepted the role of programmer without knowing there was a difference. This is where experience would have come in handy.
 
Top