Assembly( moving a servo by frequency)

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
8 replies · 4K views
conpeats
Messages
3
Reaction score
0
Hello,

I am building an automated sorter for a school project. I have to sort 3 different sized blocks. I am using a infrared sensor to do this, I determine the size of block on how long the beam is broken. When the size of block is determined, the circuit board moves a servo motor to a corresponding path, using frequency.

My question is what is the assembly program to move the servo motor by frequency so it goes to the correct corresponding path. Ill appreciate any help on this. Thanks for understanding.
 
Engineering news on Phys.org
Welcome to PF, Conpeats.
This is by no way anything that I have any knowledge of. What you refer to as 'sorting by frequency' is an unknown concept to me.
Although I don't know how to do it, it seems to me that you should be able to just feed the timer output to a compiler that feeds an appropriate 'kick' signal to a pair of solenoids. A #1 signal would do nothing, so as to allow a block to continue straight on; a #2 or #3 would fire the first solenoid to send it on another path; and a #3 alone would direct it elsewhere via the 2nd solenoid.
Don't worry, though; someone else will be along to help you.
 
yes. I am using a 9s12mini dragon processor. I am using it to drive a servo motor and the best way to move it for me is by frequency. I already know the frequencies i just don't know how to program it
.
 
So you need help outputting different frequencies in assembly code?

An easy way to accomplish this is using onboard timers. I'm not sure what your processor has onboard, but microcontrollers I have worked with usually have several different timers and several different timer modes. There was one timer mode that acted like an auto-reload when the timer overflowed. for example if the timer overflowed at FFFF0H, you could set it to reload to any value such as E8F10H if needed...

so you could change the reload value anywhere in code as needed to whatever you need to accomplish different frequencies
 
Since our project is an automated sorter. How we are determining to sort the blocks is by a infared sensor (sharp gp2d12-LR) and how much time it is blocked. The longer its blocked the bigger the block. Then after we determine the block size, it slides down a chute to its designated path. We move the chute to the designated path, determined by the sensor, using a servo motor. We already know the frequencies needed to put the chute to the correct path. I am having trouble with the assembly program. I don't know how to write a program to move our servo motor using a frequency.

I appreciate all your responses so far its helped some but I am a novie when it comes to assembly.
 
Is this servo motor a stepper motor?
 
can you post your motor model? could take a look and see how its driven and what you need. don't know what you mean by changing frequency, like step frequency?
 
well building off what I said before...here is some noob psuedo code of how i would do it (i'm a noob to assembly as well) and it might spark some ideas of your own..

reset timer to 0000H
wait for sensor
start timer
wait for sensor change
stop timer
store timer value
if timer value < 5 and >10 then
set timer reload value = 887AH
else
set timer reload vlaue = 189BH
end if

Timer Overflow Interrupt:
complement output

There's a very quick draft. reload values set frequency, and the continual complementing output produces your frequency. there'd be lots more you'd have to be concerned about and also many other ways to do it (like using a LUT). and depending on how you're controlling your servo there will most likely be more outputs. this was just to hopefully spark some ideas