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 support@ccsinfo.com

PIC16F873 Problem with CCP1 output

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



Joined: 18 Jan 2006
Posts: 43

View user's profile Send private message

PIC16F873 Problem with CCP1 output
PostPosted: Wed Oct 17, 2007 9:23 am     Reply with quote

I'm trying to set up the CCP1 output for PWM using timer 2. Everything is fine except the output "looks" like it's capacitively coupled and the Vpp is very low. I'm assuming it's a setup problem but I can't figure it out. Any help would be appreciated.

The code is:

setup_timer_2(T2_DIV_BY_4, 255, 1);
setup_ccp2(CCP_PWM);
set_pwm2_duty(0x0300);
Ttelmah
Guest







PostPosted: Wed Oct 17, 2007 9:29 am     Reply with quote

The configuration won't affect the resulting waveform (except to change the frequency, and mark space ratio). You have a hardware problem. What is attached to the pin?. Double check the resistances of the connections. Are you sure the scope's ground is connected to the Vss on the PIC directly?.

Best Wishes
DonWare



Joined: 18 Jan 2006
Posts: 43

View user's profile Send private message

PostPosted: Wed Oct 17, 2007 9:35 am     Reply with quote

The scope is the only thing connected. I checked the probe, it's DC coupled and shows VCC properley. The ground is right at the PIC. I also tried another probe.

What if I write to TRISC directly for that port ?
DonWare



Joined: 18 Jan 2006
Posts: 43

View user's profile Send private message

PostPosted: Wed Oct 17, 2007 9:44 am     Reply with quote

I tried writing to TRISC and the signal went away.

The output is not looking at a short. I touched the scope lead and the signal went wild as if it were an antenna. It really seems that the output is not configured properly.

I'll look for a new IC.
DonWare



Joined: 18 Jan 2006
Posts: 43

View user's profile Send private message

Solved
PostPosted: Wed Oct 17, 2007 10:44 am     Reply with quote

What I did wrong was use setup_ccp2 and set_pwm2 instead of 1.

I let timer '2' confuse me. Dumb eh ?
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