Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

DC Motor Control using AVR

Status
Not open for further replies.

Ajax12

New Member
This is the code that we have used.. but it is not working.. the motor is moving very slowly and not at all according to the way we want it to.. i.e .. its not following the code. very erratic movement.



#include<avr/io.h>
#include<util/delay.h>

main()
{
DDRA|=((1<<PORTA0)|(1<<PORTA1)|(1<<PORTA2)|(1<<PORTA3));




while(1)
{
PORTA=0b00000101;
_delay_ms(100);

PORTA=0b00001010;
_delay_ms(100);

PORTA=0b00001000;
_delay_ms(100);

PORTA=0b00000010;
_delay_ms(100);
}

}

what changes must we make.. thank you :)
 
You have written 1<<POR TA3 instead of 1<<PORTA3.
Is that the Problem?
Is the Sequence for Motor Drivers OK ( 0101 - 1010 - 1000 - 0010 ) ?
 
You should really take a look at your own code BEFORE you post it asking other people for help =) I'm surprised that compiled without warnings.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top