.

INCLUDES RFID interfacing with avr GPS interfacing with avr RF Module interfacing with avr Stepper Motor With AVR

Saturday, December 17, 2011

DRIVING STEPPER MOTOR WITH ATMEGA16

#include
#include
#define F_CPU 800000UL
#include



void main()
{

  DDRD = 0xFF;            
  PORTD = 0x00;   

  while(1)
  {           
                //half stepping mode
                /*PORTD = 0x0C;
                _delay_ms(30);
                PORTD = 0x06;
                _delay_ms(30);
                PORTD = 0x03;
                _delay_ms(30);
                PORTD = 0x09;
                _delay_ms(30);*/
               
                //full torque mode

                PORTD = 0x08;
                _delay_ms(50);
                PORTD = 0x0C;
                _delay_ms(50);
                PORTD = 0x04;
                _delay_ms(50);
                PORTD = 0x06;
                _delay_ms(50);
                PORTD = 0x02;
                _delay_ms(50);
                PORTD = 0x03;
                _delay_ms(50);
                PORTD = 0x01;
                _delay_ms(50);
                PORTD = 0x09;
                _delay_ms(50);

                } 
}
CIRCIUIT:-




 

No comments:

Post a Comment