Society of Robots - Robot Forum
Software => Software => Topic started 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..
-
Change the MCU name in the makefile to atmega32
-
did tht..
wht i basically wanna knw is whether it wil wrk with the old header files??
-
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.
-
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 . .
-
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??
-
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.
-
for eg, if i giv
PORT_ON(PORTB,0), only tht turns on..
but it doesnt turn off by giving,
PORT_OFF(PORTB,0)
???
-
i can give u a direct code for atmeaga32...it started with atmega16 but the structure of 16 and 32 are completely same..
# 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
-
http://www.societyofrobots.com/step_by_step_atmega168_swapout.shtml (http://www.societyofrobots.com/step_by_step_atmega168_swapout.shtml)