Don't know if it's just a typo, but the sub-routine labels need colons.
CCWCENTER:
CWCENTER:
I don't think they work otherwise
Mike
Don't know if it's just a typo, but the sub-routine labels need colons.
CCWCENTER:
CWCENTER:
I don't think they work otherwise
Mike
paulcox82, Is there any dynamic braking on the motor drive circuits? How big is the motor and is there any gearing involved? Where is the pot in relationship to the motor(ie, any gears in between?) I dont beleive 100 milliseconds is enough to stop the motor especially if there is no dynamic braking of the motor itself.. How long does it take for the motor to come to a complete stop after commanding to shut off? This time should be the minimum time for the "off delay" and the travel in degrees should be the minimum for the comparators sensing position... Could you please supply a circuit diagram to better understand the drive?
Dave Purola,
N8NTA
Mike,
The missing colons were a typo. Thank you. I added them, but still have the same issue.
Dave,
The motor is a small piezo driven motor that will eventually move through some gearing, but very slowly. On the order of 2 RPM. I am simulating the motor position potentiometer by moving an external pot by hand. I will increase the wait periods between motor movements and let you know the results.
Thanks for the help.
Paul
As requested, here is the schematic for the motor controller section.
-Paul
I can't help but think your solution is overly complecated...
if i got you right you've got POT's setup (6 i believe?) to measure some sort of angles () and feed these into a comparator which i'm assuming has some sort of reference pot so that you can tune it to the angle you want.
Your then reading the output from your comparators from your pic and controlling a set of motors...
Far too complecated...
if i may, can i surgest a more acurite way...
Something like a pic16F877A has 8 analogue ports that can read a POT directly...
So, use 10K or 100K pots, connect one end of pot to +5V the other to ground and the middle pin goes to your ADC port (acts as a voltage devider)...
In the program you read the ADC, if it's anything other than 2.5volts (50% of the ADC max value) then it's off center and you can take action directly with the pic...
You will find this method much more precise as it will measure less than 1 deg off center...
Also, if you are measuring say pitch and roll, you therefor only need two pots and 4 outputs (2 per motor)...
I'f i've got what your trying to do completely wrong then tell me...
:edit
Actually, the pic your using has 4 analogue lines...
Last edited by comwarrior; - 25th September 2009 at 23:01.
paulcox82, comwarrior beat me to the final suggestion.. Why not use the internal A/D and just read the pot position directly. This way you can eliminate all of the comparators and hystorisis involved with them. That way you can place different limits on the position of the actuator and possibly in the future make the output PWM controlled with a PID closed loop. The bang,bang approch must account time wise for the braking and acceleration of the motor and also different loads on the actuator. This can be solved with the use of a PID control loop and PWM control of the actuator.. There are quite a few examples here on the forum. Type in the keywords Motor PWM and PID....
Dave Purola,
N8NTA
Bookmarks