kanthi uppala

Problem with ADC usage...

Discussion created by kanthi uppala on Apr 6, 2009
Latest reply on Apr 6, 2009 by Pascal Irrle

Hello Pascal,

    I am using the 56F8356 developement environment, I have peculiar problem with the ADC usage.

 I wait in a while loop for ADC conversion to get over. But the program always stays there.

 

   I am facing this problem after introducing new PWM and Decoder interrupts. I am not using any SYNCH Signal, its just the Software "START" conversion.

 

  Example of my program:

 

       GET_ADCA_OUTPUT()

{

      while( ADCA Conversion is Over)

        { 

          wait...

        }

       Return the output values..

}

 

Get_ADCB_OUTPUT()

{

      while( ADCB Conversion is Over)

        { 

          wait...

        }

       Return the output values..

}

 

If I introduce a delay factor for waiting, i am able to introduce it in only one of the loops, not in both, if i introduce in both the system is restarting.. or it stops working.

 

If I introduce a counter factor like this it works:

GET_ADCA_OUTPUT()

{

      while( ADCA Conversion is Over) && (Counter reaches zero)

        { 

          wait...

        }

       Return the output values..

}

 

Get_ADCB_OUTPUT()

{

      while( ADCB Conversion is Over)

        { 

          wait...

        }

       Return the output values..

}

 

But if i introduce a counter factor in both the loops it doesn't work..system restarts or does not function properly like this:

 

GET_ADCA_OUTPUT()

{

      while( ADCA Conversion is Over) && (Counter reaches zero)

        { 

          wait...

        }

       Return the output values..

}

 

Get_ADCB_OUTPUT()

{

      while( ADCB Conversion is Over) && (counter reaches zero)

        { 

          wait...

        }

       Return the output values..

}

Outcomes