You sue a polled approach on multi sample mode, either change to
continuous mode or observe these two cautions for multi sample mode -
Multi-sample mode captures single samples back to back, resetting itself and the modulator
between each sample automatically.
This mode is useful when the input is switched between multiple signals. The filters are
flushed between each sample so previous samples do not affect the current conversion.
Note Take care when switching signals between ADC conversions. Either switch the input
quickly between conversions with hardware control or stop the ADC conversion
(ADC_StopConvert()) while switching the input. Then restart the ADC conversion
(ADC_StartConvert()) after the new signal has been connected to the ADC. Failure to do this
may result in contamination between signals in the ADC results
Note When operating in either the Multi-Sample, Continuous, or Multi-Sample (Turbo) modes, exercise caution to read the last ADC reading prior to the next ADC result completion. If reading the last result at the exact same time as the next result is complete, an incoherent reading may occur. When using DMA triggered by EOC or code in the ADC's ISR, this issue is easily avoided. Since you have a complete conversion time to read the last result, this should not be a problem in most designs. If the firmware cannot keep up with the ADC's conversion rate, the rate should be reduced to a manageable speed. This condition only occurs in the PSoC 3 family of products.
If you use an ISR in multi sample make sure all variables used in ISR are declared volatile.
Visually I cannot see any errors you made. You fulfill the requirements Dana told from the datasheets.
Only thing to change I would suggest is the way of getting an 8-bit value from the 16-bit result.
GetResult() delivers an int16, so do not store it into an uint16. Followed by two ifs you can write
if(Value <0) Value = 0;
if (Value > 255) Value = 255;
An additional hint: You may compute the value of A for the control-register as
A = 0x01 << j; // No "if" needed
Thank you Dana an thank you Bob
Bob I will try your valuable sughgestions.
The weitd tthing is that the projext was operatinh vry well , with no issues like originate this post.
I was following the recomendation of Dana before this post and trying to improve some project behavior suddenly with some change I cannot remeber the issue was started.
Bob, I wil try that you suggest and thank you very much your guys for help me.
Hello again you guys!!
Below is the code change that Bob suggest me:
while (((0x00== (Return_ADC= ADC_DelSig_1_IsEndConversion( ADC_DelSig_1_RETURN_STATUS ) ) )));
Arr[i][j]= Value[i][j] & 0x00FF;
if (Value[i][j]<0) Value[i][j]=0x00;
if (Value[i][j]>0) Value[i] [j]=0xff;
"Thje issue remain."
But there are a weird situation with the ADC: If I put the four analog inpunt to vssa( no connection to the ), the display shows that the adc continuos displaying oscillating values betwen 00 or FF.
The same happens if the connection of analogs input are to vdda.
I been doing project like this, trying diferent type of array and it never happened.
Thank you for your time.
Bob !!!! It seems to be that your proposed modification in the code is working ok, my friend !!!!
Before I just follow the recomendation of spec which has been working at that mom,ent.
Your approach is working good in this case.
So thank you so much !
Have a wonderfull day.
Alex, you are always welcome!
Bob !!! Thank you again.
I woul like to known what you know.
"... das einzig was ich weiß ist, dass wir nichts wissen können.
Das will mir schier das Herz verbrennen!" (Goethe, Faust I)