Reading state of DMA Timer 0 input pin
Posted: Tue Sep 06, 2011 7:42 am
Hello all,
I am using DMA Timero 0 as an input capture pin, to time the signal on timer T0IN, J2 pin 31. I have configured Timer 0 input as a timer pin. I also use the reference compare feature of the timer. (J2[31].function( PINJ2_31_TIN0 ); //setup pin 31 for DTIN0 input)
Everything works, but I cant manage to read the state of the input signal. I need to read state (hi/lo) at the ref compare times. I imagine I should still be able to read the state of the input even though it is not configured as gpio???
I am using the following to try and read the pin state:
BYTE ReadDT0IN( void )
{
return (sim.gpio.ppdsdr_timer & 0x02); // return b1 of timer reg ( DT0IN).
};
Is this possible to do, and if so where am I going wrong please??
I am using DMA Timero 0 as an input capture pin, to time the signal on timer T0IN, J2 pin 31. I have configured Timer 0 input as a timer pin. I also use the reference compare feature of the timer. (J2[31].function( PINJ2_31_TIN0 ); //setup pin 31 for DTIN0 input)
Everything works, but I cant manage to read the state of the input signal. I need to read state (hi/lo) at the ref compare times. I imagine I should still be able to read the state of the input even though it is not configured as gpio???
I am using the following to try and read the pin state:
BYTE ReadDT0IN( void )
{
return (sim.gpio.ppdsdr_timer & 0x02); // return b1 of timer reg ( DT0IN).
};
Is this possible to do, and if so where am I going wrong please??