PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jun 24, 2008 12:09 pm |
|
|
I stripped your program down somewhat by getting rid of all the printf
statements, and then I compiled it with vs. 4.074 and ran it on a
PicDem2-Plus board. It works. I see PWM output on pin B0.
Code: |
#include <16F88.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
//==========================================
void main()
{
byte value;
value = 0;
setup_ccp1(CCP_PWM);
setup_timer_2(T2_DIV_BY_4, 255, 1);
set_pwm1_duty(0); // PWM off
delay_ms(1000);
while(1)
{
value++;
set_pwm1_duty(value);
delay_ms(100);
}
} |
--------
Edit: Initialized 'value' to 0.
Last edited by PCM programmer on Wed Aug 26, 2009 7:13 pm; edited 1 time in total |
|