I am currently trying to learn how to program the Arduino Due timer in Atmel Studio 7 using a Jtag connector from an ICE.
I have got a basic light flasher working but I am confused by some of the syntax used to access the timer.
1) Clearing the timer status register
Various flags are supposed to be cleared by simply doing a read of the status register.
The sample code I am using uses this statement to clear the status register!
I am assuming that a read operation involves moving the contents of the status register somewhere. As far as I can tell in this statement no data is moved out of the status register.
I am surprised that the compiler does not flag an error.
2) Using -> versus . notation
This statement is used to disable interrupts
TC0->TC_CHANNEL->TC_IDR = 0xFFFFFFFF;
I see no channel # specified does this mean that this applies to the whole timer?
This line is used to set the compare value to determine the blink frequency
TC0->TC_CHANNEL.TC_RC = 59;
But if I try to write this using the same syntax as the interrupt disable ie
I get a compile error : invalid use of -> operator (have 'Tc_Channel')
I am not sure if this is a syntax problem or I have a basic misunderstanding about timer channels.
I am assuming that each channel of a timer is completely independent of the other channels
ie Timer 0 channels 0 , 1, and 2 can be treated as 3 separate timers
Any help would be greatly appreciated :)