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.

couldn't get the output for the following code

Status
Not open for further replies.

ilapuppu

Newbie level 4
Joined
Jan 30, 2015
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
76

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
#define CR     0x0D
#include <intrinsics.h>
#include <iolpc2148.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);
unsigned char y[];
 
void main(void)
 
{
 
   unsigned int cnt=0x80,m;
 
   char xx;
 
   Serial_Init();
 
   delay(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);
 
      delay(500);
 
      printf("ATDL\r"); // AT COMMAND FOR REDIALING
 
      delay(250);
 
      status_ok();
 
      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);
 
       const char *pointr = const char *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++)
 
      {;}
 
   }
}



while compiling the above program we got the error in this line " const char *pointr = const char *strstr( y,"OK");"as expected an expression.....
please let me know what expression is expecting....

please reply us as soon as possible
 
Last edited by a moderator:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top