One shot pulse output on GPIO with PSoC4000S

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

cross mob
YoIs_1298666
Level 5
Level 5
250 sign-ins 100 replies posted 100 sign-ins

Hello,

I have two questions about PWM component for one shot pulse on GPIO.

Can I resolve problems below.

1. I would like to generate one shot pulse output on GPIO with PSoC4000S.

    but, we won't get it with PWM component.

2. And I need to change both period and compare settings immediately.

    but, we must wait TC once after changing both period and compare settings of PWM.

Best regards,

Yocchi

0 Likes
1 Solution
Alakananda_BG
Moderator
Moderator
Moderator
50 likes received 250 sign-ins 250 replies posted

Hi YoIs_1298666,

For the first question you have posted you can look at the thread which will meet your requirements of generating one shot pulse output on the gpio pin. I have shared the link of the thread where you can follow the steps to do the same.

How do I create a 10us pulse on the PSoC4 TCPWM component and have it come out to a GPIO pin

For the second question in the PWM component you have an option of generating an interrupt for TERMINAL COUNT whenever an interrupt is triggered you can write the period and compare values inside the ISR which might help to solve your issue.

You can get back if your still facing any issues.

Regards

Alakananda

Alakananda

View solution in original post

0 Likes
6 Replies
Alakananda_BG
Moderator
Moderator
Moderator
50 likes received 250 sign-ins 250 replies posted

Hi YoIs_1298666,

For the first question you have posted you can look at the thread which will meet your requirements of generating one shot pulse output on the gpio pin. I have shared the link of the thread where you can follow the steps to do the same.

How do I create a 10us pulse on the PSoC4 TCPWM component and have it come out to a GPIO pin

For the second question in the PWM component you have an option of generating an interrupt for TERMINAL COUNT whenever an interrupt is triggered you can write the period and compare values inside the ISR which might help to solve your issue.

You can get back if your still facing any issues.

Regards

Alakananda

Alakananda
0 Likes

Hello Alakananda-san,

Thank you very much for your advice.

I can output the one shot pulse below.

And I can confirm to reflect the change of both period and compare settings immediately.

pastedImage_0.png

pastedImage_3.png

pastedImage_5.png

I have a question.

If PWM and Timer_1 start with "PWM_Start() ,Timer_1_Start() and Clock_Start()" , Pin_OneShot is output the one shot pulse immediately. There is no one shot pulse because I execute "Timer_1_TriggerCommand(Timer_1_MASK|PWM_MASK, Timer_1_CMD_STOP)" befor "Clock_Start()".

Is this correct?

Best regards,

Yocchi

0 Likes

Hi YoIs_1298666​,

The top design whatever you have done is correct since you have given a hardware trigger in your top design a software trigger command in your main.c is not required.

The Clock_Start command which you have used in your main.c is also not required as when the timer starts the clock starts automatically and hence starting the clock is not required.

Regards

Alakananda

Alakananda
0 Likes

Hello Alakananda-san,

I fogot to add the PWM component configuration.

It can run well.

pastedImage_0.png

Now, I select the manual setting to configure Clock start.

pastedImage_1.png

Best regards,

Yocchi

0 Likes

Hi YoIs_1298666​,

According to your reply if we give CLOCK_START before or after the PWM_START it will work.

Regards

Alakananda

Alakananda
0 Likes

Hello Alakananda-san,

Thank you very much.

Best regards,

Yocchi

0 Likes