sending an SMS using sim900A with PIC16F877a in mikro C pro for pic

Status
Not open for further replies.

Jeffin Jacob Philip

Newbie level 2
Joined
Mar 14, 2015
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
11
is this code correct . . .

its not working

is there anyone to help me....


Code:
//crystal 20Mhz
 void main()
{
TRISD=0;
PORTD=0xff;
Delay_ms(1000);
PORTD=0;

UART1_init(9600);
Delay_ms(10);


UART1_Write_Text("AT\r\n");
Delay_ms(2000);

UART1_Write_Text("AT+CMGF=1\r\n");
 Delay_ms(2000);


UART1_Write_Text("AT+CMGS=\"+919895595189\"\r\n");

Delay_ms(1000);

UART1_Write_Text("OK...Its working");
UART1_Write(0x1A);
Delay_ms(2000);

         Delay_ms(2000);
         PORTD=0xff;
          Delay_ms(1000);
PORTD=0;
         }
 
Last edited by a moderator:

Try this. If it still doesn't work then switch to PIC18F device.


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
void main() {
 
   TRISC = 0x80;
   PORTC = 0x00;
   TRISD = 0x00;
   PORTD = 0x00;
 
   UART1_init(9615);
   Delay_ms(200);
 
   UART1_Write_Text("AT\r\n");
   Delay_ms(1000);
 
   UART1_Write_Text("AT+CMGF=1\r\n");
   Delay_ms(1000);
 
   UART1_Write_Text("AT+CMGS=\"9895595189\"\r\n");
   Delay_ms(3000);
 
   UART1_Write_Text("OK...Its working");
   Delay_ms(500);
   UART1_Write(0x1A);
   
   PORTD = 0xFF;
   Delay_ms(1000);
   PORTD = 0x00;
 
   while(1);
}

 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…