- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone,
I tried to use single adc for multi channel data extraction, I added the mux for dynamic changing between channels and get the value. But it turn out to be that the value extracted from channels always dominated just by one, all the other channels value is corrupted. I tried to add some delays between channel switching and it didn't work as well. Could you give me some suggestions about how to use for multi channel extraction?
Thank you so much in advance!
AMUX4_InputSelect(AMUX4_PORT0_1); //sample the value of P0[1]
for(i=0;i<30;i++) {;}
if (ADC1_fIsDataAvailable() != 0)
{
ADC_pot_Result = ADC1_wClearFlagGetData();
Cresult_2_1 = (float)ADC_pot_Result * 128 / 4096;
*level1 = 128 - (unsigned int)Cresult_2_1;
}
AMUX4_InputSelect(AMUX4_PORT0_3);
for (i=0;i<30;i++){;}
if (ADC1_fIsDataAvailable() != 0)
{
ADC_pot_Result = ADC1_wClearFlagGetData();
Cresult_2_2 = (float)ADC_pot_Result * 128 / 4096;
*level2 = 128 - (unsigned int)Cresult_2_2;
}
AMUX4_InputSelect(AMUX4_PORT0_7);
for (i=0;i<30;i++){;}
if (ADC1_fIsDataAvailable() != 0)
{
ADC_pot_Result = ADC1_wClearFlagGetData();
Cresult_2_3 = (float)ADC_pot_Result * 128 / 4096;
*level3 = 128 - (unsigned int)Cresult_2_3;
}
- Labels:
-
PSoC 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You issued a start command for AMUX4 ? The respective pins configed for AnalogInput, Hi-Z analog ?
You might consider posting project for forum to look at.
"File" Designer
“Archive Project”
Use Internet Explorer or Firefox to post, Chrome does not seem to work.
Regards, Dana.