PIC18F2620: Mistake re. TMR1 RC0/1 inputs?

Thread Starter

Robin66

Joined Jan 5, 2016
275
Hi, can anyone confirm whether this paragraph is strictly correct? This is from 12.1 Timer1 Operation of the data sheet http://ww1.microchip.com/downloads/en/DeviceDoc/39626e.pdf
When Timer1 is enabled, the RC1/T1OSI and RC0/ T1OSO/T13CKI pins become inputs. This means the values of TRISC<1:0> are ignored and the pins are read as ‘0’.
I don't see why RC0/1 shouldn't be usable as output unless the TMR1 oscillator is engaged. The text for Timer3 adds this caveat which makes me doubt that the TMR1 text is correct

As with Timer1, the RC1/T1OSI and RC0/T1OSO/ T13CKI pins become inputs when the Timer1 oscillator is enabled. This means the values of TRISC<1:0> are ignored and the pins are read as ‘0’.
My chip's on board and I'm working on the code so it's tricky for me to verify this thru experiment. Perhaps someone already knows the answer.

Many thx, Robin
 

Papabravo

Joined Feb 24, 2006
21,225
The two phrases causing the confusion are:
  1. "Timer 1 is enabled"
  2. "Timer 1 Oscillator is engaged"
Let us look in the datasheet for evidence that these are either the same thing or that they are different things.

In Figure 12-2 on p. 128 of the datasheet, I draw your attention T1OSCEN which enables the inverter in the block within the dotted lines labeled "Timer1 Oscillator". This bit IMHO controls weather the oscillator is engaged. Three lines below that is a line labeled TMR1ON, that goes to an AND gate labeled "Timer1 On/Off". This line IMHO controls weather Timer1 is enbaled.

In Table 9-5 on p. 98 RC1 has the following text for T1OSI when the output type is ANALOG
"Timer1 oscillator input; enabled when Timer1 oscillator enabled. Disables digital I/O."
Clearly the value of TRISC.1 is ignored when the pin is an analog input.

In Table 9-5 on p. 98 RC0 has the following text for T1OSO when the Output type is ANALOG
"Timer1 oscillator output; enabled when Timer1 oscillator enabled. Disables digital I/O."
Clearly the value of TRISC.0 is ignored for an analog output.

In Table 9-5 on p. 98 RC0 has the following text for T13CKI when the output type is ST(Schmitt Trigger Input) and TRISC.0=1
"Timer1/Timer3 counter input."
Clearly the value of TRISC.0 is not ignored in this case.

The tables for the configuration of the IO Ports under all imaginable conditions contain much useful information.
 
Last edited:

Thread Starter

Robin66

Joined Jan 5, 2016
275
Thx Papabravo. I had scanned through these tables already but because the text under 12.1 was so unambiguous I didn't know what to think. However the diagram on p.128 also omits any direct link between enabling TMR0 and disabling RC0/1 digital I/O. So on the balance of evidence I'd conclude that the text under 12.1 should read
When the Timer1 oscillator is enabled, the RC1/T1OSI and RC0/ T1OSO/T13CKI pins become inputs. This means the values of TRISC<1:0> are ignored and the pins are read as ‘0’.
 

Papabravo

Joined Feb 24, 2006
21,225
Thx Papabravo. I had scanned through these tables already but because the text under 12.1 was so unambiguous I didn't know what to think. However the diagram on p.128 also omits any direct link between enabling TMR0 and disabling RC0/1 digital I/O. So on the balance of evidence I'd conclude that the text under 12.1 should read
No, that is not correct.
Reread this paragraph very very carefully

In Table 9-5 on p. 98 RC0 has the following text for T13CKI when the output type is ST(Schmitt Trigger Input) and TRISC.0=1
"Timer1/Timer3 counter input."
Clearly the value of TRISC.0 is not ignored in this case.
When output type is ST, which stands for Schmitt Trigger, it is actually an input. Notice that TRISC.0 is very important in this context.
 

Thread Starter

Robin66

Joined Jan 5, 2016
275
Ok, but I can still use RC0 and RC1 as outputs when I'm using timer 1 (but not with timer 1 oscillator enabled).
 

Papabravo

Joined Feb 24, 2006
21,225
Ok, but I can still use RC0 and RC1 as outputs when I'm using timer 1 (but not with timer 1 oscillator enabled).
I think that statement is correct. If the I/O Type is DIG (Digital) and the TRISC.0 and TRISC.1 bits are equal to zero, then the pins will follow LATC.0 and LATC.1
 
Top