Turning off the watchdog makes it work so that's what's resetting it for sure...

The original code, where I notices it is like this:
Code:
Main:
  i = i + 1
  Gosub GetValue
  PortB = Out
Goto Main
Then the subroutine GetValue is a lookuptable with 255 entries returning the value in Out. It too restarts when the dog is unleashed. However, if I add IF i = 255 then i = 0 at the end it works. I then tried to boil that down to the minimum, which is what I posted above.

So, is this an oversight on my behalf or an unwated side effect of a "tight" (it's not THAT tight) program?

In any case, thanks Bruce!
/Henrik.