PDA

View Full Version : looping / counter



tech
- 18th May 2008, 15:41
hi,

need help in puting a counter to my sub routine.
im using 16f84a.

example:
the programm will excercute the selected subroutine for maybe 10times count continuesly,
if the condition true then it will proceed to the next command..

here are my example of one of the subroutine.
reasons of using counter to this subroutine so that my programm can be shorten.

A:
TRISB=0
portb=%00000101
pause 50
portb=%11000111
pause 20
return

BobK
- 18th May 2008, 16:00
Hi Tech,

Look in the PBP manual and check out the WHILE statement and try experimenting. You can stay within a loop using this statement until your switch returns to where you want it. Also read through these forums and I know you will find plenty of examples.

BobK

BobK
- 18th May 2008, 16:30
Hi Tech,

I went back and looked at my library of posts here and found one titled "Timing the pressing and releasing of a pushbutton" that was posted in March of 2006. Melanie posted a code example that should work for what you want to do.

Do a search for this article.

HTH,

BobK

tech
- 18th May 2008, 23:31
thanks..
problem solve..
i used while and wend