ahmet2004
Member level 3
Hi, I'm trying to get the PWM of my PIC16F690 working. Unfortunately, no matter what I do, I can't seem to make the thing output what I want. Ideally, I want to have the CCP1 pin always output a constant 40Khz square wave, 50% duty cycle. However, I always get a constant voltage out for some reason. I've been looking at the provided examples from CCS and I've been poking aroun this forum too, but nothing seems to work. Can someone have a quick look at my code and tell me what I'm doing wrong? The compiler version is 3.243 btw.
Thanks for any help!
#include <16F690.h>
#use delay(clock=4000000)
void main(){
set_tris_a(0x00);
set_tris_b(0x00);
set_tris_c(0x00);
setup_ccp1(CCP_PWM);
setup_timer_2(T2_DIV_BY_1, 24, 1);
set_pwm1_duty(20);
}
Thanks for any help!
#include <16F690.h>
#use delay(clock=4000000)
void main(){
set_tris_a(0x00);
set_tris_b(0x00);
set_tris_c(0x00);
setup_ccp1(CCP_PWM);
setup_timer_2(T2_DIV_BY_1, 24, 1);
set_pwm1_duty(20);
}