To get ADC results on multiple pins of the ADC, we change the ADMUX to the channel that we want to receive the result, but this change needs to be done one at a time. That is to say, first we get invoke a conversion on channel 0 and get the result, then the channel is changed to 1 and we invoke a conversion and get the result. This is done for as many times as there are channels to collect data.
In this case, a switch and case is used:
switch (ADMUX)
{
case 0xC0:
Send_An_IntegerToMrLCD(4, 1, theTenBitResult, 4);
ADMUX = 0xC1;
break;
case 0xC1:
Send_An_IntegerToMrLCD(4, 2, theTenBitResult, 4);
ADMUX = 0xC0;
break;
default:
//Default code
break;
}
Comments and Additional Information
Have some code to share? Or additional information? Respond here:
You need to be logged in to save a response on this page. The response must be constructive, helpful, supplimentary or to correct the existing video, code or narrative content.