[ List Subjects ][ Post Message ]
Subject: PIC16F84: RA4 and TMR0 Conflict?
[ View Followups ][ Post Followup ]
Date: 08/01/02 at 9:25 PM
Posted by: Archaven
Hi all. I would like to know IF there's a conflict between RA4 and TMR0. I found that I can't use RA4 as I/O when I used the TMR0 interrupt. In my application, ALL 13 I/O pins will be used. In a testing program, I have written a 5 seconds delay using prescaler 1:256 and enabling Timer0 interrupt. The idea is to count the number of Timer Overflow to get the elapsed time. I have no problem implementing this.
In the testing program, I first set PORTA to all output following by pulling HIGH to all PORTA pins. Thus, RA0 till RA4 should have an HIGH output. The TMR0 will count 5 seconds and it will then TOGGLE all the PORTA outputs by XORing PORTA.
So the entire operation of the hardware will work like this:
Turn ON LEDs on ALL output pins or PORTA and delay for 5 seconds. After the delay elapsed, It will TOGGLE the outputs therefore Turning OFF ALL the LEDS in PORTA. The Entire process repeats again and again infinitely.
The program works perfectly and SOME of the PortA pins works exactly as it should. But I found that PortA, RA4 pins always Stay High. It will not turn OFF.
Thus I would like to find out whether RA4 can be used when I use TMR0 INTERNAL instruction cycle (NOT External Input).
Thanks again for taking the time to read this lengthy explanation.
Post a Follow-up: