Port manipulation @ M0 board.

Hi guys. I run this sketch and i take back this error: 'DDRD' was not declared in this scope

The code is for uno. Is that due to different pins mapping? Can someone correct this code so to fit to M0 board? Any suggestion is welcomed.

void setup()
{
DDRD = B11111111; // set PORTD (digital 7~0) to outputs
}

void loop()
{
PORTD = B11111111;
PORTD = B00000000;
PORTD = B11111111;
PORTD = B00000000;
PORTD = B11111111;
PORTD = B00000000;
PORTD = B11111111;
PORTD = B00000000;
PORTD = B11111111;
PORTD = B00000000;
}

..............................

'DDRD' was not declared in this scope

The PORTx/PINx/DDRx system for controlling GPIO pins is specific to AVR microcontrollers - other architectures have similar schemes (with varying numbers of registers to configure the pin modes, different naming schemes for the registers, and depending on the architecture, different sized registers). Consult the datasheet for the processor for the details on the register names to use, and how to use them (the more advanced chips often have more registers dedicated to this)

What is the name of this sketch? Flash_8_LEDs_5Times_As_Fast_As_Possible_Then_Glitch?

Do you really need all 8 outputs flashing absolutely simultaneously? Can you tolerate a little skew? What is the actual flash rate required? The UNO will attempt to flash at 16MHz (with glitches) and the equivalent (working) code will be 48MHz on the M0. That's a big difference.

Also see xyproblem.info That may help you.

Here is more info