I know this is repeated question,I referred many post, but i didn't get an clear answer. My understanding is most of the micro-controller will have a 16/32 bit timer, which increments its ticks based on oscillator and clock provided(main/peripheral clock, divider, prescaler) to it.
When i started to work on simple 8051 micro-controller, I thought timer and counter are same. The reason of my thought after the simple below test i did in 8051.
"8051 has a bit C/T in TMOD Register. If timer is started after a reset i see TH/TL register are incremented irrespective of C/T bit (If bit set to 0 or 1 result is same)."
Later i worked on PIC microcontroller, I noticed that the timer and counter has different concept in this controller. If it is configured as Timer Mode, the register TMRnH/TMRnL(where n is 1 or 0) was incremented for every instruction cycle. But if it is configured as Counter, the register was not incremented for every instruction, Then i connected one switch in pin TnCkn. When i pressed that switch, the counter was incremented. With this i changed my perspective that the timer and counter are not same. Timer will increment for every instruction cycle(internal clock/signal) but counter will increment for every time either a raising edge or falling edge with external clock/signal.
Now i am working on Freescale MPC controller, Here i noticed the term GPT(General purpose timer). There are 5 timer units(GPT) in this controller, each timer unit has a register called "Counter Register(TCNTn)". When i started a timer, this register has incremented for every instruction cycle. So i thought this controller has only Timer not a counter. But i perturb with two terms below
1. Counter Register - If it is timer, why it is called Counter register in user manual of MPC.
2. In User manual, there is a section called Timer/Counter under this section, there is a subtopic called GPT and there is no subtopic for counters separately. which means timer and counter are same?
My question:
1. Is really Timer and counter are same?
2. If it is not same, why 8051 and MPC are working as same(act as timer and counter).
When i started to work on simple 8051 micro-controller, I thought timer and counter are same. The reason of my thought after the simple below test i did in 8051.
"8051 has a bit C/T in TMOD Register. If timer is started after a reset i see TH/TL register are incremented irrespective of C/T bit (If bit set to 0 or 1 result is same)."
Later i worked on PIC microcontroller, I noticed that the timer and counter has different concept in this controller. If it is configured as Timer Mode, the register TMRnH/TMRnL(where n is 1 or 0) was incremented for every instruction cycle. But if it is configured as Counter, the register was not incremented for every instruction, Then i connected one switch in pin TnCkn. When i pressed that switch, the counter was incremented. With this i changed my perspective that the timer and counter are not same. Timer will increment for every instruction cycle(internal clock/signal) but counter will increment for every time either a raising edge or falling edge with external clock/signal.
Now i am working on Freescale MPC controller, Here i noticed the term GPT(General purpose timer). There are 5 timer units(GPT) in this controller, each timer unit has a register called "Counter Register(TCNTn)". When i started a timer, this register has incremented for every instruction cycle. So i thought this controller has only Timer not a counter. But i perturb with two terms below
1. Counter Register - If it is timer, why it is called Counter register in user manual of MPC.
2. In User manual, there is a section called Timer/Counter under this section, there is a subtopic called GPT and there is no subtopic for counters separately. which means timer and counter are same?
My question:
1. Is really Timer and counter are same?
2. If it is not same, why 8051 and MPC are working as same(act as timer and counter).