I've just spent an hour reading the datasheet, and the header files in the folder "arduino-1.51r2\hardware\arduino\sam\system\CMSIS\Device\ATMEL\sam3xa\include". The registers are very different compared to the PIC32, where they have documented the registers in the PIC32 datasheet very clearly instead of just telling the address locations, which might be the case for the ATSAM3X8E processor in the Due.
So, stripping down to the bare minimum, I found out that if you need a bit more speed to access the pin I/O (most probably for dynamic pin-mapping for LCDs), you can directly access the registers instead.
- CODE: SELECT_ALL_CODE
void setup() {
// put your setup code here, to run once:
REG_PIOD_PER = (1<<8); // PIOD Enabled
REG_PIOD_OER = (1<<8); // PIOD output enable
REG_PIOB_PER = (1<<27); // PIOB Enabled
REG_PIOB_OER = (1<<27); // PIOB output enable
REG_PIOB_CODR = (1<<27); // PIOB clear output register
}
void loop() {
// put your main code here, to run repeatedly:
REG_PIOD_SODR = 1<<8; // Set output register (PWM12 pin on)
delay(250);
REG_PIOD_CODR = 1<<8; // Clear output register (PWM12 pin off)
delay(250);
}
This code enables both PIOB and D on the Due, and turned to output modes in the setup function. The pin from PWM13 (PB27) is turned off, hence the 'L' LED on the board is not turned on. Meanwhile, in the loop, the pin from PWM12 is repeatedly cleared and switched on with delays of 250ms. (Of course, get a breadboard, some jumper wires, an LED, and a suitable resistor on this too...)
I haven't yet to read the interrupts and the timer parts. The datasheet for the Atmel microcontroller isn't too bad, provided if you read them one-by-one and not leaving out the other details.
PIC - UIC00B from Cytron (replacement for my broken PICKit 2), Pickit 3, MikroC for PIC
dsPIC - MikroC for dsPIC, mikromedia board (dsPIC33)
AVR - AVR Dragon
Parallax - Prop tool