cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1

Anonymous
Not applicable

 hi to all,

   

              here i am attaching bundle of  workspace. can any body help by modifying to get peak value of ADC

   

Regards

   

PRP

0 Likes
1 Solution
ETRO_SSN583
Esteemed Contributor

I have not looked at your project, but from the trigger val from ADC that

   

tells you a strip has been inserted, you keep doing ADC conversions,

   

saving the conversion if it is > last conversion, and keep going until

   

your ADC value falls below trigger value.

   

 

   

   

 

   

Regards, Dana.

View solution in original post

0 Likes
15 Replies
Anonymous
Not applicable

here i ataching bundled work space

0 Likes
ETRO_SSN583
Esteemed Contributor

I have not looked at your project, but from the trigger val from ADC that

   

tells you a strip has been inserted, you keep doing ADC conversions,

   

saving the conversion if it is > last conversion, and keep going until

   

your ADC value falls below trigger value.

   

 

   

   

 

   

Regards, Dana.

View solution in original post

0 Likes
ETRO_SSN583
Esteemed Contributor

Picture did not post, here it is -

   

 

   

   

 

   

Regards, Dana.

ETRO_SSN583
Esteemed Contributor

I opened your project, you seem to be working with older ES silicon,

   

you should update your dev board if you are working with a Cypress

   

board.

   

 

   

http://www.cypress.com/?app=kitupgrade&CFID=1216625&CFTOKEN=65660931

   

 

   

Also you are using an older verison of Creator, you should be on 2.2

   

 

   

http://www.cypress.com/?id=2494

   

 

   

Regards, Dana.

Anonymous
Not applicable

 The development board i have is not my personal , so i have to use that only.

0 Likes
Anonymous
Not applicable

hi to all,

   

              i am getting an error of

   

 *** ERROR L127: UNRESOLVED EXTERNAL SYMBOL

   

    SYMBOL:  ADC_Samples

   

The command 'LX51.exe' failed with exit code '2'.

   

-------------------------------------------------------------------------------------------------------

   

Here is my code , Can any body help me where i went wrong.

   

-----------------------------------------------------------------------------------------------------

   

#define ADC_NUMBER_SAMPLES ( )            

   

 /* Initialize array elements to zero. */

   

     uint16 ADC_Samples[ ];

   

/* Defining and initializing the index */

   

     int16 ADC_Sample_Index = 0; 

   

///* Initiialize the average result */

   

     uint32 ADC_Sample_Max = 0; 

   

  /* Sample read from ADC */

   

      int16 ADC_Current_Sample = 0;  

   

/* Indicator for when sample is available */

   

     int8 ADC_Sample_Available = 0; 

   

void main()

   

{

   

    int8 i;

   

             /* Start the VDAC component */

   

                  VDAC8_2_Start();

   

    /* Start the opamp component */

   

          Opamp_1_Start();

   

             /* Sets the OpAmp power mode to high power */

   

          Opamp_1_SetPower(Opamp_1_HIGHPOWER);

   

             /* Start the VDAC component */

   

                   VDAC8_1_Start();

   

             /* Start the TIA component */ 

   

                   TIA_1_Start();

   

              /* Set the Resistive feedback to 40k ohms */

   

                    TIA_1_SetResFB(TIA_1_RES_FEEDBACK_40K);

   

              /* Set the capacitive feedback to 3.3pF */

   

                     TIA_1_SetCapFB(TIA_1_CAP_FEEDBACK_1_3PF);

   

             PGA_1_Start();

   

            /* Sets the PGA gain to 4 */

   

                     PGA_1_SetGain(PGA_1_GAIN_08);

   

            /* Sets the power mode to medium power */

   

                     PGA_1_SetPower(PGA_1_HIGHPOWER);

   

            /* Start the ADC */

   

                    ADC_DelSig_1_Start();   

   

             /* Start the ADC conversion */ 

   

                    ADC_DelSig_1_StartConvert(); 

   

                   CyGlobalIntEnable;                /* Uncomment this line to enable global interrupts. */

   

                    for(;;)

   

                    /* Place your application code here. */

   

            {

   

                               /* Check whether ADC conversion complete or not */

   

                                  if (ADC_DelSig_1_IsEndConversion(ADC_DelSig_1_WAIT_FOR_RESULT))

   

                                          {

   

                                           /* Get the result */

   

                                             ADC_Current_Sample = ADC_DelSig_1_GetResult8();

   

                                             ADC_Sample_Available = 1;

   

                                            }

   

 

   

                                             /* Testing for sample available from the ADC */

   

                                         if (ADC_Sample_Available) 

   

                                              {

   

                                                ADC_Sample_Available = 0;

   

                                                 /* storing the sample into the array, based on the index */

   

                                                 ADC_Samples[ADC_Sample_Index++] = ADC_Current_Sample;       

   

                                                 ADC_Sample_Max = 0;                          

   

                                                 for (i = 0; i < ADC_Sample_Index; i++)     

   

                         {

   

                          if(ADC_Samples>ADC_Sample_Max)

   

                              {

   

                                   ADC_Sample_Max=ADC_Samples;

   

                              }

   

                                                   }

   

                               }

   

   }                    

   

}

   

 

   
        
