Found the problem, has to do with configuration bits.
Although the extended instruction configuration bit is disabled by default, if this line is used to turn LVP off,
@ __CONFIG _CONFIG4L, _LVP_OFF_4L
the extended instruction bit will be set. So it has to be specifically turned off with this
@ __CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
or else there is very strange and inconsistent behavior. Problems were experienced with the DEC modifier in HSEROUT and with the shift (<<) commands.
Oddly, if the line
@ __CONFIG _CONFIG4L, _LVP_OFF_4L
is not used at all, the extended instruction bit remains disabled, as it should be by default.
Bookmarks