Moving DC motor in all direction(AVR)

In many projects you may want to control a DC motor with Atmega32 microcontroller.A dc motor is a electromechanical device that converts electrical energy into mechanical energy.The Dc motor is derived by the L298 driver IC because a microcontroller can’t supply the current required for the working of DC motor. Atmega32 microcontroller can source or sink currents up to 40mA but a DC motor needs current very much more than that and also The operating voltage of the DC motor may be much higher than the operating voltage of the microcontroller.L293D can provide up to 600mA current, in the voltage raging from 4.5 to 36v.

PROTEUS DESIGN

CODE

/*
 * dc_motor.c
 *
 * Created: 10/3/2014 10:42:35 AM
 *  Author: rohit
 */ 
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
    DDRD=0xff;
    while(1)
    {
        PORTD=0b00001010;
        _delay_ms(1000);
        PORTD=0b00000101;
        _delay_ms(1000);
        PORTD=0b00001000;
        _delay_ms(1000);
        PORTD=0b00000010;
        _delay_ms(1000);
        PORTD=0b00000000;
        _delay_ms(1000);
    }
}

VIDEO


 

Category: 

Share

Who's new

  • ravirajpatil871...
  • shubhambajoria
  • yassir
  • demiholyman890954
  • scottgillum51169040

Get Notified

 

Share

We are Social

Syndicate

Subscribe to Syndicate