This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ADC Values

Other Parts Discussed in Thread: CONTROLSUITE

Hello, 

I currently have a motor hooked up to an H-bridge and I am supplying the voltage to the H-bridge through a power supply. I have a current sensor in series with the H bridge.

I have a Vout from the current sensor that tells me how much voltage, and I can get the current by dividing it by the gain. The Vout is hooked up to my f28335 at A0 and i would like to turn the motor off at a certain voltage. 

I am trying to set a condition so that when the digital input is above a certain number call the function that stops the motor. It does not seem to be working right now. 

Sample code is below:

for (i = 0; i <1000 ; i ++)
{
      voltage = (AdcRegs.ADCRESULT0>>4);
}

if(voltage > 2300)
      Stop();

Does the bit shifting effect the number I am comparing against? Can i compare against the input value?

  • Can you confirm you are getting the expected ADC results to being with?  You can also try the ADC mirror registers since they are already right justified:

    &AdcMirror.ADCRESULT0

    I'm not quite sure I understand the purpose of the for loop.  I think you will want to setup an ISR to sample with the ADC and compare the result.  You can check out the adc_soc examples in controlSUITE for tip s how to do this.

    regards,

    Joe