Cannot Program Due in Assembly / use PINx commands with Due in 1.5.2

Hello, I just down loaded 1.5.2 and tried to run a code I had written for high speed channel switching square wave for the Uno on my new Due. void setup() { DDRB = 0xff; DDRD= 0xff;

} void loop() { int state=0; int i=4; while(1) { while(i!=0) {

PORTB&=~0x20; PORTB&=~0x10; // PORTB= 0xff; asm("nop\n\t""nop\n\t""nop\n\t""nop\n\t");

PORTB|=0x10; PORTB|=0x20;


i--; }

delay(1); i=4; } }

I receive an error something like ketch_aug15c.ino: In function 'void setup()': sketch_aug15c:8: error: 'DDRD' was not declared in this scope sketch_aug15c.ino: In function 'void loop()': sketch_aug15c:13: error: 'PORTD' was not declared in this scope

Is anyone else having this issue? / what am I doing wrong?

First off, when you post code - use the code tags, helps keep everything much neater.

Now, on to the problem - it seems you're trying to program the Due with code that directly manipulates registers such as referencing 'DDRB' - if this is the case, don't hope for it to work. Data Direction Registers, and PORTx etc is all from the 8-bit AVR chips found on the Uno, Mega, Nano etc - it's completely irrelevant on the 32-bit ARM based SAM devices, instead - they use PIO controllers etc. Have a read through the datasheet for the 3X8E, and you'll see no reference whatsoever to a DDRB.

It seems a lot of people are getting confused at the moment trying to port AVR code to SAM, the architecture is completely different. The Arduino team have simply written new cores, so that things like digitalWrite all work the same - but the source code behind them is very different.

See this topic -

high speed channel switching square wave

Do you mean you're trying to create a PWM waveform? - and send that to an Uno board? Tell us a little more and we'll do what we can to help...