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

keypad program error: expecting declaration

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



Joined: 27 May 2015
Posts: 8

View user's profile Send private message

keypad program error: expecting declaration
PostPosted: Wed May 27, 2015 4:49 am     Reply with quote

I am using mplab ide:
Code:
 
#include<16f877a.H>
#use delay(clock=20000000)
#FUSES NOWDT,HS,NOPUT,PROTECT,NOBROWNOUT,NOLVP
#bit rs=0x06.1 //pin_b1  //RB1
#bit rw=0x06.2   //RB2
#bit en=0x06.3  //RB3
#byte data=0X08
#bit r1=0x07.0
#bit r2=0x07.1
#bit r3=0x07.2
#bit r4=0x07.3
#bit c1=0x07.4
#bit c2=0x07.5
#bit c3=0x07.6

#byte TRISB=0X86
#byte TRISC=0X87
#byte TRISD=0X88

int keypad(void);

void lcd_cmd(char value);
void ldata(char value);
int k,a;
void main()   
{

TRISB=0x00;
TRISC=0xff;
TRISD=0x00;
output_low(rs);        //rs=0            
lcd_cmd(0x38);
lcd_cmd(0x0e);
lcd_cmd(0x01);
lcd_cmd(0x06);
lcd_cmd(0x80);
output_high(rs); // rs=1
{
keypad();
ldata(k);
delay_ms(1);
}
}

int keypad(void)
(
a=0;
do
 {
   r1=1;
   r2=0;
   r3=0;
   r4=0;
   if(c1==1)
   {
       k='1';
       a=1;
   }
   if(c2==1)
   {
       k='2';
       a=1;
   }
   if(c3==1)
   {
       k='3';
       a=1;
   }
   r1=0;
   r2=1;
   r3=0;
   r4=0;
   if(c1==1)
   {
       k='4';
       a=1;
   }
   if(c2==1)
   {
       k='5';
       a=1;
   }
   if(c3==1)
   {
       k='6';
       a=1;
   }

r1=0;
   r2=0;
   r3=1;
   r4=0;
   if(c1==1)
   {
       k='7';
       a=1;
   }
   if(c2==1)
   {
       k='8';
       a=1;
   }
   if(c3==1)
   {
       k='9';
       a=1;
   }
   r1=0;
   r2=0;
   r3=0;
   r4=1;
   if(c1==1)
   {
       k='0';
       a=1;
   }
   if(c2==1)
   {
       k='*';
       a=1;
   }
   if(c3==1)
   {
       k='#';
       a=1;
   }   
}
while(!a);
return(k);

)

void lcd_cmd(char value)
{
data=value;
rs=0;
rw=0;
en=1;
delay_ms(10);
en=0;
return;
}

void ldata(char value)
{
data=value;
rs=1;
rw=0;
en=1;
delay_ms(10);
en=0;
return;
}

error:

