1 2 3 Previous Next 43 Replies Latest reply on Jun 5, 2014 8:32 PM by ctm.ctm

    To Set Reference voltage in ADC

    rajendra.prasad

      hi to all,

         

                   how can i  set reference voltage for ADC in psoc1. here i want to set reference voltage 2.5v.

         

      thanks

         

      PRP

        • 1. Re: To Set Reference voltage in ADC
          user_14586677

          In global resouces window, upper left corner, select "Ref Mux" and

             

          pick one of attached selections. Note if you are using Vdd = 5V, then

             

          Vdd/2 +/- Vdd/2 is a 2.5 Volt reference. If you are 3.3V Vdd then use

             

          external reference, or route external to a PGA and set its gain to get

             

          a 2.5 V Ref.

             

           

             

          Regards, Dana.

          1 of 1 people found this helpful
          • 2. Re: To Set Reference voltage in ADC
            user_14586677

            Also look in TRM (Technical Reference Manual) for your device to get a better

               

            understanding of the Ref system.

               

             

               

            Regards, Dana.

            • 3. Re: To Set Reference voltage in ADC
              rajiv.vasanth.badiger

              Also, refer application note AN2219 PSoC 1 selecting analog ground and reference

                 

              http://www.cypress.com/?rID=2779

                 

               

                 

              -Rajiv Badiger

              • 4. Re: To Set Reference voltage in ADC
                ctm.ctm

                 Hi every body!

                   

                When I use ADC10 user module to measure DC voltage 0-4V, it is OK (I'm using CY8C21323, PSoC designer 5.4). I want measure 0-5V, can you please tell me solution for that?

                   

                Thanks!

                • 5. Re: To Set Reference voltage in ADC
                  user_14586677

                  Simplest method is external R V divider, as PGA is not available on

                     

                  this part. Divider would scale 0 - 5 to 0 - 4. Of course it would affect

                     

                  loading of signal, and you would have to trade off magnitude of R's

                     

                  for offsets due to leakage. And ratio would require hi accuracy R's

                     

                  if you want to maintain accuracy. A signal path error analysis would

                     

                  be in order.

                     


                     

                  Regards, Dana.

                  • 6. Re: To Set Reference voltage in ADC
                    ctm.ctm

                     Hi every body,

                       

                    This is next question, can you help me?

                       

                    I'm doing project with PSoC CY8C21323, PSoC designer 5.4.

                       

                    Contents:

                       

                    PSoC measure DC voltage (0-5V) from 4 pin (AnalogInput):

                       

                    - P0.3 : voltage 0-5V.

                       

                    - P0.2:  voltage of LM35.

                       

                    - P0.4:  voltage of current sensor return (2.5-5V).

                       

                    - P0.6: voltage of voltage sensor return(0-5V).

                       

                    PSoC send all data to PC via RS232 circuit, using TX8 module.

                       

                    At PSoC CY8C21323, in ADCs module, i see only ADC10 (has 2 analog column, AnalogColumn_InputMUX_1 and AnalogColumn_InputMUX_0).

                       

                    How to get data from 4 pin AnalogInput? By ADC10? ADC10 can measure 0-4V!!!

                       

                    (At PSoC CY8C21323: no ADCINC, ADCINCVR,DELSIG,PGA...)

                       

                    Many thanks!

                    • 7. Re: To Set Reference voltage in ADC
                      user_1377889

                      Put the ADC into the right column (01) and use an AMUX8. Then you may select ANY input from port0

                         

                       

                         

                      Bob

                      • 8. Re: To Set Reference voltage in ADC
                        ctm.ctm

                         Hi Dana, 

                           

                        If without external RV divider, have you another solution to measure 0-5V? By another user module?

                           

                        Because i don't want change circuit which I did.

                           

                        Thanks!

                        • 9. Re: To Set Reference voltage in ADC
                          ctm.ctm

                           Hi Bob,

                             

                          I will do that you said.

                             

                          Thanks!

                          • 10. Re: To Set Reference voltage in ADC
                            user_14586677

                            Yes, you could use a 16 bit PWM as a DAC, feed that to a comparator,

                               

                            the other side comparator Vx from AMUX. In code do a binary search on

                               

                            PWM duty cycle (compare) value to trip the comparator (poiling its output)

                               

                            , or use ISR on it.

                               

                             

                               

                            This will take 1 analog and 2 digital blocks, unless you use 8 bit PWM (1 block),

                               

                            which equates to ~ 40 mV ADC resolution.

                               


                               

                            Note PWM has LP filter on output to create a DC value proportional to duty

                               

                            cycle of PWM. PWM filter controls settling time, ripple, attached might be of help.

                               

                             

                               

                            Regards, Dana.

                            • 11. Re: To Set Reference voltage in ADC
                              ctm.ctm

                              Hi Bob, Dana

                                 

                              I have just coded project, i'm using TX8, ADC10, AMUX8 user module.

                                 

                              (refer "Measure and Display 0 to 4 V on LCD Using  ADC10"; www.cypress.com/?docID=35081).

                                 

                              PSoC measure DC voltage (0-5V) from 4 pin (AnalogInput):

                                 

                              - P0.3 : voltage 0-5V.

                                 

                              - P0.2:  voltage of LM35.

                                 

                              - P0.4:  voltage of current sensor return (2.5-5V).

                                 

                              - P0.6: voltage of voltage sensor return(0-5V).

                                 

                              -P1.3: TX8.

                                 

                              PSoC send all data to PC via RS232 circuit, using TX8 module.

                                 

                              (Currently, set voltage input for 4 pin AnalogInput 0-4V to test)

                                 

                              But built project errors:

                                 

                              Linking..
                              !E <library>(1539): {linker} area 'text' not large enough. Need 932 bytes
                              lo 3897 hi 4095 size 199
                              !E ftoa.s(1435): {linker} Code address 0:0x151 already contains a value
                              !E ftoa.s(1435): {linker} Code address 0:0x152 already contains a value
                              !E ftoa.s(1435): {linker} Code address 0:0x153 already contains a value
                              !E ftoa.s(1435): {linker} Code address 0:0x154 already contains a value
                              !E ftoa.s(1435): {linker} Code address 0:0x156 already contains a value
                              !E ftoa.s(1435): {linker} Code address 0:0x157 already contains a value
                              !E ftoa.s(1435): {linker} Code address 0:0x159 already contains a value
                              !E ftoa.s(1435): {linker} Code address 0:0x15a already contains a value
                              !E ftoa.s(1435): {linker} Code address 0:0x15c already contains a value
                              !E ftoa.s(1435): {linker} Code address 0:0x15d already contains a value
                              !E ftoa.s(1437): {linker} Code address 0:0x15c already contains a value
                              !E ftoa.s(1437): {linker} Code address 0:0x15d already contains a value
                              !E ftoa.s(1437): {linker} Code address 0:0x15e already contains a value
                              {linker} Too many errors, exiting...
                              make: *** [output/CY8C21323_ADC_0_5V.rom] Error -1
                              !W Use Code Compression Technologies at Projects -> Settings -> Compiler to improve memory utilization
                               
                              CY8C21323_ADC_0_5V - 15 error(s) 1 warning(s) 22:42:57

                                 

                              I don't why! My project has about 100 line of code. Can you tell me, please? This is my project!

                                 

                              Thanks!

                              • 12. Re: To Set Reference voltage in ADC
                                user_1377889

                                Your ftoa is eating up 40% of your flash. Better think of calculating in integer arithmetic and convert yourself (inserting dec-point at the correct position)

                                   

                                Having only 4K flash is a bit challenging...

                                   

                                 

                                   

                                Bob

                                • 13. Re: To Set Reference voltage in ADC
                                  user_14586677

                                  Here is one possibility for your own C ftoa() -

                                     


                                     

                                       

                                     

                                              http://www.geeksforgeeks.org/convert-floating-point-number-string/

                                     


                                     

                                  Just google "C ftoa" and there are others.

                                     


                                     

                                  Regards, Dana.

                                  • 14. Re: To Set Reference voltage in ADC
                                    ctm.ctm

                                    Hi Bob, Dana

                                       

                                    Because ftoa() is eating up 40% of your flash which Dana said. So I don't convert recieved data from 4 pin AnalogInput to voltage, I only read value ADC10 returns from 4 pin. But value ADC10 which i received is "-", you don't care oC, A,V,Next; these are text. I'm using itoa() in project; check data by terminal 1.9b.

                                       

                                    - oC   - A   - V   - V Next...
                                    - oC    A   - V   - V Next...
                                    - oC   - A   - V   - V Next...

                                       

                                     

                                       

                                     

                                       

                                    I think: prolems at select pin AnalogInput by AMUX8 module fail, so ADC10 can't work well.

                                       

                                    Can you please check configuration, code in my project? Is it correct?

                                       

                                    Many thanks. This is my project!

                                    1 2 3 Previous Next