Author Topic: help me with ATmega32..  (Read 3667 times)

0 Members and 1 Guest are viewing this topic.

Offline cannonTopic starter

  • Beginner
  • *
  • Posts: 5
  • Helpful? 0
help me with ATmega32..
« 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..

Offline Razor Concepts

  • Supreme Robot
  • *****
  • Posts: 1,856
  • Helpful? 53
    • RazorConcepts
Re: help me with ATmega32..
« Reply #1 on: April 11, 2009, 11:44:57 PM »
Change the MCU name in the makefile to atmega32

Offline cannonTopic starter

  • Beginner
  • *
  • Posts: 5
  • Helpful? 0
Re: help me with ATmega32..
« Reply #2 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??

Offline Razor Concepts

  • Supreme Robot
  • *****
  • Posts: 1,856
  • Helpful? 53
    • RazorConcepts
Re: help me with ATmega32..
« Reply #3 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.

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: help me with ATmega32..
« Reply #4 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 . .
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline cannonTopic starter

  • Beginner
  • *
  • Posts: 5
  • Helpful? 0
Re: help me with ATmega32..
« Reply #5 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??

Offline SmAsH

  • Supreme Robot
  • *****
  • Posts: 3,959
  • Helpful? 75
  • SoR's Locale Electronics Nut.
Re: help me with ATmega32..
« Reply #6 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.
Howdy

Offline cannonTopic starter

  • Beginner
  • *
  • Posts: 5
  • Helpful? 0
Re: help me with ATmega32..
« Reply #7 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)
 ???


Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: help me with ATmega32..
« Reply #8 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

JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots