Regarding Arduino due Pin Mapping

Hi all, I want make Pin 6 in arduino due to High by directly writing to its registry,i know that we can do it by digitalWrite(Pin 6,HIGH);but how can i do it by writing to registry.In arduino mega we can write like this PORTH|=_BV(PH3);like this how can i do it in ARDUINO DUE

Hello roshancheluva,

Here the code to turn HIGH pin 6 using SODR (Set Output Data Register).
To turn LOW the pin you can use CODR (Clear Output Data Register). Regards,

// Pin 6 mask
uint32_t pin6 = (1u << 24); 

void setup()
{                  
  // Output Enable Register
  REG_PIOC_OER = pin6; 
}

void loop()
{
    REG_PIOC_SODR = pin6; // Set Output Data Register, turns pin 6 HIGH 
    //REG_PIOC_CODR = pin6; // Clear Output Data Register, turns pin 6 LOW 
}

-p

What for?

Why do you want your code to be tightly welded to one specific processor that may or may not be available to buy in a few years from now?

In what way is digitalWrite() not doing what you want?

MorganS: Why do you want your code to be tightly welded to one specific processor that may or may not be available to buy in a few years from now?

In general I agree to use digitalWrite(). But if used heavily inside a loop huge speedups are possible when directly accessing the port (clear 5110 Nokia display from 11.44fps to 206.27fps): http://forum.arduino.cc/index.php?topic=382585.msg2637251#msg2637251

Hermann.