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

cross mob
DanielDs
Level 1
Level 1
10 sign-ins 5 replies posted 5 sign-ins

Hi,
I am using PSoC 4 P/N: CY8C4045PVI-DS402 And I need to detect a digital duty cycle.
I realized that this could easily be done with any Digital I/O of very simple microprocessors.
According to the datasheet of the component, I don't really understand if there is an option and how to do it. I would like to get support on this, if anyone has an idea how to implement this.
Thanks,
Daniel

0 Likes
1 Solution
xomow4
Level 1
Level 1
First solution authored First reply posted Welcome!

Discover innovative methods for enhancing in-person listening experiences, especially for IT companies in Phoenix. Explore cutting-edge technologies and strategies that can foster better communication, collaboration, and understanding within IT teams and their clients in the Phoenix area.

 
 

View solution in original post

0 Likes
6 Replies
xomow4
Level 1
Level 1
First solution authored First reply posted Welcome!

Discover innovative methods for enhancing in-person listening experiences, especially for IT companies in Phoenix. Explore cutting-edge technologies and strategies that can foster better communication, collaboration, and understanding within IT teams and their clients in the Phoenix area.

 
 
0 Likes
Ekta
Moderator
Moderator
Moderator
750 replies posted First like given 250 solutions authored

Hi @DanielDs 

You can configure the microcontroller to generate an interrupt on the positive and negative edges of the signal.
You can register an interrupt handler and start a timer on receiving the positive edge. Next, when the negative edge is received you can read the timer. This would help you to determine the duration for which the signal is high. 

When the interrupt corresponding to next positive edge comes you can stop the timer and read its value again.

These values will help you determine the duration for which the timer was on (total period) and the duration for which the signal was high (Value of timer first read), These values can help you determine the duty cycle of the signal.

You can refer to the following appnote to see how interrupts can be configured: https://www.infineon.com/dgdl/Infineon-AN217666_PSoC_6_MCU_Interrupts-ApplicationNotes-v07_00-EN.pdf...

The following code snippet will help you understand how the timer frequency can be configured to measure time of any operation: https://infineon.github.io/psoc6hal/html/group__group__hal__timer.html

Best Regards
Ekta

 

DanielDs
Level 1
Level 1
10 sign-ins 5 replies posted 5 sign-ins

Hi Ekta,
Thanks for the answer, I see the links you attached refer to PSoC6. Does it also refer to PSoC4 I'm using? In PSoC4, does it need to be connected to a specific I/O pin or can it be connected to any digital I/O that exists in PSoC4?
Thanks,
Daniel

0 Likes
Ekta
Moderator
Moderator
Moderator
750 replies posted First like given 250 solutions authored

For PSoC 4 you can use the following appnote: https://www.infineon.com/dgdl/Infineon-AN90799_PSoC_4_Interrupts-ApplicationNotes-v07_00-EN.pdf?file...

From the device you have mentioned, I think you might be using PSoC creator for your project and the following example might be ideal: https://www.infineon.com/dgdl/Infineon-CE224594_PSoC_4_Timer_Counter-Code%20Example-v01_00-EN.pdf?fi...

You can connect it to any GPIO, if the PSoC Creator builds successfully after assigning that particular GPIO then there should be no issues.

Best Regards
Ekta

DanielDs
Level 1
Level 1
10 sign-ins 5 replies posted 5 sign-ins

As for which pin can be connected, should I connect the signal to any pin that is configured as TCPWM? For example, in PSoC4 these are pins: 1-4, 7-14, and 19-21?
Thanks,
Daniel

0 Likes
Ekta
Moderator
Moderator
Moderator
750 replies posted First like given 250 solutions authored

If you are using the method mentioned in the code example I had shared, then you can connect the signal to any of the TCPWM Capture pins.

If you are using gpio and interrupts, then you can connect it to any of GPIO.

Thanks
Ekta