lpcware

Interfacing of stepper motor with LPC 1343

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by sanpai on Thu Oct 25 02:05:16 MST 2012
Hello Xpresso Team,

I'm new to ARM and im trying to interface stepper motor with LPC1343.

The code is building fine and the connections are proper but still we are unable to get the motor run .

The code is written below , please let us know whether the syn taxes and semantics are correct  .

ifdef __USE_CMSIS
#include "LPC13xx.h"
#include "clkconfig.h"
#include "gpio.h"
#include "config.h"
#include "timer32.h"
#endif

#include <cr_section_macros.h>
#include <NXP/crp.h>

// Variable to store CRP value in. Will be placed automatically
// by the linker when "Enable Code Read Protect" selected.
// See crp.h header for more information
__CRP const unsigned int CRP_WORD = CRP_NO_CRP ;

// TODO: insert other include files here

// TODO: insert other definitions and declarations here

int main(void) {
   
    //considering an stepper motor with an step angle of  1.8 degree
   
    //setting the pins of p2.0 to p2.3 as outputs

    LPC_GPIO2->DIR = 0x0F;

    enable_timer32(0);//enable timer 0
   
        while(1)//anticlockwise rotation
        {
            LPC_GPIO2->DATA = 0x06;
            delay32Ms(0,100);
            LPC_GPIO2->DATA = 0x03;
            delay32Ms(0,100);
            LPC_GPIO2->DATA = 0x09;
            delay32Ms(0,100);
            LPC_GPIO2->DATA = 0x0C;
            delay32Ms(0,100);
           
         }
       
    return 0 ;
}



I have attached the schematic of our circuit please check and let us know .

Outcomes