atmega128 problems

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hi,

i have some problems with atmega128.

if i compile this code

int main ( void )
{

while(1)
{
PORTB = 0xFF;
delay(1);
PORTB = 0x00;
delay(1);
}

return (0);
}

void delay(unsigned int delay)
{
while(delay) delay--;

}

it doesnt work but it works on a mega103 and if
i take the delay routine out it works on mega128 too.
the only thing he did with the delay routine is set the portb high and that
was it...:(
maybe there is any fusebit that i have to set?

any idea??

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

additional:

if i program the m103 fuse bit on mega128 the code works fine too...:)..

i cant understand that...but it must be a realy easy error...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Standard questions:
1. which compiler.
2. internal/external crystal
3. crystal fuse settings

remark: dont use variables and functions with the same name it probably will work but is IMO a bad programming habit.

Gerrard

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

last Winavr distribution.
internal crystal. 4MHz

only one crystal bit is written for 4MHz.
the other ones are on standard.

the real name of the function is delayus();

thank you,

Marc

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just a qestion, you do use different linker options for the Mega128 and the 103? The RAM on the 103 starts from byte 96 while the RAM on the 128 (with the M103C fuse disbled) starts at byte 256.

Regards

admin's test signature