CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

unable to generate pwm using pic16f877a with pcm v4.024

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ahmad



Joined: 09 Mar 2007
Posts: 6

View user's profile Send private message

unable to generate pwm using pic16f877a with pcm v4.024
PostPosted: Fri Mar 09, 2007 3:31 pm     Reply with quote

I write the following program to generate pwm and there is no output 0n rc2/ccp1 pin . what i have to do.

#include <16F877A.h>
#fuses HS
#fuses NOWDT
#fuses NOPROTECT
#fuses NOLVP
#fuses NODEBUG
#fuses NOPUT
#fuses NOBROWNOUT
#use delay(clock=20000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
#use fast_io(A)
#use fast_io(B)
#use fast_io(C)
#use fast_io(D)
#pragma zero_ram
#define motora PIN_B7
void main(void)
{

set_tris_c(0b00000000);

setup_timer_2(T2_DIV_BY_16,255,1);
setup_ccp1(CCP_PWM);
set_pwm1_duty(512L);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
while(1);
// TODO: USER CODE!!
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Mar 09, 2007 3:46 pm     Reply with quote

It works for me. I compiled your code with PCM vs. 4.024 and
programmed into a 16F877A with a 20 MHz crystal, on a PicDem2-Plus
board. I see a squarewave output signal on pin 17 of the 40-pin DIP
package. The frequency is 1.22 KHz. The duty cycle is 50%.
Ttelmah
Guest







PostPosted: Sat Mar 10, 2007 3:03 am     Reply with quote

I suggest he looks at the reply I already gave on the other thread where he asked the same question...

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group