Well, it is fixed. See below. Jan-Erik Soderholm wrote: >Hi ! >I have not copied the full code, it's there in yur post for everyone to >see... > >Now, let me see if I understand here. >You have TMR1 interrupting each 0.5 sec. >You count those interrupts ("rollovers"). > > Yes. >At each rollover you take a *new* A/D sample and >compare to the current "number of rollovers". > >Right so far ? > > No. I actually was using the last A/D result for the comparison. A new conversion was not being not started until after the comparison was complete. >Now, I think one problem is that, even if the pot is left >alone, your A/D value will "flicker" a few bits between >each A/D reading. And since you are making a new >A/D reading each time, you might "miss" the "hit". >I'd only make a new A/D reading right after the >current reading have had a match with the rollover >counter. > > > Almost. My rollover counter was incrementing before I got my first A/D result causing my 'equal to' comparison to fail. I just changed it to get a conversion first.. Actually, the real fix should be to change the comparison to >= instead of just ==. If I'd do what you suggest pot changes won't take immediate effect, but rather just after a match is made. >Have you made a quick test-case to test that you actualy >can read the A/D line at all ? > > > Well, that was my quick test case... >A few other things... > > > >>; GP1 - Not used. (Seems to be blown on this particular chip.) >> >> > >Hm, are you sure that GP0 works ??? > > At the time I wrote that, no. Now, I do know it works. :) > > >>; GP5 - Drives an LED on a clock tick. Visual >>indication that program is working. >> >> > >Well, at least that the program is *running* and the *LED* >is working... :- > > Well when the code is debuged, that comment will be true... >One often hears that one should put as little as possible in the ISR >and do the rest in main. But in *this* case, since your main routine >doesn't do anything else then wait for the ISR to set the flag, >and there is no other interrupt sources, you could just as well >move more of the code into the ISR. That would simplify the >structure a little. I don't know if it solves your problem... > > > Yes, might simplify a little now, but other things are likely to be added later. :) >I'd make a test-case to verify if the A/D module is working at all. > >Oh, I nearly forgot... >Where do you wait for the A/D conversion to finish ? >Or are you just hoping that it will be finished in the next >0.5 sec (it probably will, but I think one should check the >GO flag anyway...). > > > It should be finished, but I'll add the wait. >And I'll also make sure that I just a chip without any "blown" pins ! >It's hard to know what else might been broke inside... > > > I only have this one '675. Need to get another one on the way... Actually GP1 is working now. CMCOM was not initialized. (See Jinx's post.) >Jan-Erik. > > > > > Aaron -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist