PBP IF,THEN help


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Jun 2007
    Posts
    24


    Did you find this post helpful? Yes | No

    Default Labels

    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

  2. #2
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    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

  3. #3
    Join Date
    Sep 2009
    Location
    Olympia, WA
    Posts
    5


    Did you find this post helpful? Yes | No

    Default

    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

  4. #4
    Join Date
    Sep 2009
    Location
    Olympia, WA
    Posts
    5


    Did you find this post helpful? Yes | No

    Default PIC schematic

    As requested, here is the schematic for the motor controller section.

    -Paul
    Attached Images Attached Images

  5. #5


    Did you find this post helpful? Yes | No

    Default

    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.

  6. #6
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    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

Similar Threads

  1. PBP Book
    By Bruce in forum Off Topic
    Replies: 83
    Last Post: - 4th October 2021, 12:55
  2. Extensions to PBP variables
    By John_Mac in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 23rd October 2009, 05:21
  3. Compiler differences between PBP 2.33 & 2.46
    By nikopolis in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd May 2006, 19:01
  4. Newby- PBP wont compile for 18F (MPLAB)
    By jd76duke in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th December 2005, 23:30
  5. PBP / XP Crash
    By pondindustrial in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 27th November 2005, 03:16

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts