I am attempting to read an encoder with the Arduino Due and have a problem.. I am receiving the following compile error:
QuadratureDecoder_v2.ino: In function 'void HandleAzimuthMotorInterruptA()':
QuadratureDecoder_v2:33: error: 'PIND' was not declared in this scope
QuadratureDecoder_v2:33: error: 'PINB' was not declared in this scope
QuadratureDecoder_v2:33: error: 'PINC' was not declared in this scope
I haven't read your code.
But "not declared in this scope" and the fact that you are using functions, point to a mis assignment of those PIND, PINB, PINC.
Those are non global variables and so they are not available in your function HandleAzimuthMotorInterruptA
You could define them for that function, or as a global variable, so they keep their set values for all functions (i.e.e cross function).
The digitalWriteFast stuff is only for AVR processors.
It is kind of wimpy and a bit of a kludge in that
if you try to use it on a non AVR processor,
it defaults to assuming the processor is a AVR atmega168/atmega328
So that won't work on DUE because DUE is a totally different processor
with totally different registers.
For portability the digitalWriteFast code should have reverted back
to the standard calls, bit it doesn't.
Your only option is to not use it on DUE.
The good news is that processors built with ARMS/PICs don't have the Harvard architecture issues
like AVR so the normal digitalWrite()/digitalRead() and supporting code should be quite a bit
smaller and faster than on AVR.
Alternatively, if you need the sketch to compile on AVR, DUE, Teensy3, Chipkit based "duino" boards,
you could add this to the top of your sketch to automatically revert back for you: