Just a couple of thoughts...
Jerson's example is nicely presented, but be aware that the PAUSE statement stalls program execution and the Pic will do nothing during the two minutes. This may suit your need and there's no harm in it, but you may also consider the SLEEP statement in place of the PAUSE if you are running on batteries - SLEEP puts the Pic in low power mode and, while not as accurate, is much more efficient (if you're running on batteries this may be important). If program execution needs to continue during the two minutes, consider using an INTERRUPT. A short subroutine that increments a counter once per second and toggles your output at 120 seconds - while execution continues.
If you chose to use peterdeco1's routine, reset X to zero in the IF/ THEN construct, else it will continue to fire each second as X=121, X=122, ... - and don't forget to add an exit condition, unless you want to loop until long after "the cows come home".
Often the best help can be had by posting your code, explaining what it does and what you want it to do... there are geniuses here and they routinely offer many ideas that can make learning much easier - giving insight into best practice and "gotchas" not always evident, even if the code works as written.
Bookmarks