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

16F1826 how to setup PWM

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



Joined: 11 Dec 2011
Posts: 11
Location: Thailand

View user's profile Send private message

16F1826 how to setup PWM
PostPosted: Wed Jan 04, 2012 9:47 am     Reply with quote

CCS V.4.107 PIC16F1826 Undefined identifier -- setup_ccpx I need use PWM. how to setup PWM
Code:
include <16F1826.H>
#fuses  INTRC_IO,NOLVP,NOWDT,NOPROTECT,MCLR
#use delay(clock=32M)

#byte CCPR3L = 0x311
#byte CCPR4L = 0x318
#byte CCP3CON = 0x313
#byte CCP4CON = 0x31A

int8 i;
int16 cnt;               
#define delay_ms(x)            \
cnt = x;                       \
   while(cnt)                  \
       {                       \
       for(i=0; i<8; i++)      \
          {                    \
           delay_cycles(250);  \
           delay_cycles(250);  \
           delay_cycles(250);  \
           delay_cycles(250);  \
          }                    \
       cnt--;                  \
      }                   

//========================================

void main()
{
   
   setup_ccp3(CCP_PWM);               //compiler Undefined identifier
   setup_ccp4(CCP_PWM);               //compiler Undefined identifier
   setup_timer_2(T2_DIV_BY_16,255,1);
 
  while(TRUE)
   {
     .
     .
     .
   }

}
Ttelmah



Joined: 11 Mar 2010
Posts: 19255

View user's profile Send private message

PostPosted: Wed Jan 04, 2012 10:01 am     Reply with quote

Look at the data sheet.
Table 24-1
What does it say about CCP3, and CCP4?.

Best Wishes
Noland



Joined: 11 Dec 2011
Posts: 11
Location: Thailand

View user's profile Send private message

PostPosted: Wed Jan 04, 2012 10:57 am     Reply with quote

Crying or Very sad Crying or Very sad 16f1826 have CCP1 only
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