Timer IRQ and Direct Port Input

Arduino Due, IDE 1.5.8 (because my 1.6.8 doesn’t have Arduino Due under TOOLS, I’m sure I didn’t install it correctly or something…)

Goal - Use a Timer to increment a variable every 1us – Status Complete
(from other examples on forum for IRQs )
Goal - Setup and read in whole PORT C (31 bits) at once, (not one pin at a time)
HDS = REG_PIOC_PDSR – Status Complete


I can’t seem to get the 2 to work together.
For simpleness I have just used the pinMode(33, INPUT) which should setup all the other registers, but my guess it is also re-setting or writing registers that I have had setup for the IRQ.

Any ideas or directions into the SMART ARM datasheet or where I can find some more info?

Other question: On page 629 of the datasheet it shows an I/O example. Why would you have to set the PER and then set the PDR (enable and disable register) both? Is this the standard? It doesn’t default to 1 status and then you either set it one way or the other? I guess it seems like if you would set PIO-PER to 0x0000FFFF (to enable the bottom 16bits, it would also mean to disable the top 16bits) PIO_PDR to 0xFFFF0000.

Anyway just curious about the double writing to the registers

Looking for suggestions or directions to information.

All, I just thought, I am using the Serial to view my PORTC data bits. It never shows any data, is this because of the IRQ???



You could see this tutorial for Timers & Interrupts :

and this one for PIO programming :


All, I did some manipulations and got some things figured out.

ard_newbie, Thanks for the ko7m.blogspot link. The table that shows IRQ# vs TC-channel# cleared up some things for me.