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 - http://forum.arduino.cc/index.php?topic=182704.0
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...