We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I am interfacing GSM module with ARM LPC 2148 , when i compiled code in KEIL 4 i am getting these errors please help me . #define CR 0x0D #include <LPC214X.H> #include <stdio.h> void getstring(unsigned char *); int getchar (void) /* Read character from Serial Port */ void status_ok(void); void Serial_Init(void); void delay(unsigned int n); void main(void) { unsigned int cnt=0x80,m; char xx; Serial_Init(); elay(50); while(1) { printf("AT\r"); // AT COMMAND FOR INITIALING status_ok(); printf("AT+IPR=9600\r"); // AT COMMAND FOR BAUD RATE status_ok(); printf("AT+CMGR=2\r"); // Reading the message detail // at Index 1 with phone number, data and time status_ok(); delay(250); printf("ATD9790550124;\r");//AT COMMAND FOR CALL DIALING delay(250); status_ok(); delay(500); delay(500); delay(500); delay(500); delay(500); delay(500); printf("ATH\r"); // AT COMMAND FOR CALL DISCONNECTING delay(250); status_ok(); delay(500); printf("ATDL\r"); // AT COMMAND FOR REDIALING delay(250); status_ok(); delay(500); delay(500); delay(500); printf("ATH\r"); // AT COMMAND FOR ANSWERING THE CALL delay(250); status_ok(); delay(500); delay(500); } }
void getstring(unsigned char *array) { unsigned char temp=0, i=0; do { temp = getchar(); *array++ = temp; } while((temp != '\r') && (temp != '\n')); *array = '\0'; int getchar (void) /* Read character from Serial Port */ { while (!(U0LSR & 0x01)); return (U0RBR); } } void status_ok(void) { getstring(y); while(!(strstr(y,"OK"))) getstring(y); pointr = strstr(y,"OK"); lcd_cmd(0xc0); lcd_data(*pointr++); lcd_data(*pointr); delay(500); lcd_cmd(0x01); } void Serial_Init(void) { PINSEL0 |= 0X00000005; //Enable Txd0 and Rxd0 U0LCR = 0x00000083; //8-bit data, no parity, 1-stop bit U0DLL = 0x00000061; //for Baud rate=9600,DLL=82 U0LCR = 0x00000003; //DLAB = 0; } void delay(unsigned int n) { unsigned int i,j; for(i=0;i<n;i++) { for(j=0;j<12000;j++) {;} } }
compiling gsm.c... gsm.c(5): error: #55: too many arguments in macro invocation gsm.c(5): error: #79: expected a type specifier gsm.c(5): error: #141-D: unnamed prototyped parameters not allowed when body is present gsm.c(6): error: #130: expected a "{" gsm.c(10): warning: #12-D: parsing restarts here after previous syntax error gsm.c(13): warning: #223-D: function "Serial_Init" declared implicitly gsm.c(14): warning: #223-D: function "elay" declared implicitly gsm.c(20): warning: #223-D: function "delay" declared implicitly gsm.c(22): warning: #223-D: function "status_ok" declared implicitly gsm.c(11): warning: #177-D: variable "cnt" was declared but never referenced gsm.c(11): warning: #177-D: variable "m" was declared but never referenced gsm.c(12): warning: #177-D: variable "xx" was declared but never referenced gsm.c(57): error: #268: declaration may not appear after executable statement in block gsm.c(49): warning: #177-D: variable "i" was declared but never referenced gsm.c(57): error: #67: expected a "}" gsm.c(57): error: #55: too many arguments in macro invocation gsm.c(57): error: #79: expected a type specifier gsm.c(57): error: #247: function "getc" has already been defined gsm.c(57): error: #141-D: unnamed prototyped parameters not allowed when body is present gsm.c(62): error: #169: expected a declaration gsm.c(89): warning: #1-D: last line of file ends without a newline gsm.c(89): warning: At end of source: #12-D: parsing restarts here after previous syntax error gsm.c - 11 Error(s), 11 Warning(s).