ADC +5v and -5v read and compare

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
DeAa_335316
Level 4
Level 4
First like received

Hello,

   

I am using CY8C28445 (PSOC 1) ic . i have to use two ADC . first ADC calculate 5v to 0v and second ADC calculate -5v to 0. 

   

Both of ADC values i have to compare and turn on two separate  LED light .

   

ADC1 value  >  ADC2 value = LED 1 turn on 

   

ADC2 value  >  ADC1 value = LED 2 turn on 

   

Please provide the sample code for this task . i had test a basic code for +5v to 0 but i am not able to get 0 to -5v value .

   

 

   

Best Regards 

   

Deepak Aagri

0 Likes
5 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

The input to any pin on your PSoC may not be less than GND. So to measure a voltage < 0V you will have to level-shift it into the range of 0 .. 5V using an R ladder.

   

 

   

Bob

0 Likes
DeAa_335316
Level 4
Level 4
First like received

OK .. but i want to calculate multiple ADC value .. how i can switch pot ADC pin to different pin .
i only can use one ADCINC and my requirement is read to 4 input source separate value . is i need to change analogcolumn_inputmux port pin each time of interval to get all 4 channel value . if this is the right way for read multiple ADC value then please let me know how to write a code for multiple ADC read in run time .

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Long time ago that I used that... Use an AMUX4 and configure it for your input pins. Look into datasheet for code example.

   

Keep in mind that the first 2 ADC samples after switching the mux are invalid.

   

Consider migrating to a 32 bit processor in a PSoC4. Kits available starting at $10. Including debugging capabilities!!!

   

 

   

Bob

0 Likes
DeAa_335316
Level 4
Level 4
First like received

Hi Bob,

   

Thanks for your advice but  Please share the mux code for  changing the input pin .... 

   

or tell me below code related to mux input pin change...

   

 AMUX4_InputSelect(BYTE bChannel);

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

What in the datasheet explanation is unclear?

   

 

   

 

   

Bob

   

0 Likes