Pin
|
Name
|
Description
|
1
|
ATMS
|
Audio to mobile
|
2
|
AFMS/RTS
|
Audio from mobile/RTS (connected to
GND in cable?)
|
3
|
CTS/ONREQ
|
CTS/Mobile Station On
REQuest (connected to GND in cable?)
|
4
|
Data in
|
Data to mobile (Rx)
|
5
|
Data out
|
Data from mobile (Tx)
|
6
|
ACC in
|
Accessory control to mobile. Used as
Rx in some models for flashing.
|
7
|
ACC out
|
Accessory control from
mobile/handsfree sense. Used as Tx in some models for flashing
|
8
|
AGND
|
Audio signal ground + 0V reference
|
9
|
Flash
|
Flash memory voltage + Service
(shorted to pin 11 in service cable)
|
10
|
DGND
|
Digital ground
|
11
|
Vcc
|
DC + for battery charging + External
accessory powering
|
Berikut listing program untuk terima sms dan kemudian mengirim balik statusnya :
#include <mega16.h>
#include <delay.h>
#include <stdio.h>
#include <lcd.h>
#asm
.equ __lcd_port=0x15 ;PORTC
#endasm
unsigned char cek[100];
unsigned int a,i;
void main(void)
{
UCSRA=0x00;
UCSRB=0x18;
UCSRC=0x86;
UBRRH=0x00;
UBRRL=0x47;
lcd_init(16);
while (1)
{
printf("ATE0"); // perintah agar tidak ada echo
putchar(0x0D); // enter
while(getchar()!= 'K'){}; // tunggu sampai menerima K / OK
while(getchar()!=0x0A){}; // tunggu sampai newline / garis baru
reload:
printf("AT+CPMS="); // penempatan memori sms
putchar('"');
printf("ME");
putchar('"');
putchar(0x0D);
while(getchar()!= 'K'){};
while(getchar()!=0x0A){};
printf("AT+CMGF=1");
putchar(0x0D);
while(getchar()!= 'K'){};
while(getchar()!=0x0A){};
printf("AT+CMGL="); // perintah untuk melihat semua isi sms
putchar('"');
printf("all");
putchar('"');
putchar(0x0D);
while(getchar()!=0x0A){};
a=0;
do{
a++;
cek[a]=getchar();
}while(cek[a]!=0x0A); // isi cek[a] dengan no. HP dll selama bukan newline
if(cek[1]=='O') // jika tidak ada sms
{
for(a=0;a<70;a++){cek[a]=' ';} // pengosongan array
delay_ms(50);
goto reload;
}
a=0;
do{
a++;
cek[a]=getchar();
}while(cek[a]!=0x0A); // isi cek[a] dengan isi sms selama bukan newline
if(cek[1]=='R' && cek[2]=='I' && cek[3]=='D' && cek[4]=='L' && cek[5]=='A')
{
printf("AT+CMGD=1"); // perintah hapus sms di index 1
putchar(0x0D);
while(getchar()!='K'){};
while(getchar()!=0x0A){};
printf("AT+CMGD=1");
putchar(0x0D);
while(getchar()!='K'){};
while(getchar()!=0x0A){};
printf("AT+CMGF=1");
putchar(0x0D);
while(getchar()!= 'K'){};
while(getchar()!=0x0A){};
printf("AT+CMGS="); // perintah kirim sms
putchar('"');
printf("08xxxxxxxxxx"); // no HP tujuan
putchar('"');
putchar(0x0D);
while(getchar()!=0x3E){}; // tunggu sampai muncul karakter ">"
delay_ms(5);
printf("AT Command berhasil");
putchar(0x1A); // CTRL + Z
while(getchar()!='K'){};
}
else
{
printf("AT+CMGD=1");
putchar(0x0D);
while(getchar()!='K'){};
while(getchar()!=0x0A){};
printf("AT+CMGD=1");
putchar(0x0D);
while(getchar()!='K'){};
while(getchar()!=0x0A){};
printf("AT+CMGF=1");
putchar(0x0D);
while(getchar()!= 'K'){};
while(getchar()!=0x0A){};
printf("AT+CMGS=");
putchar('"');
printf("08xxxxxxxxxx"); // no hp tujuan
putchar('"');
putchar(0x0D);
while(getchar()!=0x3E){};
delay_ms(10);
printf("Format Pesan Salah");
putchar(0x1A);
while(getchar()!='K'){};
}
delay_ms(50);
};
}
Keterangan : Jika pada alat tidak memakai LCD 16x2, program lcd untuk uji coba jangan dulu dihapus.