Discussion in "Project Help" started by    bacha    Oct 18, 2007.
Mon Oct 22 2007, 11:59 pm
#11
I want you to take a look at stepper motor tutorial to help you with the coding.. it will teach you all the necessary things that you need to know when you are working with stepper motors.. ok!
your coding for rotating a motor is wrong thats the reason i am saying check the tutorial one more time.. where as your circuit seems perfectly fine
Fri Oct 26 2007, 01:15 am
#12
ok thnx for the great info

well here is my another try

tell me if there are ne other changes need to be made to this coding

/*when we sw=1 stepper motor works if its sw=0 it RESET IT */
org 00h
main:clr p2.7 /*this bcz if the bit is high it will be clred*/
setb p2.7 /*this port as input*/
mov a,#99h
mov p1,a
turn:
jnb p2.7,reset /*if switch is high than it will rotate right if low it will go to reset codition*/
rr a /*FOR RIGHT ROTATION AT FULL STEP SEQUENCE */
acall delay
mov p1,a
sjmp main1


/*THIS SECTION IS FOR PORT BE TO ROTATE DA STEPPER LEFT*/
main1:
clr p2.6 /*this bcz if the bit is high it will be clred*/
setb p2.6 /*this port as input*/
mov a,#33h /*FOR LEFT ROTATION AT FULL STEP SEQUENCE */
mov p1,a /*VALUE MOVED TO PORT */
turn2:
jnb p2.6,reset /*IF THE BIT IS HIGH IT ROTATES LEFT IF NOT HIGH IT JUMPS TO RESET CONDITION*/
rl a
acall delay
mov p1,a
sjmp main2

/* UP & DOWN */
/*THIS SECTION IS FOR PORT BE TO ROTATE DA STEPPER RIGHT*/
main2:
clr p2.5 /*this bcz if the bit is high it will be clred*/
setb p2.5 /*this port as input*/
mov a,#99h /*FOR LEFT ROTATION AT FULL STEP SEQUENCE */
mov p1,a /*VALUE MOVED TO PORT */
turn3:
jnb p2.5,reset /*IF THE BIT IS HIGH IT ROTATES LEFT IF NOT HIGH IT JUMPS TO RESET CONDITION*/
rr a
acall delay
mov p1,a
sjmp main3


/*THIS SECTION IS FOR PORT BE TO ROTATE DA STEPPER LEFT*/
main3:
clr p2.4 /*this bcz if the bit is high it will be clred*/
setb p2.4 /*this port as input*/
mov a,#33h /*FOR LEFT ROTATION AT FULL STEP SEQUENCE */
mov p1,a /*VALUE MOVED TO PORT */
turn4:
jnb p2.4,reset /*IF THE BIT IS HIGH IT ROTATES LEFT IF NOT HIGH IT JUMPS TO RESET CONDITION*/
rl a
acall delay
mov p1,a
sjmp main

reset: /*when switch=0 IT CLRS PORT VALUES TO ZERO AND CLR DA SWITCH TO 0 AGAIN */
mov a,#00h
mov p1,a
clr p2.6
sjmp main1

delay:
mov r0,#4
h1:mov r1,#0ffh
h2:djnz r0,h2
ret
end



ive attached two stepper motors on P1.....do i need to specify which motor shud operate on P1 wen i press the buttons?
cuz i think both will operate weneva i press any of the four controlling buttons on P2 :-s
Fri Oct 26 2007, 10:49 am
#13
I do not remember what exactly you are trying to do..
but.. before going straight into the program.. i want you to first try writing a simple program just to check whether the motor is rotating or not.. because you need to find the right set of coils to be activated with the sequence.. so first try to run the motor in forward and then reverse direction after you are done with this.. i will guide you how to move further.. also please tell me in brief what you want to do in your project.
So all you need to do now is.. write a small program to run the motor in forward direction.. then.. simply change the instruction RR A to RL A to reverse the direction of motor. I will be waiting for the results...!
Sat Oct 27 2007, 12:48 pm
#14
port 2.7,2.6,2.5,2.4 are used as inputs to drive two stepper motors

wen i press the button on port 2.7 it will activate one of the stepper to rotate right and on pressing 2.6 it will rotate left.

same is the case with the rest of the two buttons and interfaced stepper


one stepper is used to rotate the head of the robot in left n right directions

and the other to rotate the head in up n down manner
Sat Oct 27 2007, 02:50 pm
#15
yeah i understood.. but did you check whether the motors are rotating or not?
I am telling you to write a simple code to rotate both the motors to check whether the connections and codes are ok or not...
then i will tell you what you need to do according to your requirements. I am waiting for results!

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

KevinTab
Sun Apr 28 2024, 05:35 am
Tumergix
Sun Apr 28 2024, 12:59 am
StevenDrulk
Sat Apr 27 2024, 08:47 pm
StephenHauct
Sat Apr 27 2024, 09:38 am
Adamsaf
Sat Apr 27 2024, 07:12 am
Robertphype
Sat Apr 27 2024, 12:23 am
ktaletrryp
Fri Apr 26 2024, 10:55 pm
Robertrip
Fri Apr 26 2024, 11:20 am