ANSELA was the problem. I now set it to zero before turning on bit 4. This fixed the problem!. I wonder if PBP sets the correct ANSELA bit for me when using ADCIN, I didn't have time to test current consumption today to find out. Thanks Mr.E!
@Henrik, I too suspected RMW trouble and inserted a delay. I also moved the RLY portion of the program around, even putting it in the ISR to no avail.
Yes, there is a transistor to drive the relay. I have found it troublesome in many ways to drive 5V (Or 3.3V!) relays from my logic supply. I typically power relays from the highest voltage available in the project in order to reduce current consumption and reduce the demand on my regulators, as well as reduce spontaneous resets, glitches, and outright frying stuff.
Bookmarks