- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
how can i do so?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just set the compare value to zero (0). Then the line output will drop to logical "Low".
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just set the compare value to zero (0). Then the line output will drop to logical "Low".
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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