0 Likes
Bob_Marlowe
Expert II

Since you posted just the code and not the complete project we cannot compile it without getting a bunch of errors due to the missing componentst, pins etc..

   

 

   

What I can see so far is that you defined your array

   

uint16 ADC_Samples[ ];

   

But this does not allocate memory for it, only the pointer.

   

Better use

   

uint16 ADC_Samples[SampleCount};

   

or

   

ADC_Samples = malloc(sizeof(uint16) * SampleCount);

   

 

   

but all of the above should not cure your prime error-message.

   

 

   

Bob

Anonymous
Not applicable

Hi Bob,

   

here i am attaching the project .and i am using older version i.e creator 2.0

0 Likes
ETRO_SSN583
Esteemed Contributor

Per Bob's suggestion, if you change this -

   

 

   

   

uint16 ADC_Samples[ ];// = {}; /* uint16 ADC_Samples[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; */

   

 

to this

 

uint16 ADC_Samples[ 15 ];// = {}; /* uint16 ADC_Samples[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; */

 

It compiles.

 

Regards, Dana.

Anonymous
Not applicable

hi Dana,

   

if i use  uint16 ADC_Samples[ 15 ]; it take only 15 samples , but i need more , so what else we can do.

0 Likes
ETRO_SSN583
Esteemed Contributor

You can size that array larger. What exactly are you trying to do ? Average, or

   

store the entire reaction response curve in the array to then process ? If you

   

are trying to just get peak value then just comparing current sample against

   

last will get you there. You coould consider a peak detector as shown in following -

   

 

   

http://www.cypress.com/?rID=41001 but calculate droop for the implementation,

   

to make sure Vsignal does not droop more than 1 LSB, or there abouts.

   

 

   

of just do it with algorithim. from detect insertion -

   

1) Detect insertion

   

2) ADC conversion, save this in ADCtrigval

   

3) Save last conversion in ADColdvalue

   

4) ADC current conversion, bigger than ADColdvalue, then ADCpeak = ADCcurrent

   

5) ADCcurrent > ADCtrigval, goto 3

   

6) Done

   

 

   

Regards, Dana.

Anonymous
Not applicable

hi Dana,

   

               U mentioned to use Peak detection,but i have one doubt ragarding this peak detection.my doubt is suppose if we are getting multiple peaks eg. suppose we got first peak at V1 volts followed by a minimum and again a second peak  v2(v2>v1), whether the peak detector will detect V2 or V1.

   

Regards

   

PRP.

0 Likes
Bob_Marlowe
Expert II

A simple comparision between a current value and the actual maximum value will always find THE maximum. The only question will be when to end the algorithm.

   

Time could be one. Set max seconds to scan input with a timer.

   

Drop of input from actual maximum larger than a pre-declared value

   

Both of the above.

   

 

   

Bob

Anonymous
Not applicable

Hi Bob,

   

            Could you explaim me a more elaborate way . example my timer is for 10 seconds and ADC is 8 bit with contiunous  mode and conversion rate is 8500 SPS.how can i stop ADC to stop conversions. the app ADC_Stop(); is not valid in PSoC 3 ES2 version.

   

Regards

   

PRP

0 Likes
ETRO_SSN583
Esteemed Contributor

If the response contains more than one rersponse curve it wopuld be instructive

   

to understand what is causing the additional peak. Not being a chemistry expert,

   

let alone blood chemistry, I would venture a guess the chemistry proceeds to a

   

single peak then once reactive agent is exhausted recedes. So this would imply

   

electrical noise, strip re-positioning, non-uniformity of strip test chemicals, non uniform

   

electrode composition........

   

 

   

   

 

   

So does the minimum between peaks always look the same in time and value ?

   

Then you can discriminate in code based on value or time or both.

   

 

   

 

   

First you need to understand the problem before the solution can be applied. What is

   

causing the 2'ond peak ? Then determine which peak is the one to examine.

   

 

   

 

   

Regards, Dana.