Society of Robots - Robot Forum

Software => Software => Topic started by: cannon on April 11, 2009, 11:41:38 PM

Title: help me with ATmega32..
Post by: cannon on April 11, 2009, 11:41:38 PM
I had successfully completed d $50 robot with ATmega8..
when i try to do d same using ATmega32, i cant program it correctly..
I hav been using the same code as be4..
I just changed d pin numbers to that of 32..
shd i change the SoR_utils, etc to make it wrk for 32??
pls help..
Title: Re: help me with ATmega32..
Post by: Razor Concepts on April 11, 2009, 11:44:57 PM
Change the MCU name in the makefile to atmega32
Title: Re: help me with ATmega32..
Post by: cannon on April 11, 2009, 11:53:56 PM
did tht..
wht i basically wanna knw is whether it wil wrk with the old header files??
Title: Re: help me with ATmega32..
Post by: Razor Concepts on April 12, 2009, 12:54:03 AM
Try a LED blink program or something. The source files for the mega8 are from AVRlib - may or may not work with the mega32. I've tried with a mega644 and the avrlib source files don't work.
Title: Re: help me with ATmega32..
Post by: superchiku on April 12, 2009, 01:24:22 AM
see everything has to be changed...atmega32 has a diff set of pins and also registers inside it...the same program wont work...u have to change the initialization part and many more . .
Title: Re: help me with ATmega32..
Post by: cannon on April 12, 2009, 02:24:39 AM
i had tried led blink program.. prob is port can be turned on only, it cant be turned off..

and i'm not tht much of a prog genius..
can anyone giv me prog with req initializations for atmega32??

or atleast some place whr i can find instructions for d same??
Title: Re: help me with ATmega32..
Post by: SmAsH on April 12, 2009, 02:43:17 AM
are you sure you can turn it on? if you can turn it on you should be able to turn it off with the right code.
Title: Re: help me with ATmega32..
Post by: cannon on April 12, 2009, 02:49:17 AM
for eg, if i giv
PORT_ON(PORTB,0), only tht turns on..

but it doesnt turn off by giving,

PORT_OFF(PORTB,0)
 ???

Title: Re: help me with ATmega32..
Post by: superchiku on April 12, 2009, 07:40:42 AM
i can give u a direct code for atmeaga32...it started with atmega16 but the structure of 16 and 32 are completely same..
Code: [Select]
# include<avr/io.h>
int main(void)

{
 DDRD=0x01;
 TCCR1B|=((1<<CS10)|(1<<CS11));
 while(1)
  {
  if(TCNT1>=3000)
   {
    PORTD^=(1<<2);
TCNT1=0;
   }
 
   
    }
 
   
 
 return(1);
}

this is flashing led with 1 sec gap

Title: Re: help me with ATmega32..
Post by: Admin on May 13, 2009, 08:48:48 PM
http://www.societyofrobots.com/step_by_step_atmega168_swapout.shtml (http://www.societyofrobots.com/step_by_step_atmega168_swapout.shtml)