Assembly( moving a servo by frequency)

Click For Summary

Discussion Overview

The discussion revolves around programming a servo motor to sort blocks based on size using an infrared sensor. Participants explore how to implement this using assembly language and frequency control, focusing on the technical aspects of interfacing a microprocessor with the servo motor.

Discussion Character

  • Technical explanation
  • Exploratory
  • Homework-related

Main Points Raised

  • One participant describes their project involving sorting blocks using an infrared sensor to determine size based on the duration the beam is interrupted.
  • Another participant expresses unfamiliarity with the concept of "sorting by frequency" and suggests using solenoids to direct the blocks instead of a servo motor.
  • A question is raised about whether the participant is asking about driving a stepper motor with a microprocessor.
  • The original poster confirms they are using a 9s12mini dragon processor to drive a servo motor and seeks guidance on programming it by frequency.
  • One participant suggests using onboard timers to output different frequencies and discusses the concept of timer overflow and reload values for frequency adjustment.
  • The original poster elaborates on their sorting method and reiterates their need for help with the assembly program to control the servo motor using frequency.
  • Another participant inquires whether the servo motor is actually a stepper motor and requests clarification on the meaning of "changing frequency."
  • A participant provides pseudo code as a potential approach to programming the servo motor, emphasizing the need for timer management and output control, while noting that there are multiple ways to achieve the desired functionality.

Areas of Agreement / Disagreement

Participants have not reached a consensus on the best approach to program the servo motor. There are differing views on the use of solenoids versus servo motors, and the discussion includes various suggestions and questions regarding the implementation details.

Contextual Notes

There are limitations in the discussion regarding the specific capabilities of the 9s12mini dragon processor and the exact nature of the servo motor being used. Additionally, the pseudo code provided is not fully fleshed out and may require further refinement.

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.
 
Are you asking about driving a stepper motor with a uP(microprocessor)?
And how to program the uP?
 
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
 

Similar threads

  • · Replies 15 ·
Replies
15
Views
3K
Replies
7
Views
12K
  • · Replies 10 ·
Replies
10
Views
4K
Replies
8
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
Replies
20
Views
3K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 37 ·
2
Replies
37
Views
7K