16f877a counting

Status
Not open for further replies.

svtiss

New Member
Hi
I am trying to build a pulse counter , which give me amount of pulses , like 50 ,150 , 300 etc when i push a button
I am using 16f877a , I have it counting up 255 , but cant make count more then 255 ,

thanks
loop movlw 0xff ;
xorwf count1,w;
btfsc STATUS,Z
goto loop ;
incf count1,f;add one to count
goto again ;keep counting
 

hi,
You have to use a WORD to count above 255.

Inc lowbyte
is carry set
if yes then inc highbyte

Look at Tmr1 as alternative way of counting
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…