Re: 2313 output pin problem

Russell Shaw <[email protected]> Tue, 23 Dec 2003 04:00:15 +1100
Newsgroups gmane.comp.hardware.avr.general
Message-ID <[email protected]>
Robert Baruch wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi all,
> 
> I'm just starting out with the AVR series of uc's. I've successfully
> built a programmer of the "alf" type, and verified that it works properly.
> 
> So here's my simple program:
> 
> void main(void)
> {
>     DDRB = 0xff; // port b set to all outputs
>     PORTB = 0;
> }
> 
> I have a 220-ohm resistor and an LED hooked up in series between VCC (5
> volts) and PB7, which is also the SCK pin. I know the LED is connected
> the right way, because it lights up during programming. So the above
> program should drive PB7 to ground, thus lighting the LED.
> 
> But when I run the program, the LED doesn't light up. All the other port
> B pins are at 0 volts, but PB7 is at 3.75 volts, almost as if the pin
> were floating, which can't be right, or am I reading the data sheet wrong?
> 
> I also changed PORTB to 0xff and verified that all the pins are at 5 volts.
> 
> So what's wrong? I'd appreciate any help.

You've gone to hyperspace;)
Try:

void main(void)
{
     DDRB = 0xff; // port b set to all outputs
     PORTB = 0;
     for(;;){};
}