The body of the while is not the issue. I have tried with and w/o. It's only there to turn off the LED when it enters the loop. On 9/18/06, Tamas Rudnai wrote: > > Hi, > > I am not entirely sure, but don't we face again the read-set-write issue > again? > > //Begin the conversion and block until it's complete > //while(test_bit(adcon0, 1)) > while(!test_bit(pir1, ADIF)) > { > set_bit(gpio, LED_PIN); > } > > Why do you set the pin high each cycle, anyway? First try to remove the > body > of the while. > > Tamas > > > On 18/09/06, Shawn Wilton wrote: > > > > Well, I have code for both methods. One for polling and another for > > checking the interrupt flag. It would require massive restructuring to > > use > > an ISR routine. I don't want to do that, so I was just testing to see > if > > enabling the interrupt and then polling the ADIF flag (which should > work) > > *would* work. It doesn't. I couldn't get the Go\Not Done bit flip to > > work, > > so I threw in some code to see if it would complete with the ADIF flag. > > > > Neither seem to allow the conversion to complete. It just goes in to > the > > loop and hangs. > > > > > > > > On 9/18/06, Michael Rigby-Jones wrote: > > > > > You are enabling the A/D interrupt, but then you are polling the > > interrupt > > > flag which doesn't make sense. You only enable the interrupt if you > > want to > > > handle completed conversions within your interrupt handler. If instead > > you > > > are polling the ADIF flag to wait for A/Dconversions then make sure > you > > > clear ADIE. > > > > > > Regards > > > > > > Mike > > > > > > > -- > > > > Shawn Wilton (b9 Systems) > > http://b9Systems.com <- New web page > > -- > > http://www.piclist.com PIC/SX FAQ & list archive > > View/change your membership options at > > http://mailman.mit.edu/mailman/listinfo/piclist > > > > > > -- > unPIC -- The PIC Disassembler > http://unpic.sourceforge.net > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- Shawn Wilton (b9 Systems) http://b9Systems.com <- New web page -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist