avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Newbie - should this work?


From: Klaus Rudolph
Subject: Re: [avr-gcc-list] Newbie - should this work?
Date: Sat, 18 Jan 2003 10:53:00 +0100

Josh Thompson wrote:
> 
> Hi,
> 
> I'm new at using working with embedded systems.  I am fairly familiar
> with using gcc under Linux.  I am using an ATmega128, avr-gcc, and usip
> with a ByteBlaster programmer.  uisp says it detects the chip and then
> loads the code into flash.  I can dump the code and get the same thing
> that I uploaded; so, I think this part is working okay.  Here is my code:
> 
> main.c:-------------------------
> #include <io.h>
> 
> int main() {
>    DDRD = 0xff;
>    PORTD = 0X00;
> }
> -------------------------------
> 
> Makefile:----------------------
> all: main
> 
> main: main.c
>    avr-gcc -D__AVR_ATmega128__ main.c -o main
>    avr-objcopy --output-target=srec main main.srec
> -------------------------------
> 
> These are the steps I am taking:
> 
> ./uisp -dprog=abb -dlpt=/dev/parport0 --upload if=main.srec
> 
> after this, I disconnect the programmer cable
> disconnect power
> reconnect power
> 
> At this point, I would expect to read 0 volts on the PORTD pins, but I
> am reading 1.5 volts.
> 
> Should this work?  Am I following the right steps?
> 
> I have also tried it with 'PORTD = 0xff;' and still get 1.5 volts.

Have you set the atmega128 to atmega128 mode. Normally they come with
atmega 103 compatibility flag set. The rest seems absolut correct.

After main() you need no additional loop, because the libc fall after
main in an endless loop, so this is also correct.

Bye
        Klaus
avr-gcc-list at http://avr1.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]