How to change PWM's output to different pins dinamically?

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

cross mob
user_4095611
Level 1
Level 1
First like given

Hi everyone, I have been working with psoc for a while (5 years), and with psoc 1 I changed once a PWM output through software dinamically, I mean, in the block diagram I set the output to a certain pin and then in the code I changed it to another pin when I needed it. But rigth now I am working with a Psoc 4 kit wich has the CY8C4125AXI483 and I cannot find how to do the same thing with this psoc, I have read the GPIO manuals and the TRM and I cannot find it. It is possible to do it??? Thanks in advace.

Ale

0 Likes
1 Solution
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

I tried following schematics

Rev.2 using output enable

rev2.JPG

This seemed to be almost OK, but time to time I observed following symptom

IMG_3470.JPG

Rev.3 using AND gates

rev3.JPG

The wave form was as clear as the MUX version.

So I suppose using AND and Control_Reg seems to be a recommended method, so far.

moto

View solution in original post

4 Replies
lock attach
Attachments are accessible only for community members.
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

I tried this with CY8CKIT-044.

schematic

000-schematic.JPG

pin

001-044-pin.JPG

main.c

====================

#include "project.h"

int main(void)

{

    int i = 0 ;

    CyGlobalIntEnable; /* Enable global interrupts. */

    PWM_Start() ;

    for(;;) {

        Control_Reg_Write(i) ;

        i = (i + 1) % 3 ; /* 0, 1, 2, 0, ... */

        CyDelay(10) ;

    }

}

====================

the oscilloscope screen

IMG_3464.JPG

attached is the test project.

moto

Thanks I thought in that too, but I have read in the multiplexer (MUX) datasheet that it makes certain delay (microseconds) for the signals passing through it and for my application that is not an option. Don't you have any other idea. The pulse I want to generate is a 100 kHz pulse but with a Ton=50ns, that is why the MUX is not an option. Thank you!!!!

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

I tried following schematics

Rev.2 using output enable

rev2.JPG

This seemed to be almost OK, but time to time I observed following symptom

IMG_3470.JPG

Rev.3 using AND gates

rev3.JPG

The wave form was as clear as the MUX version.

So I suppose using AND and Control_Reg seems to be a recommended method, so far.

moto

Thanks moto, I will try tomorrow and let you know how it went!!! Thanks!!!!

0 Likes