Can someone illustrate -or- point me in the right direction on how to manipulate port registers in the Nano Every (ATmega4809)?. - I'm using the Arduino IDE
The port manipulation described here for the ATmega328p/ATmega168 works as follows and works well for me in the Arduino Pro Mini and ATmega48;
DDRD |= B11110000; // sets ATmega digital pins 7 to 4 as Outputs PORTD = B10010000; // sets digital pins 7,4 HIGH
When I try the equivalent with the Nano Every (ATmega4809) it seems the pin mapping is completely different
VPORTD.DIR |= B11110000; VPORTD.OUT = B11110000;
I'm using bit-wise operations as my plan is to replicate the same in the Nano Every without emulation -if possible- so I can manipulate many digital/analog pins at once with one instruction (avoiding having to do it for each GPIO at a time)
Thanks,
Luis