Arduino DUE pinMode vs PIO_ODR

Hi All,

Just a quick question, I am try to replace (pinMode) with (register setting). But my process is not work. The output data always is 0.

unsigned long Data; void setup() {

PIOD->PIO_PER = 0xFFFFFFFF; //Enable PIO PIOD->PIO_ODR = 0xFFFFFFFF; //Set to INPUT Serial.begin(115200);

}

void loop() {

Data = PIOD->PIO_PDSR & 0xFFFFFFFF; Serial.println(Data,BIN); delay(1);

}

I modify the process as below for debug and it work well. Would someone help me to solve this problem? I plan to use register setting to connect DUE with a Parallel ADC. Thank you.

unsigned long Data; void setup() {

// PIOD->PIO_PER = 0xFFFFFFFF; //Enable PIO // PIOD->PIO_ODR = 0xFFFFFFFF; //Set to INPUT pinMode(12, INPUT); Serial.begin(115200);

}

void loop() {

Data = PIOD->PIO_PDSR & 0xFFFFFFFF; Serial.println(Data,BIN); delay(1);

}

You have to power on PIOD thru PMC registers in setup().

Thank you for your help ard_newbie. Would you show me the command for power on PIO thru PMC registers? Thank you again.

PMC->PMC_PCER0 |= PMC_PCER0_PID14; // PIOD power ON (Sam3x datasheet page 38)

Thanks a lot for your great help ard_newbie. It is work.