Well, I finally gave up on this code. I had the same problem with another variation of this code and fixed that one. But the first is still a head -scratcher. I'm sure it has nothing to do with ADC inputs though. Just my own doing.