May 12, 2014 at 6:03 pm #3086Joris DallaireParticipant
First post here, from a newbie hobbyist.
I have an atmel AT89C2051 and i can’t get the external timer inputs (T0 and T1) to work as regular inputs. I write 1s to the whole P3 port and all available pins work as expected except those two.
I do use the timers, and they are set in TMOD as timer mode (not counter), so the pins should be available as regular input pins, no?
Any help appreciated.
JorisMay 13, 2014 at 4:44 am #11726SHAH DISHANT H.Participant
Ya what you said is perfectly fine and you must get those pins as GPIO.
Can you post ur code so that we can verify ?May 13, 2014 at 2:33 pm #11727Joris DallaireParticipant
Thank you for the helping hand! Here’s the code. There is a debounce routine in there, but basically when any button connected to P3 is pushed the “State” variable becomes greater than 1. Here the PB_UP and PB_DOWN buttons are set to pins 1 and 0 and it works, but it doesn’t when set to T0 and T1.
Thanks you in advance for your advice.May 15, 2014 at 3:47 pm #11732Ashutosh BhattParticipant
there are two timer/counter in 8051
at a time it can work as timer or counter
if T0 you are configuring as timer. it will count internal pulses at 1 MHz
else if you are configurating T0 as counter it will count external pulses (max at 1 MHz)
similar for T1. no need to configure anything else.
- You must be logged in to reply to this topic.