Assembly( moving a servo by frequency)

In summary: Hi, thanks for taking the time to write this up. Its really helpful. I have a 9s12mini dragon processor and I am using it to drive a servo motor. 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.In summary, the user is trying to move a servo motor using frequency, but is having trouble doing so. They need help from someone more experienced in the area.
  • #1
conpeats
3
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
  • #2
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.
 
  • #3
Are you asking about driving a stepper motor with a uP(microprocessor)?
And how to program the uP?
 
  • #4
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
.
 
  • #5
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
 
  • #6
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.
 
  • #7
Is this servo motor a stepper motor?
 
  • #8
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?
 
  • #9
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
 

Related to Assembly( moving a servo by frequency)

1. How does frequency affect servo movement?

Frequency is the number of times a servo motor rotates in one second. The higher the frequency, the faster the servo will move. However, if the frequency is too high, the servo may not be able to keep up and may become unstable or jumpy.

2. Can I control the speed of a servo using frequency?

Yes, the frequency of a servo can be used to control its speed. By increasing the frequency, the servo will move faster and by decreasing the frequency, it will move slower. This is useful for precise movements or for gradually increasing or decreasing the speed of the servo.

3. How do I determine the appropriate frequency for my servo?

The appropriate frequency for a servo will depend on its specific specifications, such as voltage and torque. It is important to consult the servo's datasheet or manual to determine the recommended frequency range. Generally, a frequency between 50-200 Hz is suitable for most servos.

4. Can a servo be damaged by using too high of a frequency?

Yes, using a frequency that is too high for a servo can cause damage to its internal components. It is important to always use the recommended frequency range for the specific servo to avoid any potential damage.

5. Is there a limit to how high of a frequency a servo can handle?

Yes, there is a limit to how high of a frequency a servo can handle. This limit is usually specified in the servo's datasheet or manual. Exceeding this limit can cause the servo to become unstable or even burn out, so it is important to always stay within the recommended frequency range.

Similar threads

  • Electrical Engineering
Replies
15
Views
2K
Replies
5
Views
839
  • Electrical Engineering
Replies
10
Views
3K
Replies
7
Views
11K
  • Electrical Engineering
Replies
12
Views
1K
Replies
8
Views
2K
  • Electrical Engineering
2
Replies
49
Views
2K
  • Electrical Engineering
2
Replies
37
Views
5K
  • Electrical Engineering
Replies
3
Views
2K
  • Electrical Engineering
Replies
1
Views
969
Back
Top