cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

Anonymous
Not applicable

I'm trying to use ADC to read a negative DC values but it doesn't display the correct negative values on the LCD. I brought the Agnd to an external. I'm generating this dc voltage from a function generator. I attached my project files . I'm not very good at C coding so i just found an example project and modified a little bit. Please tell me how i can fix this problem. I'm using POSC 3 on the Cy8Ckit-001 Development board.

   

Vi

   

Thanks

0 Likes
Reply
7 Replies
Anonymous
Not applicable

 I'm trying to read signals that can be positive or negative . I want to be able to see exactly what Input , if it's negative then i want to see negative or positive then i want to see positive on the LCD.

0 Likes
Reply
Anonymous
Not applicable

Hi vl123,

   

 

   

After testing your project, here are the suggestions:

   

1) Declare the ADCResult as signed instead of unsigned. This is to accomodate negative readings since you are using the ADC in differential mode.

   

2) SInce you are using ADC in multi-sample mode, the ADC_StartConvert( ) API should be used after ADC_StopConvert( ) in the loop.

   

3) Once the ADC result is obtained using ADC_IsEndConversion(ADC_WAIT_FOR_RESULT), the ADC_StopConvert() can be used immediately. There is no necessity to check for ADC_WAIT_FOR_RESULT in "if" statement. It always returns a false as ADC_WAIT_FOR_RESULT is defined as 0 in a macro. The ADC_StopConvert() API would never execute.

   

4) In the project, connect the three negative terminals, Pin_4, Pin_5 and Pin_6 to the analog ground Agnd. This way you can measure the voltage below the analog ground. However be cautious of the fact that the negative voltage should not go below the PSoC digital ground.

0 Likes
Reply
Anonymous
Not applicable

When using the CY8CKIT-001, make sure that the voltage settings on VDD SELECT (3.3V or 5V) is in accordance with the voltage selected in the Operating Conditions. It can be modified in .cydwr > System > Operating Conditions. Select the right voltages for Vddd, Vdda  and Vddio's.

   

 

   

The project is modified with the changes specified before and is attached.

   

Let us know if this helps.

0 Likes
Reply
Anonymous
Not applicable

A blog post by Ganesh Raaja explains how to measure negative voltage using PSoC1. This will be a useful reading. The link to this post is http://www.cypress.com/?rID=50815&cache=0

0 Likes
Reply
Anonymous
Not applicable

 Hi Dasq,

   

First of all , I just want to say thank you very much. I really appreciate your help. I've been scratching my head over this.

   

It definitely works. But one more question, When i go negative to about -2.49 , it becomes positive again and also when i reach about +2 positive volts , its kinda unstable like changing really fast. Do you know why ?

   

 

   

thanks a lot

   

Vi

0 Likes
Reply
Anonymous
Not applicable

Hi vl123,

   

 

   

Since you are using ADC with 16-bit resolution, it is recommended to declare the variable ADCResult as int32 (signed 32 bit) and read it using ADC_GetResult32( ) API.

   

This might eliminate the issue of rolling over to positive value from negative (transition from -2.5V to positive value).

0 Likes
Reply
Anonymous
Not applicable

 thanks A lot

0 Likes
Reply