Microstepping code picbasic pro


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1
    Join Date
    Jan 2015
    Posts
    7

    Default Microstepping code picbasic pro

    Hi there i have been reading threads about microstepping, but i dont get it clearly and i reply to some threads about it, but no body answer (i think that is because they are old threads). I have a request to anybody willing to help, i dont have a stepper driver like Big easy, but i made one with a 16f84a, i programmed it to receive a dir and step pulse from another pic, and to give the combinations to some mosfets and to the coils of the bipolar motor. At first it worked well with some weird movements sometimes, (i guess it was because of the supply or some electrical noises), but as i have been studying, im interested in programming a pic to work as a microstepper driver. Until now, i know that some pwm are required to make the required signals to operate the coils, but i dont have it very clear.

    Of course, if somebody can help me out with this in picbasic pro language i would be very grateful!. So the basic idea is:

    -Inputs:
    *Full Step
    *Half Step
    *switches to select the microstepping config (4, 8, 16, 32, etc)
    *Step
    *DIR
    *Enable
    -Outputs
    *the pwm signals to the power transistors or the Hbridges to drive the Bi Polar Motor
    *anything else needed
    I think that just one pic would control one motor, because it would be too much to ask for the three motors. I have a 16f877a and a 18f2550.

    I guess it is to much to ask, but i want to learn further about programming in picbasic pro and maybe it can be done .

    And sorry for my bad english, im from Mexico!

    Best Regards and happy holidays.

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: Microstepping code picbasic pro

    Feliz Navidad y Buenos Anos!

    I'd be more than happy to help you (so would many others), but I have zero experience with motors and PWM.

    Robert


    Edit: start by posting a schematic and your code so far, that will help us to help you.

  3. #3
    Join Date
    Jan 2015
    Posts
    7


    Did you find this post helpful? Yes | No

    Default Re: Microstepping code picbasic pro

    Oh hello there and Feliz año too!. I don't have anything yet, just all my enthusiasm to begin and learn. As I said before I have been reading and searching on the web. I found an application note from microchip about stepping and it was very well explain but the code explain their was in assembler and I don't understand a bit of that language. The link to the document is this one:

    https://www.google.com.mx/url?sa=t&s...KMe0MPOHHzXisQ

    It's very interesting actually, still I don't get anything from the code cause I know nothing about assembler. Im downloading books to learn more.

    Thank you Robert for taking your time to look at my post. Anything I find out or investigate I will feedback the thread.

    Best Regards!

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,604


    Did you find this post helpful? Yes | No

    Default Re: Microstepping code picbasic pro

    What does your hardware look like?
    Are you doing the current sensing/control with the PIC itself (ie sampling the actual current using the ADC) (no you're not if you're using the 16F84) or are you using external comparator and flip/flops to sense and regulate the current?

    When microstepping you're not only controling the currents direction thru the coil (like you are when fullstepping) but also the amplitude. If you draw the waveform of fullstepping mode out on paper you're going to get something that, with a little bit of imagination, is looking like two sine waves with a 90° phase shift between A and B. They are very crude sinewaves with only 2 "steps" to them but never the less. Now draw the waveform for halfstepping out on paper and you'll see that it looks a Little bit more like two sinewaves, still very crude sinewaves with only 3 "steps" to them but still..... What microstepping does is adding more "steps" to the sinewaves. The more "steps" you add the sinewaves the smoother the motion from the motor becomes.

    So, you need to be able to regulate the amplitude of the current thru each of the two coils in a SIN/COS relation to each other.

    /Henrik.

  5. #5


    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

  6. #6
    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 .

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, 03:28
  2. Execute Picbasic Pro code from external EEPROM?
    By CuriousOne in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 7th February 2014, 03:31
  3. sample code for AT45DB642D in Picbasic Pro
    By itsssyam in forum General
    Replies: 0
    Last Post: - 10th March 2010, 06:01
  4. Replies: 3
    Last Post: - 1st July 2008, 21: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, 22: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