SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions on the software and hardware for Atmel's STK standard.
By Juzzam
#191
We are building a Robot which will use your ATMega128 Mini Header Board. 4 of the boards were ordered and everyone on our team has the same problem:

Code for it which involves a subroutine or interrupt service routine will not work.

For example:
====================
int main()
{
PORTA = 0xFF;
} // will work
====================
void setA()
{
PORTA = 0xFF;
}

int main()
{
setA(); // does not work, does not exit method
}
====================

We have tried both CodeVision and WinAvr programming enviornments in atmega128 mode. We are using ponyprog set for the atmega128.

Has anyone else reported this problem? Could it have something to do with the board since it was designed for the atmega103? Perhaps a compatability fuse bit?

Thanks in Advance,
Juzzam
User avatar
By sparky
#194
Looks like a software problem.

The PCB is compatible with both the ATMega103 and 128. I don't think it has anything to do with the hardware.

Take a look at the assembly generated by your compiler. What does the return call look like? You will need to read the docs for your compiler to make sure returns are automatically generated.

uC compilers do some crazy things. I have seen a compiler happily generate the assembly and hex files and completely miss arrays and strings. Doesn't sound like your problem - but just be aware that they do not always report glaring errors.
By OLIMEX
#195
Please define what do you mean by "not work"
If PORTA is with direction as input and you try to make it 0xFF i.e. all pins as "1" of course nothing will happend.
The piece of code you publish is just incomplete to do anything.
Please read ATMega128 datasheets and do your hardware setup code properly before to blame the hardware ;)

Best regards
Tsvetan