Blink with Toggle


Probably all controllers produced by ATMEL since 2004 offer a nice feature which is described in the datasheet as follows:

So, the famous blink example may be programmed like this:

void setup() {
  Serial.begin(9600);
  pinMode(13,OUTPUT);
}

void loop() {
  PINB = B00100000; // writing to an input port
  Serial.println(PORTB,BIN);
  delay(1000);
}

Although the program does not modify the contents of PORTB directly, the output in the terminal window shows:

100000
0
100000
0

Unfortunately, you have to mix Arduino style (pinMode) and C-style (PINB = x) commands, or use DDRB instead of pinMode.

According to the datasheets, these controllers do the trick:

ATmega1280
ATmega1281
ATmega1284A
ATmega164A
ATmega168PA
ATmega16U2
ATmega16U4
ATmega2560
ATmega2561
ATmega324A
ATmega328P
ATmega3290
ATmega32U2
ATmega32U4
ATmega48PA
ATmega640
ATmega644A
ATmega649
ATmega6490
ATmega88PA
ATmega8U2
ATmegg329
ATtiny13
ATtiny2313A
ATtiny24
ATtiny4313
ATtiny44
ATtiny84
According to the datasheets, these controllers, produced since 2001, do not:
ATmega8(L)
ATmega128



contact: nji(at)gmx.de