Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //-------------------------------------------------------------------------
- void sms_mode(void)
- {
- while(1)
- {
- printf("AT+CMGF=1");
- putchar(0x0D); // CR
- while(getchar()!= 'K'){};
- while(getchar()!=0x0A){};
- printf("AT+CMGL=");
- putchar('"');
- printf("REC UNREAD");
- putchar('"');
- putchar(0x0D);
- while(getchar()!=0x0A){};
- while(getchar()!=0x0A){};
- a=0;
- do{
- a++;
- cek[a]=getchar();
- }while(cek[a]!=0x0A);
- i=1;
- lcd_gotoxy(0,1);
- while(i<33)
- {
- if(cek[i]==13) break;
- lcd_putchar(cek[i++]);
- //delay_ms(100);
- }
- if(cek[1]=='S' || cek[1]=='s' || cek[1]=='?'){
- sms_status();
- }
- if(cek[1]=='1')
- {
- PORTC.5=1;
- lcd_gotoxy(0,1);
- lcd_puts("Lp1 on ");
- }
- if(cek[1]=='0')
- {
- PORTC.5=0;
- lcd_gotoxy(0,1);
- lcd_puts("Lp1 off");
- }
- if(cek[2]=='1')
- {
- PORTC.7=1;
- lcd_gotoxy(8,1);
- lcd_puts("Lp2 on ");
- }
- if(cek[2]=='0')
- {
- PORTC.7=0;
- lcd_gotoxy(8,1);
- lcd_puts("Lp2 off");
- }
- sms_not();
- delay_ms(1000);
- if(getchar()=='R'&&getchar()=='I')
- { lcd_clear();
- lcd_puts("Incomming call");
- delay_ms(100);
- //mode='R';
- PORTC.5=0;
- PORTC.7=0;
- xdata='-';
- sms_send("Lampu 1 off 2 off");
- delay_ms(2000);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment