|
From: | Bernard Fouché |
Subject: | Re: [avr-gcc-list] Setting pin to high in function instead of main, instructions in main never run? |
Date: | Mon, 05 Mar 2012 09:37:58 +0100 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 |
Le 01/03/2012 11:25, Richard Zetterberg a écrit :
The only difference that appears in the different examples is the function call for the non-static version: is the stack pointer correctly initialized? If what you show is a complete disassembly then it misses r1 init, stack pointer init, etc. Code should also be generated for addresses higher than 0x0 since the interrupt vectors are starting at this place. Seems like avr-libc isn't considered at link time.I have a ATmega328-PU chip which I have programmed with a bare minimum program which sets PB0 to output and then runs a function which sets the pin to HIGH. The problem is that the voltage output of the pin is at 10-20% of what it should be, identical to what it would be if the pin was set as input and the pull upp would be active. However if I set the function as static, it works as expected. I have tried this on 3 ATMega328-PU's with default fuse settings to minimize the things that could contribute to the problem.
[Prev in Thread] | Current Thread | [Next in Thread] |