I'm using the MSP430FR5725.
Simply put, I have a motor that is attached to a position-sensing potentiometer. The analog value from the pot is read through an ADC. The ADC value tells me what position the motor is in. I would like the motor to stop when the pot hits certain values (aka the motor reaches certain positions). Think of a circle; the "max_position" would be about the top middle (peak) and the "min_position" would be the bottom middle (valley).
My problem is that the position read in during my ADC interrupt isn't being compared correctly against my hardcoded minimum and maximum positions, so the motor ends up driving past these barriers. I speculate that the position isn't being continuously read in/compared in the while loop.
I've linked the relevant code below. I've redacted some extraneous variables, functions, etc. that don't pertain to the problem.