Using your debugger, step through the program to make sure it is converting the values that you think it should be. Make sure that it is cycling so that the ADC is converting more than once. If you are using a library examples in your code, they only convert once per program load or reset.
I also tried using for loops with different counters and using the actual ADCs like for(ctr=0;vtrial<threshold;ctr++), it still loops forever. I also tried using the ADC value and not converting it to double also didn't work. while(Vtry<1000), 0=0v, 3.3=4095. It still looped forever. Any suggestions?
Can you show where ADCvalue is changed (e.g. in another task or by interrupt or by DMA etc.). In all theses cases it needs to be volatile as previously stated.