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

Help to fix this Error "undefined identifier"

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



Joined: 11 Mar 2012
Posts: 4

View user's profile Send private message

Help to fix this Error "undefined identifier"
PostPosted: Sun Mar 11, 2012 3:52 pm     Reply with quote

Hello everybody, I want you to help me to fix this problem. I made a program but I don't understand why pic c don't identify these three instructions:
* setup_power_pwm_pins(PWM_COMPLEMENTARY, PWM_COMPLEMENTARY, PWM_OFF, PWM_OFF);
* set_power_pwm0_duty();
* setup_power_pwm(PWM_FREE_RUN|PWM_DEAD_CLOCK_DIV_2, 1, 0, POWER_PWM_PERIOD, 0, 1,4);
Are there related to some library.....? give me a solution please.
temtronic



Joined: 01 Jul 2010
Posts: 9215
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Mar 11, 2012 4:02 pm     Reply with quote

Which PIC are you trying to use?

Which version of the compiler ??

Do BOTH the PIC and compiler have those functions ??
gpsmikey



Joined: 16 Nov 2010
Posts: 588
Location: Kirkland, WA

View user's profile Send private message

PostPosted: Sun Mar 11, 2012 4:03 pm     Reply with quote

Since you don't provide a lot of helpful information, we are shooting in the dark, but did you include the correct header file for your processor of choice?
_________________
mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

Follow the CCS forum guide
PostPosted: Mon Mar 12, 2012 2:46 am     Reply with quote

Post a SHORT, but complete, compilable code which shows the problem.

In other words, reduce your code to as FEW lines as possible, but still giving the errors. We don't want to wade through mountains of code.

Probability is someone here will help you.

Include your PIC and version No.

Mike
nirvan



Joined: 11 Mar 2012
Posts: 4

View user's profile Send private message

PostPosted: Mon Mar 12, 2012 1:10 pm     Reply with quote

temtronic wrote:
Which PIC are you trying to use?

Which version of the compiler ??

Do BOTH the PIC and compiler have those functions ??


Hello, I am using pic 16f877a
and for the compiler I am using pic c 4.084.
I don't know for the pic but I am sure that these instructions are functional in the compiler. I find them in the manual of pic c
nirvan



Joined: 11 Mar 2012
Posts: 4

View user's profile Send private message

PostPosted: Mon Mar 12, 2012 1:18 pm     Reply with quote

gpsmikey wrote:
Since you don't provide a lot of helpful information, we are shooting in the dark, but did you include the correct header file for your processor of choice?

Code:

#include "D:\PFA\PICC\sine2.h"

#int_TIMER1
void  TIMER1_isr(void)
{

}

#int_TIMER2
void  TIMER2_isr(void)
{

}

#define POWER_PWM_PERIOD 999

long const duty[100] =
{120,240,360,519,639,759,879,999,1118,1238,
1359,1479,1598,1718,1798,1918,2038,2158,2238,2358,
2438,2557,2637,2717,2837,2917,2997,3077,3157,3237,
3317,3357,3437,3516,3556,3596,3676,3716,3756,3796,
3836,3876,3916,3916,3916,3916,3916,3916,3916,3916,
3916,3916,3916,3916,3916,3916,3916,3876,3836,3796,
3756,3716,3676,3596,3556,3516,3437,3357,3317,3237,
3157,3077,2997,2917,2837,2717,2637,2557,2438,2358,
2238,2158,2038,1918,1798,1718,1598,1479,1359,1239,
1119,999,879,759,639,519,360,240,120,120
};
 
long i,d0,d1,d2,j,k;

void duty_int()
{   
if(i>99)
{ d1 = 120;
  i =0; }
 else
 {d1 = duty[i];
  i++;
  d0 = 120;} 
 else
 {d0 = duty[i];
   i++;
   d1 = 120;   
   j = 0; }
set_power_pwm0_duty(d0);
set_power_pwm2_duty(d1);
}

float v;
int d3 = 50;

void main()
{
   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);
   setup_spi(SPI_SS_DISABLED);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_INTERNAL|T1_DIV_BY_1);
   setup_timer_2(T2_DIV_BY_1,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);

   enable_interrupts(INT_RTCC);
   enable_interrupts(INT_TIMER1);
   enable_interrupts(INT_TIMER2);
   enable_interrupts(INT_TIMER0);
   enable_interrupts(GLOBAL);   

   i=0;
   j=100;
   k=132;
d0 = 120;
d1 = 120; 

setup_power_pwm_pins(PWM_COMPLEMENTARY, PWM_COMPLEMENTARY, PWM_OFF, PWM_OFF);
setup_power_pwm(PWM_FREE_RUN|PWM_DEAD_CLOCK_DIV_2, 1, 0, POWER_PWM_PERIOD, 0, 1,4); 

ENABLE_INTERRUPTS(GLOBAL);
ENABLE_INTERRUPTS(INT_timer0);

    while(1){ }
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Mar 12, 2012 1:42 pm     Reply with quote

Do a Google search for the following string, and you will see some PICs
that have the Power Control PWM module:
Quote:

site:microchip.com "power control pwm" type:pdf


The 16F877A does not have it.
dyeatman



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

View user's profile Send private message

PostPosted: Mon Mar 12, 2012 1:48 pm     Reply with quote

I don't believe Power PWM is available on PIC16F chips.

Whoops, a little later than PCM on this one...
_________________
Google and Forum Search are some of your best tools!!!!
nirvan



Joined: 11 Mar 2012
Posts: 4

View user's profile Send private message

thank
PostPosted: Mon Mar 12, 2012 2:35 pm     Reply with quote

thank you guys Smile
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