Welcome to the forum.
Lets look at the counting part first.
You will need a variable
CNT VAR BYTE
Then when ever the button is pressed
CNT = CNT + 1
IF CNT equals x then z.
Here is a similar thread you may want to read
http://www.picbasic.co.uk/forum/showthread.php?t=13744
Bookmarks