Microstepping code picbasic pro


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: Microstepping code picbasic pro

    A very long time ago I rotated a bipolar stepper motor with adjustable speed.
    I then found the speed I needed and preset it to 10. That's why I commented out the ADCIN commands.
    The outputs turn on FET's to drive the motor. Hope this helps.

    'COMPILED FOR 12F675
    ANSEL = 0 'all inputs digital
    CMCON = 7 'comparators off
    trisio = %00010000 'ALL OUTPUTS EXCEPT GPIO.4 SPEEDPOT
    DEFINE OSCCAL_1K 1 ' Set OSCCAL for 1K device to accurize osc
    @ DEVICE MCLR_OFF, INTRC_OSC, WDT_ON, BOD_ON, PWRT_ON, PROTECT_ON
    GPIO = 0
    SPEEDPOT VAR BYTE


    START:
    LET SPEEDPOT = 10
    Low GPIO.4
    High GPIO.2
    'ADCIN 3,SPEEDPOT
    Pause SPEEDPOT
    Low GPIO.0
    High GPIO.1
    'ADCIN 3,SPEEDPOT
    Pause SPEEDPOT
    High GPIO.4
    Low GPIO.2
    'ADCIN 3,SPEEDPOT
    Pause SPEEDPOT
    High GPIO.0
    Low GPIO.1
    'ADCIN 3,SPEEDPOT
    Pause SPEEDPOT
    GoTo START

  2. #2
    Join Date
    Jan 2015
    Posts
    7


    Did you find this post helpful? Yes | No

    Default Re: Microstepping code picbasic pro

    I don't have a hardware configuration yet, and about the sine/cosine relation I have been reading. The thing is that I don't know how to output this software configuration through the pic. And yes, the pic should do the sensing of the current, throw the corresponding pwm signals to the coils and the combination to make the steps. I want to know if it is possible to program this to the pic via picbasicpro, because I heard of some limitations it has against assembler (in the ccpm modules I read). And if it is possible to do, how to start. Actually I am studying about assembler just to comprehend the code in the application note that I shared in a previous reply.

    Best regards and thank you all people for helping .

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default Re: Microstepping code picbasic pro

    Hi,
    It's possible to do with a PIC and PBP but it's not an easy task and not a suitable beginners project to implement the current control within the PIC itself.

    A much easier (but still not a beginners project IMO) is to use an exernal driver with integrated PWM current control (such as the L6207 though there are many alternatives) and then use the PIC to generated the apropriate phase- (digital) and current reference (analog) signals.

    You'd then use the two CCP modules to generate the two current refernce signals (SIN/COS) and a couple of I/O's to drive the digital inputs of the driver chip.

    As for generating the SIN/COS reference signals there's been more than a couple of threads on this forum regarding that specific task (though it usually involves a student who's final project is to build a three phase inverter or motor drive), if you search the forum I'm sure you'll find a couple of threads that might be of interest.

    What size of motor are we talking about here? Is a little NEMA11 with a rated current of couple of hundred mA and a suitable voltage of <24V or is it a NEMA56 which will need a hundred volts or more and currents in 10A range?

    /Henrik.

  4. #4
    Join Date
    Jan 2015
    Posts
    7


    Did you find this post helpful? Yes | No

    Default Re: Microstepping code picbasic pro

    It is a Nema 23 with 2.3 amp per phase, and 1.8 V (but as i have been reading, it is better powered by a higher voltage supply, hence the current control you mentioned). Another subject that is not clear to me is the current control and microstepping, how can you implement it together or if one is dependent from the other one. not sure about it

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default Re: Microstepping code picbasic pro

    Hi,
    Microstepping relies on good, precise current control/regulation, that's the whole point with microstepping. You move the rotor from one full step position to the next by gradually changing the currents in the two coils as opposed to fullstepping where you just reverse the polarity/direction of current.

    With a chip like the L6207, it handles the current control/regulation. It'll be your job to tell it how much current at any individual microstep and feed that to the two VRef inputs.

    You don't want to implement the current control/regulation in the PIC.

  6. #6
    Join Date
    Jan 2015
    Posts
    7


    Did you find this post helpful? Yes | No

    Default Re: Microstepping code picbasic pro

    Ok but the microstepping thing, it can be done with the pic right? And actually use it as the control of the motor, and the chip you mention or the l298 can do the driving. So I could make a board with both things, control and driving, and from parallel port control the motion.

  7. #7
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: Microstepping code picbasic pro

    Technically you can do practically anything with PICs and PBP. The limits are your budget, skill, access to parts and patience.

    I will build a small light-duty CNC machine using PICs, once I do all the tasks I've already started.

    Robert

Similar Threads

  1. PicBasic Pro code to drive MCP4291 DAC?
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 14th July 2015, 04:28
  2. Execute Picbasic Pro code from external EEPROM?
    By CuriousOne in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 7th February 2014, 04:31
  3. sample code for AT45DB642D in Picbasic Pro
    By itsssyam in forum General
    Replies: 0
    Last Post: - 10th March 2010, 07:01
  4. Replies: 3
    Last Post: - 1st July 2008, 22:07
  5. Anyone have ADS1100 I2C PicBasic Pro code example
    By ScaleRobotics in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 7th March 2006, 23:13

Members who have read this thread : 0

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

Tags for this Thread

Posting Permissions

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