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

Why am I getting function definition different from previous

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



Joined: 25 Aug 2005
Posts: 16

View user's profile Send private message

Why am I getting function definition different from previous
PostPosted: Thu Aug 25, 2005 10:50 pm     Reply with quote

Why am I getting error(29): function definition different from previous definition wait_dly Param#3


#include <16f877a.h>


#DEFINE FIRST_VAL 100
#DEFINE SECOND_VAL 200

/************************************************/

#FUSES HS, NOWDT, NOPROTECT, PUT

/************************************************/


void wait_dly ( wait_val, wait_cnt)

unsigned long int wait_cnt,wait_val;
unsigned long int i, delay = 0;

{
set_timer1(0);

for(i=0; i = wait_val*2 ; i++)

{
while (delay < wait_cnt)
delay = get_timer1();

set_timer1(0);
}

}

/************************* MAIN ***********************/
void main()
{
while(1)
{
wait_dly(CHANGE_VAL,CHANGE_VAL);

}
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Aug 25, 2005 11:35 pm     Reply with quote

You're using the original K&R style of function declarations from the
1978 edition of their book. You need to do it the modern way, like this:
Code:

void wait_dly(unsigned long int wait_val, unsigned long int wait_cnt)
{
unsigned long int i, delay = 0;

set_timer1(0);

// etc.

}
pic_user



Joined: 25 Aug 2005
Posts: 16

View user's profile Send private message

Thanks for the help
PostPosted: Fri Aug 26, 2005 6:20 pm     Reply with quote

Thanks for the help. As it turns out I had experimented and did what you suggest. I thought the way I did it was still valid C. It is true that I am using old books as I try to come up to C.
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