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

1MHz pwm signal

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



Joined: 12 Jan 2005
Posts: 4

View user's profile Send private message

1MHz pwm signal
PostPosted: Wed Jan 12, 2005 7:31 am     Reply with quote



Hi,

I'm trying to have a 1MHz pwm signal which has a 1/4 duty cycle.
All my effort doesn't work and unfortunatelly I couldn't obtain a signal in this form. Changing duty cycle is not problem, difficulty is obtain a signal which has 1MHz frequency from CCP1 out of controller.
Is it too high?

Highest frequency I could obtain is 6.66 KHz.(T=150 usec). Very far from 1MHz!!! At this situation parameters are as following code.

Is anyone know the way that how can I get this pwm signal?

I'm using PIC18F242 or PIC18F252 and 4MHz external oscillator.

#include "18F242.h"
#fuses XT,NOWDT,NOPROTECT,NOLVP
#use delay(clock=4000000)

init(){
set_tris_c(0x00);
setup_ccp1(CCP_PWM);
set_pwm1_duty((unsigned int16)(0..to..2^16));
setup_timer_2(4, 150, 1);
enable_interrupts(INT_TIMER2);
enable_interrupts(GLOBAL);
}

main(){
init();
while(1);
}
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Wed Jan 12, 2005 7:59 am     Reply with quote

Not going to happen. Read the section in the data sheet on PWM's. The PR2 value would have to be 0 just to get a 1MHz signal out. You need to run faster.
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