I am using the Typical Example code provided for the higher level component AD1. I basically followed the One conversion example of all channels, with interrupt service.
I selected two channels to be enabled in the component and selected the pins, but when the interrupt fires off and I command
AD1_Measure(TRUE) then
AD1_GetValue(Values);
only channel 0 shows a value. channel 1 is always 0 value in the variable view. My code looks at the value as ADC_Value[0] and ADC_Value[1]
What might I be missing?
Hi,
Could you please post the sample project with you settings ?
best regards
Petr Hradsky
Processor Expert Support Team
I can't load the project due to some customer info included.
full project uploaded under TIC 1-1005917641
below is a screen capture of the bean settings.
/* User includes (#include below this line is not maintained by Processor Expert) */
bool ValuesAvailable = FALSE; // control variable
unsigned int ADC_Value[2];
LDD_TError Error;
unsigned int i,j;
LDD_TDeviceData *MyDataPtr;
unsigned int timer_done=FALSE;
unsigned int ADC_Total,ADC_Avg;
unsigned int temp;
bool ValuesAvailable;
And here is the code I used its all tabbed corrrectly:
AD1_Measure(TRUE); | |||||
AD1_GetValue(ADC_Value); | |||||
Wait_ADC: | |||||
while(!ValuesAvailable)goto Wait_ADC; /* wait for interrupt saying ADC is complete */ | |||||
ValuesAvailable = FALSE; |
Alright, I have tried everything. I put the get value inside the interrupt routine rather then in main, I tried to convert just channel 1, I even tried AD1_Measure(FALSE); to get the second conversion to happen like the typical usage example. I always get a value in the first element and only 0 in the second element. Could someone spin the most simple example either polling or through interrupt of getting two channels to convert?
I am new to the community, where do I go for attachments?
It's within my last post.
You were probably looking only in inbox notifications. Try to see the whole thread by clicking on the title or use this link: Re: ADC on FRDM board using PE
best regards
Petr Hradsky
Processor Expert Support Team
Hi,
It is hard to say what you are missing, there is a lot of possibilities for the reasons of your problem.
Try to follow the examples that you can find in Help of component: right click on the component->Help on component->typical usage. Unfortunately are examples just for one channel.
In the attachments you will find and example reading 4 ADC channels without interrupt and there is another one with one channel and with interrupt. (it is one way you can do it, could be many ways more).
Hope this helps.
Adrian, the TIC provide the file which I attached to my documents. FRDM-ADC-PEx.zip
I still only see one value shown in the debugger for Measured Values, I changed the first two pins to PTE20, and PTE22 which the real application uses. Can you confirm this project is working correctly.?
You mentioned attachments, which are you referring to?