junhao_wu
Newbie level 3
Hi Guys! I have just programed my PWM code into PIC16F873A...was wondering if I just connect +5V to VDD, Ground my Vss, I should expect a square wave(PWM) at CCP1 pin?? or do i have to connect some circuity?
below is my C code.
#pragma chip PIC16F873A
#include "math24f.h"
void int_pwm(void)
{
int duty;
CCP1CON = 0;
TMR2 = 0;
TRISC.2 = 0;
PORTC.2 = 0;
PIE1.1 = 0;
PIE1.2 = 0;
PR2 = bin(00111110);
CCP1CON.5 = 0;
CCP1CON.4 = 0;
duty = bin(00011111);
CCPR1L = bin(00011111);
T2CON = bin(00000000);
CCP1CON = bin(00001100);
}
void main(void)
{
int_pwm();
T2CON.2 = 1;
while(1);
}
Pls kindly advise.... thank for inputs
below is my C code.
#pragma chip PIC16F873A
#include "math24f.h"
void int_pwm(void)
{
int duty;
CCP1CON = 0;
TMR2 = 0;
TRISC.2 = 0;
PORTC.2 = 0;
PIE1.1 = 0;
PIE1.2 = 0;
PR2 = bin(00111110);
CCP1CON.5 = 0;
CCP1CON.4 = 0;
duty = bin(00011111);
CCPR1L = bin(00011111);
T2CON = bin(00000000);
CCP1CON = bin(00001100);
}
void main(void)
{
int_pwm();
T2CON.2 = 1;
while(1);
}
Pls kindly advise.... thank for inputs