2 Replies Latest reply on Nov 11, 2020 8:33 AM by LePo_1062026

    PSOC4 test code | CE95340 - Amplifier with Dynamic Gain Switching with PSoC 4.

    srMu_1513646

      Hi,

       

      I am trying to test a subjected project code with little modification(removed 3 channel MUX).

      There is no changes in the output. Please help.

       

      Attached project file for your reference.

       

       

      Regards,

      Ram

        • 1. Re: PSOC4 test code | CE95340 - Amplifier with Dynamic Gain Switching with PSoC 4.
          LePo_1062026

          Ram,

           

          I'm not surprised that you get one output and that's all.

           

          If you load the original project (CE95340) with the mux intact and build it and program it into your kit, you will find that only one output occurs.

           

          The issue is that in main() the program once initialized waits for the dataReady signal to go from 0 to 1.

                  while(dataReady == 0u)
                  {
                      ; /* Wait for ADC conversion */
                  }
          

           

          When the ADC completes a conversion, the ISR is issued and this code is executed:

          CY_ISR(ADC_ISR_Handler)
          {
          ...
               {
               ...
                  dataReady = 1u;
              }
          .
          }
          

           

          Now the main() code can exit the while() it's stuck in.  However, dataReady remains 1 for the rest of it's life. The ISR has NO effect

          The following change should be made to the code in main():

                  while(dataReady == 0u)
                  {
                      ; /* Wait for ADC conversion */
                  }
                   dataReady = 0;     /* reset this status variable */
          

           

          Give it a try.  Let me know if there is any improvement.

           

          Len

          • 2. Re: PSOC4 test code | CE95340 - Amplifier with Dynamic Gain Switching with PSoC 4.
            LePo_1062026

            Ram,

             

            I found a CY8CKIT-049-42xx to load the project onto.  Therefore I made the following changes to the application with no Mux.

            • Terminal baud rate = 115.2K 8N1
            • CPU clock = IMO @ 12MHz
            • LED = P1.6
            • Analog In+ = P2.0
            • Analog In- (feedback input for gain) = P2.3
            • OpAmp out = P1.2
            • UART Tx = P4.1

             

            Attached is the project I used.  You can make pin assignment changes as needed.

             

            To test the project, I just touched the Analog input (P2.0) with my finger.  Since the analog input is HiZ, my finger causes minor input changes.  When this happens, the terminal output displays the change of ADC reading.  A new display only occurs

            Note: Due to the following code, only a change to the currently selected input is updated to the terminal display.  This is due to the "previousValue" needs to be different than the current measured value.

             

                    /* If the result changes, send it to UART */
                    if(previousValue != mVolts)
                    {    
                        SendChannelVoltage(channel, mVolts);
                        previousValue = mVolts;
                    }
            

             

            Len