AVR-Programming icon indicating copy to clipboard operation
AVR-Programming copied to clipboard

avr 328p, crystal and leds

Open sjomae opened this issue 2 years ago • 1 comments

If a crystal is used, this does make DDRB unusable for using it for the LEDs, as in the book? Or is there a trick to make it work? The crystal is covering up the PB6 and PB7 pins.

Related: https://github.com/hexagon5un/AVR-Programming/issues/24

sjomae avatar Sep 22 '23 14:09 sjomae

Hi,

Yes it does -- those two pins are dedicated to the crystal oscillator amplifier internally, so if you use a crystal you can't use them as GPIOs.

For learning, I thought it was useful to have a full 8-bit block of GPIOs available. It makes the whole "write to a register, and corresponding LEDs light up" much more intuitive.

But when you need more speed, you can get it by using those two pins for a crystal.

hexagon5un avatar Sep 23 '23 10:09 hexagon5un