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

function used but not defined

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



Joined: 05 Aug 2014
Posts: 7
Location: Turkey

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

function used but not defined
PostPosted: Tue Aug 05, 2014 7:17 am     Reply with quote

Hi,
I used internal oscillator with PIC18F46K22 but, I have faced this problem (it's delay problem in the lcd.c, it appears when I complied. )

"function used but not defined delay_ms 609 SRC=1356"

problem is about using internal oscillator?



Code:
#include <main.h>
#FUSES INTRC_IO
#include <lcd.c>

int a=0;

#use delay(internal=64MHz)
#INT_TIMER0
void  TIMER0_isr(void)
{
   set_timer0(15536);
   if(a==1)
   output_low(pin_c0);
   output_toggle(pin_c1);
   printf(lcd_putc,"\f ERROR \n PLC CHECK");
}

#INT_EXT
void  EXT_isr(void)
{
if(input(pin_b0)==1)
a=1;
}
Mike Walne



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

View user's profile Send private message

PostPosted: Tue Aug 05, 2014 7:55 am     Reply with quote

What happens if you put this line
Code:
#use delay(internal=64MHz)

ahead of this one?
Code:
#include <lcd.c>

Mike
mvliege



Joined: 05 Aug 2014
Posts: 7
Location: Turkey

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

PostPosted: Tue Aug 05, 2014 8:11 am     Reply with quote

hi mike,
thank you for your reply,
here is you can find picture about this problem. Problem is about in "lcd.c"

thank you so much for your help
BS,

https://yadi.sk/i/ULRIdr74Z7zkJ
https://yadi.sk/i/gLGDV7PyZ82dc
https://yadi.sk/i/lCG3mpypZ82iM
dyeatman



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

View user's profile Send private message

PostPosted: Tue Aug 05, 2014 9:20 am     Reply with quote

He is trying to tell you, SWAP the two lines in your code.
Move #use delay up and move #include <lcd.c> down....

You cannot use the delay_ms() function before the #use delay line.
_________________
Google and Forum Search are some of your best tools!!!!
Mike Walne



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

View user's profile Send private message

PostPosted: Tue Aug 05, 2014 3:14 pm     Reply with quote

This line
Code:
#use delay(internal=64MHz)
tells the compiler how to handle the 'delay_us(xx)' and 'delay_ms(xx)' instructions.

To process this line
Code:
#include <lcd.c>
the compiler needs to know how to deal with one or both of the 'delay_yy(xx)' instructions.
(There are delay_yy(xx) instructions buried within 'lcd.c'.)

The compiler is complaining because you are presenting it with code in the wrong sequence.

Mike
mvliege



Joined: 05 Aug 2014
Posts: 7
Location: Turkey

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

SOLVED!!!
PostPosted: Wed Aug 06, 2014 2:52 am     Reply with quote

Very Happy Very Happy SOLVED!!!
Thank you guys, I found out how to use "delay"
This code solved the problem below,

Code:
#use delay(internal)


thank you,
BS
Mike Walne



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

View user's profile Send private message

PostPosted: Wed Aug 06, 2014 9:45 am     Reply with quote

So, what is your complete code?

Mike
mvliege



Joined: 05 Aug 2014
Posts: 7
Location: Turkey

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

PostPosted: Wed Aug 06, 2014 11:55 pm     Reply with quote

Hi Mike,
these are my full codes:

PS the problem is that Altough I have already mentioned frequency with pwm (495Hz) but when I run the program on the PIC, I could see frequency is 990Hz. Where is the problem?

Code:
#include <main.h>
int1 a=0;
int16 b=0;
float v=0;

#INT_TIMER0
void  TIMER0_isr(void)
{
   set_timer0(3036);
   if(a==1)
   {
   output_low(pin_c0);
   output_high(pin_c1);
   printf(lcd_putc,"\f ERROR");
   }
}

#INT_EXT
void  EXT_isr(void)
{
   if(input(pin_b0)==1)
   a=1;
}

void main()
{
   
   set_tris_c(0xf0);
   lcd_init();
   setup_adc_ports(sAN0);
   setup_adc(ADC_CLOCK_DIV_2);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_4);      //52,4 ms overflow

   enable_interrupts(INT_TIMER0);
   enable_interrupts(INT_EXT);
   enable_interrupts(GLOBAL);

   while(TRUE)
   {
      //TODO: User Code
      if(a==0)
      {
         output_high(pin_c0);
         set_adc_channel(0);
         delay_us(20);
         b=read_adc();
         v=0.0048828125*b;
         printf(lcd_putc,"\f VALUE v:%1.2f",v); 
      }
      delay_ms(500);
      if(input(pin_b0)==0)
      a=0;
     
   }

}


and it is head file:
Code:
#include <18F46K22.h>
#device ADC=10

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES WDT128                   //Watch Dog Timer uses 1:128 Postscale
#FUSES NOBROWNOUT         //No brownout reset
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16)
#FUSES NOXINST  //Extended set extension 
#use delay(internal=8MHz)
#include <lcd.c>
#use pwm(CCP1,TIMER=2,FREQUENCY=495,DUTY=50)

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