How do you make a code work like this:

When I push a button a timer starts and when I push it again it stops and make that time into a variabel. So I can use that time in my program something like this:

Code:
...
...
HIGH PORTB.1
PAUSE "The Time"
LOW PORTB.1
...
...