Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[Moved] its not compiling (mikro c).......

Status
Not open for further replies.

vinodhembedded

Junior Member level 2
Joined
Jul 29, 2013
Messages
22
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
147
hi,
I know i can use delay_ms inside main() but guys help me to call the function delay().


Code:
#include<built_in.h>
void delay();
void main()
{
TRISB=0;
PORTB=0;
while(1)
{
PORTB=~PORTB;
delay();
}}
delay()
{
Delay_ms(1000);  //wait for 1 sec
}

ERROR i m getting is,

1) result is not defined function:dealy
2) Routine delay signature do not match routine call signature


thanks
 

Re: its not compiling (mikro c).......

delay_ms() is a built-in mikroC function and can be used without further prerequisites. delay() isn't there until you write it yourself.

If you are porting code written for a different compiler, you have to check the availibility of each library function and probably find a replacement.
 
  • Like
Reactions: tpetar

    tpetar

    Points: 2
    Helpful Answer Positive Rating
Re: its not compiling (mikro c).......

hi,

now i m nt using the function anme delay, i m using func()..
still not working ...:-(
Code:
#include<built_in.h>
void func();
void main()
{
TRISB=0;
PORTB=0;
while(1)
{
PORTB=~PORTB;
func();
}}
func()
{
Delay_ms(1000);  //wait for 1 sec
}
 

Re: its not compiling (mikro c).......

You should probably start to learn a bit about C programming...

What is func()? Where is it defined?
 
  • Like
Reactions: tpetar

    tpetar

    Points: 2
    Helpful Answer Positive Rating
Re: its not compiling (mikro c).......

hi,

sorry i couldnt get you..

can u write a simple program using function like i did... or else please edit my program and post ..

thanks
 

Re: its not compiling (mikro c).......

Do you know what is a function prototype and a function definition? You have not written function definition for delay(). You have just written function prototype and called the function.
 

Re: its not compiling (mikro c).......

hi guys,

THanks for those replies. i accept that i did some mistake.. but why don't you guys correct me showing a program as example..
please do edit my program and show me where i should have defined the function..

regards,
 

Re: its not compiling (mikro c).......

What does your definitionless delay() and func() do? Do you want the uC to control a nuclear weapon if you just write control_nuclear_weapon()?

Function have to be defined outside main(). Fuction definition contains the code that that function has to do.
 
  • Like
Reactions: FvM

    FvM

    Points: 2
    Helpful Answer Positive Rating
Re: its not compiling (mikro c).......

hi jayanth.devarayanadurga,

is this function definition?? func() has to wait for a second.. that is what func() assigned to do..
i have googled about this also.. i think i have to cut and paste this func() above main().. correct me if i wrong..

Code:
func()
{
Delay_ms(1000);  //wait for 1 sec
}
 

Should be
Code:
void func(void)
{
  Delay_ms(1000);  //wait for 1 sec
}
 
Re: its not compiling (mikro c).......

You cant see mikroC library functions definitions. Delay_ms(1000); will generate 1 sec delay. You only have to call Delay_ms(1000);


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
void main()
{
    TRISB=0;
    PORTB=0;
 
    while(1)
    {
        PORTB=~PORTB;
        Delay_ms(1000);
    }
}

 
Hi guys ,

Thanks to all..
fianlly it got compiled.. I have just copied and pasted the function func() above to void main()...
simple.
Code:
#include<built_in.h>
func()
{
Delay_ms(1000);  //wait for 1 sec
}
void main()
{
TRISB=0;
PORTB=0;
while(1)
{
PORTB=~PORTB;
func();
}}

Regards Vinodh
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top