Help with Pololu DRV8711 Stepper Motor Driver


+ Reply to Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    Sep 2006
    Location
    Florida, USA
    Posts
    94


    Did you find this post helpful? Yes | No

    Default Re: Help with Pololu DRV8711 Stepper Motor Driver

    Amgen - Thanks for your input. Yes, I have tried both Mode 0 and 1 with no luck. I have also tried reversing the SCS pin (low, shiftout, high as opposed to high, shiftout, low) and nothing there either. I still think there is something in one of the registers that I am not setting correctly...

  2. #2
    Join Date
    Sep 2006
    Location
    Florida, USA
    Posts
    94


    Did you find this post helpful? Yes | No

    Default Re: Help with Pololu DRV8711 Stepper Motor Driver

    OK - Problem solved. I went to Pololu and got help from their tech folks and they helped me figure this out. In a nutshell, it had to do with how I was creating the CTRL and TORQUE registers and sending them out. If you want to see how that all played out, just go to this link: https://forum.pololu.com/t/using-a-d...c-pro/27792/13. Don't see any reason to re-hash it here. In any event, I am now able to set the registers and control my stepper nicely. Here is my updated code that should get you started. The Pololu PNs for these boards is 3730 and 3731. Enjoy!

    Code:
    '****************************************************************
    '*  Name    : Pololu Stepper-DRV8711.BAS                        *
    '*  Author  : Jeff Wheat                                        *
    '*  Date    : 05/21/2025                                        *
    '*  Version : 1.0                                               *
    '*  Notes   : PIC16F876A                                        *
    '*          : Uses Pololu 4&8A Driver Boards                    *
    '****************************************************************
    @ DEVICE HS_OSC
        DEFINE OSC 20
    
        ADCON1 = 7 ' Set PortA Pins as I/O pins    
           
        TRISA = 0
        TRISB = 0
        TRISC = %00001111
                  
        ' Define the LCD Hookup parameters
        ' data pins D4-D7 are hooked to pins B.0-B.3, respectively
        define LCD_DREG     PORTB   'Data Port = PORTB
        define LCD_DBIT     0       'Data starting bit = 0
        define LCD_RSREG    PORTB   'Register Select Port = PORTB
        define LCD_RSBIT    7       'RS bit = PortB.7
        define LCD_EREG     PORTB   'Enable Port = PORTB
        Define LCD_EBIT     4       'Enable Bit = PortB.4
        define LCD_BITS     4       'LCD Bus Size = 4
        define LCD_LINES    2       'Number of lines on LCD
           
        MenuBtn     var     PORTC.0
        UpBtn       var     PORTC.2
        DnBtn       var     PORTC.1
        EnterBtn    var     PORTC.3
    
        DirPin  	var     PORTA.3
        StepPin 	var     PORTA.5
        SDATO       var     PORTA.1  'connect to SDATI pin on driver board
        SDATI       var     PORTA.2  'connect to SDATO pin on driver board
        SCLK        var     PORTA.0
        SCS         var     PORTC.7
        
        Icnt        var     word
        StepDelay	var	    word
        StepMode    var     byte
        NumSteps    var     word
        DataOut     var     word
        DataIn      var     word
        
        Line1       con     $80
        Line2       con     $C0
        
        LSBFirst    con     0
        MSBFirst    con     1
        
     '****************************************************************    
        low steppin
        low DirPin
        low SCS
        
        pause 500 
        LCDOUT $FE, 1 ' Clear LCD screen 
        pause 20
        
        lcdout $FE, line1, " Pololu Stepper "
        lcdout $FE, line2, " Board - DRV8711"
    
        pause 2000
        LCDOUT $FE, 1
    
        gosub InitStepper
        pause 50
        
    '    Gosub ReadRegisters
    '    Stop
        
        Numsteps = 4000
        StepDelay = 500 'uS between steps
        
    '****************************************************************
    Start:
        lcdout $FE, line1, "Dir = CW "
        
        low DIRpin 'CW
        for icnt = 1 to numsteps
            high stepPin
            pauseus 10
            low StepPin
            pauseus StepDelay
        next
    
        pause 1000
        lcdout $FE, line1, "Dir = CCW" 
    
        high DIRpin 'CCW
        for icnt = 1 to numsteps
            high steppin
            pauseus 10
            low Steppin
            pauseus StepDelay
        next
        
        pause 1000
        goto Start        
            
    '****************************************************************
    ReadRegisters:
        'Read CTRL register 000
        DataIn = 0
        DataOut = %1000  
        high SCS    
        Shiftout SDATO, SCLK, MSBFirst, [DataOut\4]      
        Shiftin SDATI, SCLK, MSBFirst, [DataIn\12]      
        low SCS  
        
        lcdout $FE, line1, bin DataIn  'Display result in binary
        
        'read TORQUE register 001
        DataIn = 0
        DataOut = %1001  
        high SCS    
        Shiftout SDATO, SCLK, MSBFirst, [DataOut\4]      
        Shiftin SDATI, SCLK, MSBFirst, [DataIn\12]      
        low SCS 
        
        lcdout $FE, line2, bin DataIn
              
        Return    
            
    '****************************************************************
    '****************************************************************
    InitStepper:    
        'TORQUE Register - Set current to 1/2 max (2A for 36v4 and 4A for 36v8)
        '         BIT0              BIT15
        'DataOut = %0 001 0 000 11011111  
        DataOut = %0001000011011111      
        high SCS
        Shiftout SDATO, SCLK, MSBFirst, [DataOut\16]   
        low SCS
        
        'CTRL Register - Enable Motor
        'DataOut = %0 000 11 11 0 0010 0 0 1
        'DataOut = %0000111100000001  'full step
        DataOut = %0000111100001001   '1/2 step
        'DataOut = %0000111100010001  '1/4 step
        high SCS
        Shiftout SDATO, SCLK, MSBFirst, [DataOut\16]       
        low SCS 
              
        return
        
    '****************************************************************
        end

Similar Threads

  1. Stepper motor question:
    By MOUNTAIN747 in forum General
    Replies: 6
    Last Post: - 20th June 2021, 23:56
  2. Motor Stepper Example
    By Melanie in forum Code Examples
    Replies: 134
    Last Post: - 3rd January 2015, 17:58
  3. Possible? to use 'SOUND' to drive a Stepper Motor Driver Board
    By rayzrocket in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 30th October 2013, 15:28
  4. Pololu Dual Serial Motor Controller
    By larzazral in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th August 2011, 05:11
  5. Stepper Motor troubles
    By Fryin in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 21st March 2007, 01:56

Members who have read this thread : 14

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