Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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
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.

Latest threads

New Articles From Microcontroller Tips

Back
Top