After using multiple posts on this forum to help me understand how to start programming an Arduino DUE I thought I’d post up my working code here to potentially help others in a similar situation.
I am looking to port over my 8x8x8 RGB LED cube code from an Arduino MEGA to an Arduino DUE for faster processing and more memory.
To enable this I needed to understand how to code on the DUE for SPI transfer, direct port manipulation(as faster than digitalWrite) and enabling timer interrupts.
A few additional watch outs:
The Arduino DUE runs at 3.3V as opposed to 5V on the MEGA. As my cube is running at 5V I successfully used a level converter (https://www.sparkfun.com/products/12009) to upscale the MOSI, Clock, Output Enable and Latch lines from the DUE to the 74HC595 5V shift registers driving my cube.
The SPI pins on the DUE are broken out on a separate header rather - this is a great resource when using the DUE (https://forum.arduino.cc/index.php?topic=132130.0)
Writing to ports directly on a DUE is very different - you write to a set (HIGH) register and a separate clear (LOW) register - the ports and bits are identified on the pinout diagrams above
Many thanks to all the support on this forum that helped me get insights into the very different coding required to enable these functionalities - you may recognise some of the coding as direct copies from previous explanations shared here
I hope this is of help to others
Due_Test_Int.ino (2.6 KB)