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.

[AVR] Sim900 and ATMEGA8 Syntax error, unexpected REGDEF

Status
Not open for further replies.

abdi110

Member level 3
Joined
Mar 5, 2015
Messages
60
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,728
Hi,i am using ATmega8 for a project to send and receive sms by sim900.
i use codevision and RX interrupt to get the input characters using getchar function.
Code:
char getchar(void)
 {
char data;
while (rx_counter==0)  [COLOR="#FF0000"]wait_loop();[/COLOR]
data=rx_buffer[rx_rd_index++];
#if RX_BUFFER_SIZE != 256
if (rx_rd_index == RX_BUFFER_SIZE) rx_rd_index=0;
#endif
#asm("cli")
--rx_counter;
#asm("sei")
return data;
}
.
.
.
 void wait_loop() { 
  
       
       
          
                 
        if(PINB.1==0){ 
       
        if(PINB.0==0){                 
       
       delay_ms(60000);
       
        if(PINB.1==0){ 
                                      
        if(PINB.0==0){               
                       E1=1; 
                                               
                        if(a1<3) { 
                            a1++;  
                           
                            PORTC.3=0;
                            send(e1);                           
                            delay_ms(100);                            
                            PORTC.4=0;
                            delay_ms(2000);
                            PORTC.3=1;
                            PORTC.4=1; 
                            delay_ms(20000);  
                              
                                    };
                        };
                        };
                        };  
                        }
        else           {
                        if(E1==1)   {  
                            
                            E1=0;
                            a1=0;
                            send(e1ok); 
                            PORTC.3=0;
                            delay_ms(2000);
                            PORTC.3=1;            
                            delay_ms(20000);
                                    };

                        };  
        
                        }
after building the project i receive this error:Syntax error, unexpected REGDEF
in wait loop i do my normal program in order that microcontroller do its functions normally.
Could anyone please help why am i getting this error and how can i solve this problem?
 
Last edited by a moderator:

You didn't tell for which source line the error message is issued. Why did you mark the wait_loop() call red? There will be hardly a REGDEF error related to the call. But a forward declaration is needed.
 

My problem has been sloved by changing the name of the variable that the error was referred to.
It is strange because the same code was working in one of my other programs and I just copied it from that program.any way thanks for your reply.
 

My problem has been sloved by changing the name of the variable that the error was referred to.
Unfortunately the error message has been never reported and the variable not mentioned in your initial post.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top