Re: counter overflow
koolslash said:
I want to count number of pulses in 1sec.
and then reset the counter.
which pulses??
if you want to count internal pulses no need to count you can calculate it using the crystal frequency.
and for counting external pulses use another timer as an external counter and one as timer to get the time of 1sec.
sivarajm said:
1) What will overflow? when the counter reaches maximum limit time ie for 8 bit 0xFF for 16bit 0xFFFF
2) what will happen beyand that.
3) whats the disadvantages and advantages of counter overflow?
1) overflow means the buffer reached at its limit
i.e for 8 bit maximum is 0xFF
and overflow means 0xFF + 0x01
this will result in setting the overflow flag of that timer = 1 and the register will be loaded as 0x00
similarly for 16 bit timer also but the counts will be more in the case of 16 bit counter
2) after that if you have enabled the overflow interrupt the program will enter in that interrupt routine
or you can check the overflow flag of that timer
3) the advantages and disadvantages will depends on the program you are using
the advantage is that you can get a specific count delay using the timer
and disadvantage is that if you want to count more than 16 bit you cant