Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PWM setup for PIC16F873A

Status
Not open for further replies.

junhao_wu

Newbie level 3
Joined
Oct 15, 2006
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,314
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
 

hi.
please give me more details to help you better.
 

Hi m.salehi, thanks for helping... I am trying to program a PWM with a period of frequency 16.7KHz, 50% duty cycle, portc CCP1 as output, prescaler of 1:1. Crystal is 4MHz. I have already program the code into the PIC16F873A. Now I wish to test out my PWM output. So what is the setup step??

1) Connect +5V to VDD
2) Connect Vss to ground
3) Using scope to see my PWM waveform with CCP1 pin.

Is that all i need to do see my PWM waveform??

Thanks
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top