Hi,
MODRR2 can be:
Read: Anytime
Write: Once in normal, anytime in special mode
Your code write it twice.... so in the debug mode it is working. In normal...NO.
It is not related to specific bits only but to entire byte. The operation works over the entire register even it is bit instruction (read-modify-write process is performed always)
So use MODRR2 = 0B00001100; /* Routing IOC_3 to ps1, IOC_2 to ps0*/
Be careful when you use such type of registers.
// TIM0 input capture channel 3 is connected to pin selected by MODRR2[T0C3RR]
// so TIM0 channel3 is routed to PS1
MODRR4 &= ~0x03; // OK
TIM0TSCR1 = 0x80; // ...I suggest
TIM0TSCR1 = 0B10100000; // enable timer and stop timer counting in freeze(debug/step....I mean when the code stops in degugging process) mode.
TIM0TSCR2 = 0x05; /* 1 Mhz*/ // it looks like 32*1MHz=32MHz
TIM0TCNT = (uint16) 0x0000; // Write: Has no meaning or effect in the normal mode; // only writable in special modes .
The period of the first count after a write to the TCNT registers may be a different size because the write
is not synchronized with the prescaler clock.
* Timer Input Capture/Output Compare Select */
TIM0TIOS &= ~((uint8)(0x1<<3)); // timer0 ch3 output compare
TIM0TCTL4 |= (uint8)(0x03 << 6); // OK
Moreover, I do not see enabling all I-bit maskable interrupts.
The code
Enableinterrupts;
or you can use
asm CLI;
I do not see you enabled interrupt ... 15.3.2.8 Timer Interrupt Enable Register (TIE)
I do not see interrupt routine.
If you want of me to deeper investigation I have to see entire project which is oriented only to the issue to see everything.
I have attached two examples for input capture.
Best regards,
Ladislav