ATMEGA88: Using all 8 bits on PORTB

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm trying to set up a simple program on an ATMEGA88-20PU, which steps through all 8 bits on portb. The chip sits in my STK500, and I've connected PORTB to LEDS.

However, I can't get LED6 and LED7 to light up. LEDs 0 to 5 scroll as they're supposed to. I understand these are reserved for external clock usage. Connecting a 2-wire jumper from XT1,XT2 (pins 6 and 7 on PORTE) to LED6,LED7, plus connecting GND and VTG from PORTB to LEDS using another jumper, I get the converse effect; LEDs 6 and 7 scroll. But now I can't connect the other 6 LEDs to PORTB; the 10pin header won't fit next to the jumper cables.

Hold on, maybe I've figured out this just by typing it in here! The problem seems to have more to do with the layout of the STK, than the chip itself! I can have all 8 bits of PORTB, but I have to get PB6 and 7 from PORTE, so the main challenge is simply making the necessary connections on the STK. -Which would be straight-forward on a breadboard.

Any comments?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just to say you are not alone - I think everyone who's ever used a 48/88/168 on an STK500 has been bitten by this one first time out (I know I was). I puzzled over this for ages then finally went to the help file in Studio for STK500, looked at the embedded schematic.pdf and traced the path of PB6 and PB7 from the socket that the mega168 plugs into (SCKT32000A2). As you'll see, because they can double as the XTAL pins they are actually labelled XT1 and XT2 and, as you discovered, come out on those labelled pins on the PORTE header.

I do think the STK500 help section could make this clearer. Maybe where it identifies the socket for 48/88/168 in "Target socket selection" it could have a note there to say that "PB6/7 appear on XT1/2 on PORTE header" ?

Cliff

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Hold on, maybe I've figured out this just by typing it in here!

Every possible AVR-related issue has already been raised, discussed, and consensus reached on this forum.

In this case, a search for "pb6 pb7 stk500" with or without "mega8" yields
https://www.avrfreaks.net/index.p...
https://www.avrfreaks.net/index.p...
https://www.avrfreaks.net/index.p...
https://www.avrfreaks.net/index.p...
https://www.avrfreaks.net/index.p...
https://www.avrfreaks.net/index.p...
just from the past two years. The earliest one I can pick out from the headline is September 2002--shortly after the Mega8 became available? that is somewhat instructive, Cliff, as it was discussed that the STK500 docs are lacking in this area.
https://www.avrfreaks.net/index.p...

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks! :)