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

pwm for PIC16F1507...PIC16F1507

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



Joined: 23 Oct 2006
Posts: 175

View user's profile Send private message

pwm for PIC16F1507...PIC16F1507
PostPosted: Sun May 06, 2012 5:10 pm     Reply with quote

I tried to create pwm (for PIC16F1507...PIC16F1507 ) and I saw that for these micro-controllers the instruction:
Code:

setup_ccp1(CCP_PWM);
setup_ccp2(CCP_PWM);


is not working. (For other micro-controller this instruction is working). The datasheet for these micro-controller describe that are provided with pwm.

What is going wrong??????
dyeatman



Joined: 06 Sep 2003
Posts: 1938
Location: Norman, OK

View user's profile Send private message

PostPosted: Sun May 06, 2012 5:41 pm     Reply with quote

What version of CCS are you using? What "other microcontroller"?
_________________
Google and Forum Search are some of your best tools!!!!
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Sun May 06, 2012 5:43 pm     Reply with quote

post your CODE that tries to use PWM - all of it

post your compiler version

post your SCHEMATIC that shows how you plan to use the PWM
andys



Joined: 23 Oct 2006
Posts: 175

View user's profile Send private message

PostPosted: Sun May 06, 2012 6:16 pm     Reply with quote

I am at the process to find the pic so my code is just few instructions to check the pic :
Code:

#if defined(__PCM__)
#include <16F1507.h>

//#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)

#elif defined(__PCH__)
//#include <18F2423.h>

#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)

#elif defined(__PCD__)
//#include<30F2010.h>

#fuses HS,NOWDT,NOPROTECT
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)

#endif

void main()
{
 
setup_ccp1(CCP_PWM);
setup_ccp2(CCP_PWM);

}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun May 06, 2012 7:24 pm     Reply with quote

If you believe the compiler has a bug, then always post your compiler
version. A request that you do this is in a "sticky" post by Temtronic
at the top of the forum. Please read this.
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Mon May 07, 2012 7:48 am     Reply with quote

Code:

{
 
setup_ccp1(CCP_PWM);
setup_ccp2(CCP_PWM);


This is an inadequate amount of setup code.

You have not setup a timer to drive pwm or
set a PWM duty cycle VALUE to generate yet.

Your code is very very incomplete.

Do as PCM says
post your compiler version while you are at it.
andys



Joined: 23 Oct 2006
Posts: 175

View user's profile Send private message

PostPosted: Mon May 07, 2012 9:50 am     Reply with quote

i use MPLAB v8.83 , and the compiler PCM v4.133d
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Mon May 07, 2012 10:01 am     Reply with quote

sorry but i can't help with issues around 4.133
as i am unable to make it run on my system - yet

how did you get your copy ??

Very Happy Very Happy
andys



Joined: 23 Oct 2006
Posts: 175

View user's profile Send private message

PostPosted: Mon May 07, 2012 2:46 pm     Reply with quote

I download the free version (for some days)
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon May 07, 2012 4:49 pm     Reply with quote

Quote:
I tried to create pwm (for PIC16F1507...PIC16F1507 ) and I saw that for these micro-controllers the instruction:

setup_ccp1(CCP_PWM);
setup_ccp2(CCP_PWM);

is not working.

What you really mean is that those lines of code give a compiler error.
They don't compile. You get these errors:
Code:
*** Error 12 "16F1507.c" Line 8(11,12): Undefined identifier  -- setup_ccp1
*** Error 12 "16F1507.c" Line 12(14,15): Undefined identifier  -- set_pwm1_duty

I tested this just now with vs. 4.132, and it doesn't have any support for
the PWM module in the 16F1507. The 16F1507.h file doesn't have any
constants for PWM functions.

It's possible to add support by writing your own PWM functions, similar
to the CCS functions. Or, you can write directly to the PWM registers
in your program.
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