Executing: "C:\Program files\Picc\CCSC.exe" +FM "keypad.c" +DF +LN +T +A +M +Z +Y=9 +EA
*** Error 29 "keypad.c" Line 50(1,2): Function definition different from previous definition
*** Error 43 "keypad.c" Line 50(2,3): Expecting a declaration
*** Error 43 "keypad.c" Line 50(3,4): Expecting a declaration
*** Error 43 "keypad.c" Line 50(4,5): Expecting a declaration
*** Error 43 "keypad.c" Line 51(1,3): Expecting a declaration
*** Error 43 "keypad.c" Line 52(2,3): Expecting a declaration
*** Error 48 "keypad.c" Line 53(1,3): Expecting a (
*** Error 43 "keypad.c" Line 53(4,5): Expecting a declaration
*** Error 43 "keypad.c" Line 53(5,6): Expecting a declaration
*** Error 48 "keypad.c" Line 54(1,3): Expecting a (
*** Error 43 "keypad.c" Line 54(4,5): Expecting a declaration
*** Error 43 "keypad.c" Line 54(5,6): Expecting a declaration
*** Error 48 "keypad.c" Line 55(1,3): Expecting a (
*** Error 43 "keypad.c" Line 55(4,5): Expecting a declaration
*** Error 43 "keypad.c" Line 55(5,6): Expecting a declaration
*** Error 48 "keypad.c" Line 56(1,3): Expecting a (
*** Error 43 "keypad.c" Line 56(4,5): Expecting a declaration
*** Error 43 "keypad.c" Line 56(5,6): Expecting a declaration
*** Error 43 "keypad.c" Line 57(1,3): Expecting a declaration
*** Error 43 "keypad.c" Line 57(3,4): Expecting a declaration
*** Error 48 "keypad.c" Line 57(4,6): Expecting a (
*** Error 43 "keypad.c" Line 57(8,9): Expecting a declaration
*** Error 43 "keypad.c" Line 57(9,10): Expecting a declaration
*** Error 43 "keypad.c" Line 58(1,2): Expecting a declaration
*** Error 48 "keypad.c" Line 59(2,3): Expecting a (
*** Error 43 "keypad.c" Line 59(4,7): Expecting a declaration
*** Error 43 "keypad.c" Line 59(7,8): Expecting a declaration
*** Error 48 "keypad.c" Line 60(2,3): Expecting a (
*** Error 43 "keypad.c" Line 60(4,5): Expecting a declaration
*** Error 43 "keypad.c" Line 60(5,6): Expecting a declaration
*** Error 43 "keypad.c" Line 61(1,2): Expecting a declaration
*** Error 43 "keypad.c" Line 62(1,3): Expecting a declaration
*** Error 43 "keypad.c" Line 62(3,4): Expecting a declaration
*** Error 48 "keypad.c" Line 62(4,6): Expecting a (
*** Error 43 "keypad.c" Line 62(8,9): Expecting a declaration
*** Error 43 "keypad.c" Line 62(9,10): Expecting a declaration
*** Error 43 "keypad.c" Line 63(1,2): Expecting a declaration
*** Error 48 "keypad.c" Line 64(2,3): Expecting a (
*** Error 43 "keypad.c" Line 64(4,7): Expecting a declaration
*** Error 43 "keypad.c" Line 64(7,8): Expecting a declaration
*** Error 48 "keypad.c" Line 65(2,3): Expecting a (
*** Error 43 "keypad.c" Line 65(4,5): Expecting a declaration
*** Error 43 "keypad.c" Line 65(5,6): Expecting a declaration
*** Error 43 "keypad.c" Line 66(1,2): Expecting a declaration
*** Error 43 "keypad.c" Line 67(1,3): Expecting a declaration
*** Error 43 "keypad.c" Line 67(3,4): Expecting a declaration
*** Error 48 "keypad.c" Line 67(4,6): Expecting a (
*** Error 43 "keypad.c" Line 67(8,9): Expecting a declaration
*** Error 43 "keypad.c" Line 67(9,10): Expecting a declaration
*** Error 43 "keypad.c" Line 68(1,2): Expecting a declaration
*** Error 48 "keypad.c" Line 69(2,3): Expecting a (
*** Error 43 "keypad.c" Line 69(4,7): Expecting a declaration
*** Error 43 "keypad.c" Line 69(7,8): Expecting a declaration
*** Error 48 "keypad.c" Line 70(2,3): Expecting a (
*** Error 43 "keypad.c" Line 70(4,5): Expecting a declaration
*** Error 43 "keypad.c" Line 70(5,6): Expecting a declaration
*** Error 43 "keypad.c" Line 71(1,2): Expecting a declaration
*** Error 48 "keypad.c" Line 72(1,3): Expecting a (
*** Error 43 "keypad.c" Line 72(4,5): Expecting a declaration
*** Error 43 "keypad.c" Line 72(5,6): Expecting a declaration
*** Error 48 "keypad.c" Line 73(1,3): Expecting a (
*** Error 43 "keypad.c" Line 73(4,5): Expecting a declaration
*** Error 43 "keypad.c" Line 73(5,6): Expecting a declaration
*** Error 48 "keypad.c" Line 74(1,3): Expecting a (
*** Error 43 "keypad.c" Line 74(4,5): Expecting a declaration
*** Error 43 "keypad.c" Line 74(5,6): Expecting a declaration
*** Error 48 "keypad.c" Line 75(1,3): Expecting a (
*** Error 43 "keypad.c" Line 75(4,5): Expecting a declaration
*** Error 43 "keypad.c" Line 75(5,6): Expecting a declaration
*** Error 43 "keypad.c" Line 76(1,3): Expecting a declaration
*** Error 43 "keypad.c" Line 76(3,4): Expecting a declaration
*** Error 48 "keypad.c" Line 76(4,6): Expecting a (
*** Error 43 "keypad.c" Line 76(8,9): Expecting a declaration
*** Error 43 "keypad.c" Line 76(9,10): Expecting a declaration
*** Error 43 "keypad.c" Line 77(1,2): Expecting a declaration
*** Error 48 "keypad.c" Line 78(2,3): Expecting a (
*** Error 43 "keypad.c" Line 78(4,7): Expecting a declaration
*** Error 43 "keypad.c" Line 78(7,8): Expecting a declaration
*** Error 48 "keypad.c" Line 79(2,3): Expecting a (
*** Error 43 "keypad.c" Line 79(4,5): Expecting a declaration
*** Error 43 "keypad.c" Line 79(5,6): Expecting a declaration
*** Error 43 "keypad.c" Line 80(1,2): Expecting a declaration
*** Error 43 "keypad.c" Line 81(1,3): Expecting a declaration
*** Error 43 "keypad.c" Line 81(3,4): Expecting a declaration
*** Error 48 "keypad.c" Line 81(4,6): Expecting a (
*** Error 43 "keypad.c" Line 81(8,9): Expecting a declaration
*** Error 43 "keypad.c" Line 81(9,10): Expecting a declaration
*** Error 43 "keypad.c" Line 82(1,2): Expecting a declaration
*** Error 48 "keypad.c" Line 83(2,3): Expecting a (
*** Error 43 "keypad.c" Line 83(4,7): Expecting a declaration
*** Error 43 "keypad.c" Line 83(7,8): Expecting a declaration
*** Error 48 "keypad.c" Line 84(2,3): Expecting a (
*** Error 43 "keypad.c" Line 84(4,5): Expecting a declaration
*** Error 43 "keypad.c" Line 84(5,6): Expecting a declaration
*** Error 43 "keypad.c" Line 85(1,2): Expecting a declaration
*** Error 43 "keypad.c" Line 86(1,3): Expecting a declaration
*** Error 43 "keypad.c" Line 86(3,4): Expecting a declaration
*** Error 48 "keypad.c" Line 86(4,6): Expecting a (
*** Error 43 "keypad.c" Line 86(8,9): Expecting a declaration
*** Error 43 "keypad.c" Line 86(9,10): Expecting a declaration
100 Errors, 0 Warnings.
Halting build on first failure as requested.
BUILD FAILED
Ttelmah



Joined: 11 Mar 2010
Posts: 19549

View user's profile Send private message

PostPosted: Wed May 27, 2015 6:58 am     Reply with quote

Look carefully at your brackets.

The first line of the keypad code. Is this the right type of bracket?.....
madhura027



Joined: 27 May 2015
Posts: 8

View user's profile Send private message

Thanks
PostPosted: Wed May 27, 2015 11:50 pm     Reply with quote

ya i didnt notice ...thanks for the reply .. Laughing
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