Discussion in "Project Addition or Changes" started by    Ramweit    Jul 8, 2017.
Sat Jul 08 2017, 02:12 PM
#1
#include<reg51.h>
#include<stdio.h>
bit moreover,data_bit,sucess,pin,bok,bok1,gprs,gprs9,uma1,flag;
char dat1;
sbit f3locking=P2^7;
sbit f3locking1=P3^4;
sbit WaitFor = P1^4;
unsigned char dataword[48],APN[12],content[22];
unsigned char addresstemp;
unsigned char Pagetemp;

int Page,Number,Number2;
char status;
sfr T2CON=0xc8;
sfr RCAP2H=0xcb;
sfr RCAP2L=0xca;



void hari();
void LoadMessage();
void incrementD();
void GetData11();
void MessageToMob();
void tx0(unsigned char x)
;
#define attempts 3

#include "EepromDriver.c"
#include "RxDTxD.c"
#include "Initialization.c"
#include "summary.c"
#include "gprsdata.c"


main()
{
StartingDelay();
pin=ramdata;
moreover=0;
SCON=0x53;
T2CON=0x34;
RCAP2H=0xff; //ffec
RCAP2L=0xD9;


// RCAP2H=0xff; //ffec
// RCAP2L=0xB2;
moreover=0;

for(Number=1;Number<=32;Number++){WriteDataTo1024(206,Number,0x20); }
ReadDataFrom1024(205,10);
Number2=dat1;
if(Number2>=250 ||Number2<=219){Number2=220;WriteDataTo1024(205,10,220);}
Initiate();
gprs=0;
status=1;
moreover=0;
status=1;
WriteDataTo1024(202,2,0x01);
WriteDataTo1024(202,1,0x01);
WriteDataTo1024(206,1,'0');
WriteDataTo1024(205,1,1);
//ReadDataFrom1024(202,0xab);if(dat1=='1'){Initialise();}


WriteDataTo1024(206,50,'1');
while(1)
{
if(f3locking==0)
{
ModemStatus();
SimInserted();
CheckSignal();
SystemTemp();

incrementD();
moreover=0;
ReadDataFrom1024(245,90);
if(flag==0){
if(dat1=='/'){MessageToMob();}
tx0(0x1A);
flag=1;
}

bok=0;bok1=0;
moreover=0;
ReadDataFrom1024(202,0xab);
if(dat1=='1'){GPRSSend();}

moreover=0;
ReadDataFrom1024(202,0xae);
if(dat1=='1'){SendPC();}

moreover=0;
ReadDataFrom1024(202,0xa1);
if(dat1=='1'){SendGSM();}

moreover=0;
ReadDataFrom1024(202,0xa6);
if(dat1=='1'){LoadMessage();}
StartingDelay();
}
}
}

void tx0(unsigned char x) //send data to serial port 0
{
EA=0;
SBUF=x;
while(TI==0);
TI=0;
EA=1;
}

void LoadMessage()
{
SendReport();
}

void incrementD()
{
moreover=0;
for(Page=1;Page<=100;Page++)
{
Number=1;
ReadDataFrom1024(Page,Number);
if(dat1=='/'){goto outincd;}
Number=125;
ReadDataFrom1024(Page,125);
if(dat1=='/'){goto outincd;}
}
Page=1;Number=1;
WriteDataTo1024(202,221,0x20);
outincd:
moreover=0;
WriteDataTo1024(202,2,Number);
WriteDataTo1024(202,1,Page);
WriteDataTo1024(202,221,'1');
}


void MessageToMob()
{
int i;
char j=2;
ReadDataFrom1024(245,1);
if(dat1!=0x20)
{
printf("AT+CMGS=");putchar('"');printf("+91");
do{gprs=0;}while(f3locking==1);
do{
ReadDataFrom1024(245,j);
if(j>0x0f){goto mout1;}
if(dat1!='*'){putchar(dat1);}
j++;
}while(dat1!='*');
mout1:;
putchar('"');
Enter();
do{
while(RI==0){}
ACC=SBUF;
RI=0;
dat1=ACC; if(dat1=='E'){goto mout2;}
}while(dat1!='>');
GetData11();
Enter();
SendStringOnGSM("WName:");
i=0x90;
do{
ReadDataFrom1024(202,i);
if(dat1!='*'){SendCharOnGSM(dat1);}
i++;
if(i>=0x9b){dat1='*';}
}while(dat1!='*');
Enter();
SendCharOnGSM(0x1a);
WriteDataTo1024(245,1,0x20);
WriteDataTo1024(245,125,0x20);
mout2:;
}
}

