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: Christoph Plattner
Subject: Re: [avr-gcc-list] Newbie - should this work?
Date: Sun, 19 Jan 2003 18:36:25 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020830

In principal, I don't think your code is correct !

All the other answers have not dealt with that, why ???

PORTD and DDRD are defines to registers numbers.

I think you have to use inp() and outp() or do a memory
access with `* (unsigned char *) <addr> = xxx'


example (which works):

    outp(0xff, DDRB);
    outp(0x00, PORTB);


Bye
Christoph P.

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.

Thanks for your help,
Josh
avr-gcc-list at http://avr1.org





--
-------------------------------------------------------
private:        address@hidden
company:        address@hidden

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



reply via email to

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