2 Replies Latest reply on Aug 20, 2019 2:18 PM by jizh_1737961

    pins' interrupt

    jizh_1737961

      I am trying to use two pins to test the phase difference of two input signals.

      It is fine I can test the signal's period and duty cycle, but I can't get a correct phase difference. The value of phase difference is much large than signal period! Is there someone can help out?

      I attached my project files which can be run in CY8CKIT-059 Kit. Pin1.6 and pin1.7 are connected; Pin0.6 and pin0.7 are connected

        • 1. Re: pins' interrupt
          EktaN_26

          Hello Jim,

           

          As per my understanding, I think you are trying to measure the phase delay between TestSig_1 [P0(7)] and TestSig_2 [P1(7)] generated by the PWM component. These pins are then externally connected to PWMxIn_1 and PWMxIn_2 respectively whch will trigger an interrupt. The dead time was set to 200 in the PWM component.

           

          I tried to observe the waveform of the TestSig_1 and TestSig_2. In this case I had set the dead time to 250 cycles and the waveform was as follows:

          Here, Blue corresponds to TestSig_1 and Red corresponds to TestSig_2.

          You can also measure the phase delay by the help of a 16 bit counter. In order to do this you can trigger (start) the counter inside the interrupt Handler of the first Interrupt (PulsehiISR_1) and read the value of the the counter inside the interrupt Handler of the second interrupt (PulsehiISR_2). The value of the counter can be used to observe if the value of the phase difference is greater than the signal period.

           

          Best Regards

          Ekta

          • 2. Re: pins' interrupt
            jizh_1737961

            Hi Ekta, thanks for your reply.  I did modify on my project and I can measure the phase difference now by routine the connection of the two signals to a xor gate than measure the pulse width in one pin.

            But I still can’t understand why my code can’t get the correct phase difference from two pins. Would you like to take a look at my code and help me to analysis why? Thanks.

             

            Best regards,

            Jim Zheng

             

             

            发自我的 iPhone

             

            在 2019年8月16日,上午7:42,EktaN_26 <community-manager@cypress.com> 写道:

             

             

             

            CYPRESS DEVELOPER COMMUNITY

             

            pins' interrupt

            reply from EktaN_26 in PSoC 5LP MCU Community - View the full discussion

             

            Hello Jim,

             

             

             

            As per my understanding, I think you are trying to measure the phase delay between TestSig_1  and TestSig_2  generated by the PWM component. These pins are then externally connected to PWMxIn_1 and PWMxIn_2 respectively whch will trigger an interrupt. The dead time was set to 200 in the PWM component.

             

             

             

            I tried to observe the waveform of the TestSig_1 and TestSig_2. In this case I had set the dead time to 250 cycles and the waveform was as follows:

             

            https://community.cypress.com/servlet/JiveServlet/downloadImage/2-206251-409128/1600-803/pastedImage_2.png

             

            Here, Blue corresponds to TestSig_1 and Red corresponds to TestSig_2.

             

            https://community.cypress.com/servlet/JiveServlet/downloadImage/2-206251-409127/468-349/pastedImage_1.png

             

            You can also measure the phase delay by the help of a 16 bit counter. In order to do this you can trigger (start) the counter inside the interrupt Handler of the first Interrupt (PulsehiISR_1) and read the value of the the counter inside the interrupt Handler of the second interrupt (PulsehiISR_2). The value of the counter can be used to observe if the value of the phase difference is greater than the signal period.

             

             

             

            Best Regards

             

            Ekta

             

            Reply to this message by replying to this email, or go to the message on Cypress Developer Community

            Start a new discussion in PSoC 5LP MCU Community by email or at Cypress Developer Community

            Following pins' interrupt in these streams: Inbox

            This email was sent by Cypress Developer Community because you are a registered user.

            You may unsubscribe instantly from Cypress Developer Community, or adjust email frequency in your email preferences