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.

control with GSM using a phone and pic

Status
Not open for further replies.

ns.electronique

Newbie level 1
Newbie level 1
Joined
Apr 30, 2013
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,309
hello
I am doing my final project study that focuses on the control of a remote PLC with GSM
First I connected the phone to my PIC ds PIC30F4013 with serial communication using UART I realized the code but it did not work
I need your help please it is urgent
that is the code with micro C pro for ds PIC:
[//**** Declaration des variables
char allumer;

void reception_des_appels()
{
UART1_write_text("AT");

UART1_Init(9600); // initialisation du protocol USART avec vitesse d'echange des données de 9600
UART1_write_text("AT+CLIP=1"); // initialiser le module GSM de manière à ce qu'il communique les
UART1_write_text("ATA+2********") ;
}
//***reception du message***
void reception_message()
{
UART1_Init(9600);
Delay_ms(100);

UART1_write_text("AT"); // Envoi de la commande AT
UART1_write(13);
UART1_write(10); // Code ASCII equivalent pour ENTRE
delay_ms(1000);

UART1_write_text("AT+CMGF=1"); // choisir le mode texte en positionnant en 1
UART1_write(13);
UART1_write(10);
delay_ms(1000);

UART1_write_text("AT+CPMS=TA"); // la mémoire choisie est la mémoire de la télephone
UART1_write(13);
UART1_write(10);
delay_ms(1000);

UART1_write_text("AT+CNMI=2,1, 0,0,0"); // extraire touts les message reçus : à vérifier
UART1_write(13);
UART1_write(10);
delay_ms(1000); }

//***lecture du message****

void lecture_message (){
UART1_write_text("AT+CMGR=1"); // la lecture du message de l'enplacement 1
UART1_write(13);
delay_ms(1000);


UART1_write_text("AT+CMGD=1"); // supprimer le message dans l'emplacement 1
UART1_write(13);
delay_ms(1000);
}
///emission message

void Emission_Message (char X){ // X le contenu de notre message
UART1_write_text("AT"); // Envoi de la commande AT
UART1_write(13); // Code ASCII equivalent pour ENTRE
UART1_write(10); // Code ASCII equivalent pour (CTRL+H)
delay_ms(1000);
UART1_write_text("AT+CSMS=0"); // Envoi de la commande "AT+CSMS" pour la selection de service de messagerie
UART1_write(13);
UART1_write(10);
delay_ms(1000);
UART1_write_text("AT+CMGF=1"); // Envoi de la commande "AT+CMGF=1" pour la selection du format du SMS le 1 pour le mode TEXT
UART1_write(13);
UART1_write(10);
delay_ms(1000);
UART1_write_text("AT+CMGS="); // Commande pour l'envoi d'un SMS,en indiquant le numéro du destinataire
UART1_write(34); // code ASCII de (")
UART1_write_text("+21621489141");
UART1_write(34); // code ASCII de (")
UART1_write(13);
UART1_write(10);
delay_ms(1000);
UART1_write_text(X); // le contenu de notre message
UART1_write(13);
UART1_write(10);
delay_ms(1000);
}
//programme principale
void main(){
char R;
UART1_init(9600);
TRISD=0X00;

PORTD.f0=0;
reception_des_appels();
Delay_ms(100);
do {
reception_message();
Delay_ms(100);

lecture_message ();
Delay_ms(100);

if(UART1_Data_Ready())
R=UART1_Read();

if(R== allumer)

PORTD=0X00;
delay_ms(10000);
PORTD=0XFF;
delay_ms(10000);


} while(1);
}][/CODE]
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top