PWM line output set to constant low

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

cross mob
D_Sd_3235936
Level 4
Level 4
25 sign-ins 50 questions asked 25 replies posted

hi,

I need to set the line output of the PWM to constant low through the code.

And then start PWM back again when necessary.

image:

pastedImage_0.png

how can i do so?

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Just set the compare value to zero (0). Then the line output will drop to logical "Low".

Bob

View solution in original post

2 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Just set the compare value to zero (0). Then the line output will drop to logical "Low".

Bob

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,

Although Bob-san has already provided correct answer,

let me add some supererogatory comment 😉

In your case writing compare value to zero(0) means calling

PWM_BUZZ_WriteCompare(0) ;

So I hacked something like,

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

#include "project.h"

void BUZZ_On(void)

{

    PWM_BUZZ_WriteCompare(32767) ; /* duty 50% for 65535 */

}

void BUZZ_Off(void)

{

    PWM_BUZZ_WriteCompare(0) ; /* line is constant 0 */

}

int main(void)

{

    CyGlobalIntEnable; /* Enable global interrupts. */

    PWM_BUZZ_Start() ;

    for(;;)

    {

        BUZZ_On() ;

        CyDelay(1000) ;

        BUZZ_Off() ;

        CyDelay(1000) ;

    }

}

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

Being an old guy, I can not hear 5MHz sound,

so I connected the BUZZER pin to LED_GREEN

and when LED_GREEN is full bright, the PWM value is logically 0,

and when LED_GREEN is half bright, the PWM value is 32767 which

makes the duty 50%.

Attached is my trial with CY8CKIT-044.

moto