Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[Moved] programing of Atmega8l 8pu

Status
Not open for further replies.

angel.angel

Member level 1
Joined
Jan 23, 2013
Messages
36
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
India
Activity points
1,533
hi
I m trying to program the atmega8l Ic to drive two geared motor with four input signal of the sensor. It is my first time to deal with programing of an IC. so can u telll me how can I program it in C++. Can any one provide me any like related to it or a program of it in c++.Thax in advance.
 

Re: programing of Atmega8l 8pu

I wonder what happened to the blinky projects , everyone want to do something fancy as a first project.

C++ seems like an overkill for such a small device , I think you should start using C.

This section https://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewforum&f=11 is full of tutorials.
When you learn the basics about I/O control , interrupts, timers you will be better prepared to deal with your project.
 
Re: programing of Atmega8l 8pu

Thanks a lot my dear friend. I'll try.
 

Re: programing of Atmega8l 8pu

I have tried............ but I have the proble that how can I define the input terminal of IC.
 

Re: programing of Atmega8l 8pu

Please elaborate, do you mean the port pins of the mcu?

This can help

- - - Updated - - -

If you intend to connect a led to any mcu pin make sure that you connect a resistor to limit the current, about 220-270 ohm for 5v
 
Re: programing of Atmega8l 8pu

Thanks dear friend. The information provided by u is veryhelpfull to me. I m trying to write the a program by using the instruction provided in tut. thas a lot.:smile:
 

Re: programing of Atmega8l 8pu

hey my dear friend
Im trying to make a program to drive two motor on the basis of information which is provided by u. Can u cheack it at step I m wrong. Thax..............

- - - Updated - - -

To drive two motor by ATmega8L -8pu
Code:
int main() // The main function
{
DDRD = 0d11111111; // Set all the pin of portD as output
DDRB = 0b00000000; // Set all the pin of portB as input 
While(DDRB = 0b00001111) 
{
PORTD = 0d00000101; // both motor rotate Clock Wise
}
While (DDRB = 0b00001101)
{
PORTD = 0d00000100; // left motor stop and right motor rotate CW
}
While(DDRB = 0b00001100)
{
PORTD = 0d00000110; // left motor CW and right motor counter clock wise (CCW)
}
While (DDRB = 0b00001011)
{
PORTD = 0d00000001; // left motor CW and right motor stop
}
While (DDRB = 0b00000011)
{
PORTD = 0d00001001; // left motor CW and right motor CCW
}
}
 
Last edited:

Re: programing of Atmega8l 8pu

This will not compile because you haven't used a single semicolon

Please use code tags when you post code
 
Re: programing of Atmega8l 8pu

okey dear friend.....
 

Re: programing of Atmega8l 8pu

Your edited code seems fine.
What kind of driver do you use for the motors?
 

Re: programing of Atmega8l 8pu

Code:
To drive two motor by ATmega8L - 8pu
int main() // The main function
{
DDRD = 0d11111111; // Set all the pin of portD as output
DDRB = 0b00000000; // Set all the pin of portB as input 
While(DDRB = 0b00001111) 
{
PORTD = 0d00000101; // both motor rotate Clock Wise
}
While (DDRB = 0b00001101)
{
PORTD = 0d00000100; // left motor stop and right motor rotate CW
}
While(DDRB = 0b00001100)
{
PORTD = 0d00000110; // left motor CW and right motor counter clock wise (CCW)
}
While (DDRB = 0b00001011)
{
PORTD = 0d00000001; // left motor CW and right motor stop
}
While (DDRB = 0b00000011)
{
PORTD = 0d00001001; // left motor CW and right motor CCW
}
}

- - - Updated - - -

I m using IC L293D as a motor driver to drive gear motor

- - - Updated - - -

Do u have any other suggestion for motor driver.
 

Re: programing of Atmega8l 8pu

If the current it provides is OK then you are fine, if you need more current there is L298
 
Re: programing of Atmega8l 8pu

thanks......................................
 

I m facing an problem related to ISP data cable 10 pin name .............. can u tell me what is the meaning and word of 'NC' pin shown in figure.
 

hey
I m facing a problem during the programing of atmega8l-8pu. Actualy in atmega 8l there are only 3 PWM out put pin, but I want to drive my two gear motor that need four output pin. Now What should I do? Please tell me. thax in advance.
 

I m facing an problem related to ISP data cable 10 pin name .............. can u tell me what is the meaning and word of 'NC' pin shown in figure.

NC are no connect, they are not used.
For programming the used connections are Vcc, GND, MISO, MOSI, SCK, RESET

Actualy in atmega 8l there are only 3 PWM out put pin, but I want to drive my two gear motor that need four output pin. Now What should I do?
Either get another model with more PWM outputs or use software PWM
 
thx. Now I m trying to connect ISP AVR programer to my lap but connection failed error is comming. An toolchain is not installed............ this kind of error is also comming ...... so can you help me how can I install the tool chain in avr studio 4
 

Which programmer are you trying to use?
Which version of AVR studio 4 did you install?
 

This is the error which is now comming in the massage box..........Loaded plugin AVR GCC
Loaded partfile: C:\Program Files (x86)\Atmel\AVR Tools\PartDescriptionFiles\ATmega8.xml
gcc plug-in: Output directory C:\Users\Amar\Desktop\default\ does not exist
gcc plug-in: Created directory C:\Users\Amar\Desktop\default\
AVR Simulator: Please wait while configuring simulator...
AVR Simulator: ATmega8 Configured OK
Loaded objectfile: C:\Users\Amar\Desktop\default\hari2.elf
 

Which programmer are you trying to use?
Which version of AVR studio 4 did you install?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top