Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/07/07 03:38
Read: times


 
#147957 - Assembler code for driving motor
Hi, i need help for assembler code to driving a motor. I use the motor to moving an object from bottom side to upper side. In each side, i put a limit switch. Here is the description :
1. Object is in the bottom side and hit the bottom limit switch
2. When i push the start button, motor move the object to upper side.
3. Suddenly, when the object hit upper limit switch, motor move the object to bottom side.
4. When the bottom limit switch hitted by the object, motor stops to work. The operation is finished.

This is my code that i already write :
M1	bit p1.0  ;M1 and M2 is motor polarity
M2	bit p1.1
TLS	bit p1.2  ;TLS=top limit switch
BLS	bit p1.3  ;BLS=bottom limit switch
SB	bit p1.4
start:	clr M1
	clr M2
	jb SB,up
	jmp start
up:	setb M1
	jb TLS,up
	clr M1
	setb M2
down:	jb BLS,down
	clr M2
	ret	
end

The operation from this code is not work very well and there is no protection in that code which protected the object to stay in bottom for the next operation. I'm sorry if my english is bad but i hope you know what i mean.



List of 4 messages in thread
TopicAuthorDate
Assembler code for driving motor            01/01/70 00:00      
   hope this helps            01/01/70 00:00      
   start button?            01/01/70 00:00      
   you do need to debounce the switches            01/01/70 00:00      

Back to Subject List