void GetData11()
{
int j;
char h=1;
j=90+1;
if(f3locking==0)
{
moreover=0;
selection(h);h++;
do{
ReadDataFrom1024(245,j);

if(dat1=='/')
{
goto cdm;
}
if(dat1!='|')
{SendCharOnGSM(dat1);}
else{SendCharOnGSM(0x0a);SendCharOnGSM(0x0d);selection(h);h++;
}
j++;
}while(dat1!='/');
cdm:; }
}

Mon Jul 10 2017, 06:09 PM
#2
@Ramweit
What is it you want to know ?
Tue Jul 11 2017, 02:37 PM
#3
From this code gsm modem sending SMS to mobiles multiple times to avoid that am trying to give flag for sent SMS, if flag value is 1 have to stop sending SMS repeatedly.....
Tue Jul 11 2017, 04:20 PM
#4
After the SMS is sent the modem should respond
+CMGS: xx
OK

Just wait a few seconds for the reply.
If you get "OK" stop sending.

Of course is the message was not sent the first time
it probably will not be sent at all.


Which modem are you using ?


[ Edited Tue Jul 11 2017, 04:32 PM ]
Thu Jul 13 2017, 06:58 AM
#5
Thank you for response,

Sim300 gsm Modem am using here...

Get Social

Information

Powered by e107 Forum System

Conversation

ExperimenterUK
Sun Feb 04 2018, 09:38 PM
Hi Dave. Good to see you.
DavesGarage
Tue Jan 09 2018, 07:55 PM
It's been a few years since I poked around here - Hi all...
ExperimenterUK
Mon Jan 08 2018, 07:19 PM
Hi TPS. it's been a while..
۞ TPS ۞
Sun Jan 07 2018, 06:42 PM
hello
Thu Jan 04 2018, 01:50 PM
sayyad affrid
its AT89S52
Thu Jan 04 2018, 01:50 PM
sayyad affrid
sir, i want embedded c code for ultrasonic sensor having buzzer interfaced with AT9S52
Mon Dec 18 2017, 08:12 PM
zafir
i am making digital voltmeter using AT89C51, ADC and LCD 16x2,,, kindly someone please send me hex file in assembly language
Fri Dec 15 2017, 12:18 PM
mehari
can not find dhtxx.md file in proteus 8.0 can anybody help me please?
sahar7478
Fri Dec 08 2017, 12:47 PM
can i get gsm a6 library? can anybody help? tia
Faiqa
Sat Nov 25 2017, 08:32 AM
Can i get the code of Monitering and controlling of green house effect? ... Can anyone help me ?

Downloads

Comments

justotemon
Sat Feb 17 2018, 07:14 AM
nicolekristen
Fri Feb 16 2018, 12:19 PM
pavithrann
Wed Feb 14 2018, 04:46 PM
Tue Feb 13 2018, 03:18 PM
SDN1964
Sun Feb 11 2018, 12:00 PM
Nickynet
Sat Feb 10 2018, 11:02 PM
paulfjujo
Thu Feb 08 2018, 09:01 AM
holdthedoor264
Tue Feb 06 2018, 06:49 AM

Online

Guests: 56, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 37963
Newest member: justotemon
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Feb 14 2018, 08:43 PM
>strange to don't define the way Write or Read..fo...
paulfjujo Avatar
Posted By paulfjujo
Wed Feb 14 2018, 02:25 PM
hello,Thank for your answer, but today i wrote thi...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Feb 13 2018, 09:43 PM
Glad you sorted it.I'm sure you will remember if f...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Feb 13 2018, 09:38 PM
>When i initialise UART_Init (9600); i get error=1...
Martinv Avatar
Posted By Martinv
Tue Feb 13 2018, 09:26 PM
Mmmm feel quite silly, but learned a lot. I must ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Feb 13 2018, 08:07 PM
Can you zip and attach your full code.Using a seco...
paulfjujo Avatar
Posted By paulfjujo
Tue Feb 13 2018, 12:28 PM
hello,i tried this litle code with MikroC for 8051...
Martinv Avatar
Posted By Martinv
Tue Feb 13 2018, 09:22 AM
Thanks for the reply. The part of the main loop t...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Feb 13 2018, 01:12 AM
Unless "READSMS" has some very long delays I doubt...
paulfjujo Avatar
Posted By paulfjujo
Sun Feb 11 2018, 06:52 PM
hello,The chip is probably locked.Why not build t...