I just found the cause of some weird problems I've been fighting for a week. Being new to this whole thing, it didn't occur to me for a while where the problem came from.
I'm using a pic16lf1938 40 pin chip with five ports.
In the INITSYS routine automatically generated by GCBASIC, it clears ANSELA and ANSELB, but it does not clear ANSELD.
I was getting lots of glitches on output port D, and manually inserting the line ANSELD = 0, cleared everything up. Is there a document somewhere that says it's my responsibility to set this?
This was covered in another post. Initsys needs to be modified.