Results 1 to 11 of 11

Thread: Can someone tell me how this PIC works?

  1. #1
    Registered
    Join Date
    Dec 2004
    Location
    USA
    Posts
    16
    Downloads
    0
    Uploads
    0

    Can someone tell me how this PIC works?

    I have been looking at this app note
    http://ww1.microchip.com/downloads/e...tes/00822a.pdf
    trying to figure out how the current feedback works.

    I am not firmilure with the PIC CPU but looking at the asm code
    I cant see where it even looks at the feedback signal AIN1 and AIN3
    they go back to RA1 and RA3 but it doesnt even look like the software
    ever checks them.

    I understand the electronics it just looks to me like the program runs at
    a set current value and ignores the feedback.

    Also what do you think about the 100% on time in one phase and varing the other phase, every other microstepper driver I've seen varies both phases.

    Hope someone can help me with this.
    Thanks
    Ken


  2. #2
    Registered
    Join Date
    May 2003
    Location
    USA
    Posts
    550
    Downloads
    0
    Uploads
    0
    The Pic has hardware PWM, the code just has to set the % value and the hardware does the rest, including monitoring feedback.

    Only varying one phase? why? one you've got setup to manage one phase its just as easy to manage both. Not sure the motor would like 100% on one phase and not on the other.


  3. #3
    Registered
    Join Date
    Dec 2004
    Location
    USA
    Posts
    16
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by fyffe555 View Post
    The Pic has hardware PWM, the code just has to set the % value and the hardware does the rest, including monitoring feedback.
    I'll have to look at the data sheet again I looked for that possability but didnt see it.

    Quote Originally Posted by fyffe555 View Post
    Only varying one phase? why? one you've got setup to manage one phase its just as easy to manage both. Not sure the motor would like 100% on one phase and not on the other.
    Yeah I didnt see the logic either. It said something about maxamizing torque which I can kinda see but it seems to be using percentages that you would see
    if you were varing both.

    Thanks for the reply I am off to read the data sheet again and see what I missed.


  4. #4
    Registered
    Join Date
    Dec 2004
    Location
    USA
    Posts
    16
    Downloads
    0
    Uploads
    0
    Ok I give up I cant find anywhere in the data sheet or searching on the web
    Where the input to the compartor RA1 or RA3 affects the PWM in any way.

    Can you point me to a datasheet or appnote that explains it?

    I am trying to do this in a AVR chip because I am much more comfortable
    with them but I need to under stand how this one works first.

    Thanks
    Ken


  • #5
    Registered
    Join Date
    May 2003
    Location
    USA
    Posts
    550
    Downloads
    0
    Uploads
    0
    I'm not sure I'm following the question but from a real quick scan of the sheet the actual PWM control of the motors current is actually controlled by the L298, not the Picmicro and the pic isn't using the feedback voltage(s).

    L298 appears to be passing a sense voltage back to the 18F/C452 on AN1/RA1 AN3/RA3 but the Pic is actually setting its PWM's from a truth table based upon microstepping, speed etc and setting the duty cycle of CCP1/2 from those tables directly.

    There doen't appear to be any code to deal with AN1/2 RA1/RA3 and I don't think its doing anything with the input voltage and doesn't seem to do anything with portA at all. It might be directly loading values to registers to determine if the motor is running or what the direction is later but I didn't go that deep.

    I'm not sure thats of any help.? Hopefully someone who knows what they're talking about will be along shortly!


  • #6
    Registered
    Join Date
    Dec 2004
    Location
    USA
    Posts
    16
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by fyffe555 View Post
    I'm not sure I'm following the question but from a real quick scan of the sheet the actual PWM control of the motors current is actually controlled by the L298, not the Picmicro and the pic isn't using the feedback voltage(s).
    No the L298 does no currrent control the current though the r9 and 10 develops a voltage proportinal to the motor current and is fed back to the
    controling device L297 or micro in this case whitch varies the PWM to raise
    or lower the current.

    Quote Originally Posted by fyffe555 View Post
    There doen't appear to be any code to deal with AN1/2 RA1/RA3 and I don't think its doing anything with the input voltage and doesn't seem to do anything with portA at all.
    Thats what I thought I've looked at the code for hours and it just doesnt seem to control the current at all just spit out a PWM value and HOPE that
    its not to high for the motor.

    Quote Originally Posted by fyffe555 View Post
    I'm not sure thats of any help.? Hopefully someone who knows what they're talking about will be along shortly!
    Hey ya tried and ya got me thinking. Maybe I could use those feedbacks as an interupt trigger and manually turn off the PWM output in the ISR.

    Thanks
    Ken


  • #7
    Registered jeffs555's Avatar
    Join Date
    Jun 2004
    Location
    United States
    Posts
    463
    Downloads
    0
    Uploads
    0
    That appears to be like a lot of other Microchip app notes; good for understanding the basics, but missing a lot of stuff needed for a practical design. The part about driving one phase full on doesn't make much sense. The main reason for microstepping is smoothness, and with one phase full on and a sine on the other the torque will be varying throughout the rotation which is not the best for smooth movement. Like you, I couldn't find anywhere in the code where they were looking at the current feedback.


  • #8
    Registered
    Join Date
    Dec 2004
    Location
    USA
    Posts
    16
    Downloads
    0
    Uploads
    0
    Thanks Jeff At least I dont feal like I am missing something anymore.
    I hate app notes like that I am not smart enough to catch there mistakes


  • #9
    Registered pminmo's Avatar
    Join Date
    Jun 2003
    Location
    St. Peters, Mo USA
    Posts
    3325
    Downloads
    0
    Uploads
    0
    I'vd been through this app note before also, and come to the same conclusions on the comparitor inputs as being unused. My conclusion was it used duty cycle only current control, and that it used a VS equal to the coil voltage of the motor, thus no chopping action on 100% currents. I can't say that I subscribe to free running async duty cycle variation as a good method to do microstepping.
    Phil, Still too many interests, too many projects, and not enough time!!!!!!!!
    Vist my websites - http://pminmo.com & http://millpcbs.com


  • #10
    Registered
    Join Date
    Nov 2006
    Location
    Slovakia
    Posts
    15
    Downloads
    0
    Uploads
    0
    I read that datasheets theorethical part but didnt the code itself.

    -these comparators interrupt so theres no need to check them.
    -duty cycles are picked from the duty cycle lookup table and only the full ON phase is switched to 50percent if the comparator interrupts.
    This is what should happen,but since i didnt read the code i cant say if they really wrote the code this way.


  • #11
    Registered pminmo's Avatar
    Join Date
    Jun 2003
    Location
    St. Peters, Mo USA
    Posts
    3325
    Downloads
    0
    Uploads
    0
    Tracid,
    The code doesn't use the interrupts, they are never setup or enabled.
    Phil, Still too many interests, too many projects, and not enough time!!!!!!!!
    Vist my websites - http://pminmo.com & http://millpcbs.com


  • Posting Permissions



    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.