#include<reg51.h> #include<GSM_init.h> unsigned char L,Lg[12],key,x[4],Po,count,z; bit f2,f3,f4,f5; sbit IOE1=P3^7; sbit IOE2=P3^6; sbit m1=P1^0;sbit m2=P1^1; sbit m3=P1^2;sbit m4=P1^3;sbit as=P3^2;sbit cs=P1^7;sbit ent=P3^3; sbit inc=P3^4;sbit dec=P3^5; void main(void); void serial(void) interrupt 4 using 1 { if(RI) { a[i]=SBUF; RI=0; if(SBUF=='*') { f2=1; EA=0; } i++; if(SBUF=='$') { i=0; } } } void clear() { for(i=0;i<42;i++) { a[i]='\0'; } } GPS_track() { IOE1=1; IOE2=0; ES=1; cmd(0x80);
11: sconf1(); EA=1; delay(50); EA=0; if(a[0]=='G' && a[1]=='P' && a[2]=='G' && a[3]=='G' &&a[4]=='A' && a[27]=='N') { goto 12; } Else { clear(); EA=1;goto 11; } 12: cmd(0x01); cmd(0x80); for(i=6;i<22;i++) { DT(a[i]); } cmd(0xc0); for(i=22;i<38;i++) { DT(a[i]); } Po=0; for(i=17;i<29;i++) { Lg[Po]=a[i];Po++; } IOE1=0; IOE2=1; GSM_setup(); EA=0; serial_tx("AT+CMGS="); serial_tx1(0x22); serial_tx("+255712279439"); serial_tx1(0x22); serial_tx1(0x0d); delay(10); serial_tx("Logitude:"); for(i=0;i<4;i++) { serial_tx1(Lg[i]); } serial_tx(" Latitude:"); for(i=5;i<11;i++) { serial_tx1(Lg[i]); } serial_tx1(0x1a); cmd(0x01); DTS("msg sent"); for(i=0;i<42;i++) { a[i]='\0'; } EA=1; cmd(0x01);cmd(0x80);DTS("welcome"); } void start() { m1=1;m2=0;m3=1;m4=0; } void stop() { m1=1;m2=1;m3=1;m4=1; } void main() { IOE1=0; IOE2=1; GSM_setup(); L=0;f2=0;f3=0;f4=0;f5=0;key=0; while(1) { EA=1;count=0;cmd(0x01); key=0;Po=0; goto j2; j1: key=0;Po=0; cmd(0x80);DTS("Password :"); j2: if(ent==0) { while(ent==0); while(count<2 && f4==1) { cmd(0x80); DTS("Password :"); cmd(0x8a+Po); DT(key+0x30); if(inc==0) { while(inc==0); if(key<9 && key>=0) { key++; } else { key=0; } } else if(dec==0) { while(dec==0); if(key<9 && key>0) { key--; } else { key=0; } } else if(ent==0) { while(ent==0); key=0; Po++; } x[Po]=key+0x30; if(Po>=4) { if(x[0]=='1' && x[1]=='2' && x[2]=='3'&& x[3]=='4') { cmd(0x01);cmd(0xc0);DTS("correct pass u can"); delay(100);cmd(0x01); delay(10);f4=0;f3=0; count=0; } else { cmd(0x01);cmd(0xc0);DTS("incorrect pass pls try"); count++;a[4]="";key=0; delay(10);cmd(0x01); goto j1; } } } } if(count>=2) { cmd(0x01);cmd(0x80);DTS("Due to wrong pass"); cmd(0xc0);DTS("Vehicle P blocked"); while(1) ; } if(cs==0 && as==1 && f3==0) { start(); cmd(0x01);cmd(0x80);DTS("vehicle is going"); } else { stop(); if(as==0) { f3=1; cmd(0x01);cmd(0x80);DTS("vehicle is crashed"); EA=0; serial_tx("AT+CMGS="); serial_tx1(0x22); serial_tx("+255712279439"); serial_tx1(0x22); serial_tx1(0x0d); delay(10); serial_tx(" ur vehicle is crashed"); serial_tx1(0x1a); clear(); i=0; delay(100); EA=1; f1=wait(); if(f1!=1) { goto intim; } f1=0; clear();L=0;i=0; GPS_track(); } } while(f2==1) { i=0; cmd(0x01);cmd(0xC0); while(a[i]!='#') { i++; } z=i; for(i=z+1;a[i]!='*';i++) { DT(a[i]); } delay(300); if(a[z+1]=='B' && a[z+2]=='L' && a[z+3]=='O' &&a[z+4]=='C' && a[z+5]=='K' && a[z+6]=='*') { cmd(0x01);cmd(0x80);DTS("vehicle is blocked"); delay(300); stop(); f3=1;f4=1; } else if(a[z+1]=='T' && a[z+2]=='R' && a[z+3]=='A'&& a[z+4]=='C' && a[z+5]=='K' && a[z+6]=='*') { cmd(0x01);cmd(0x80);DTS("vehicle isTracking"); delay(200);cmd(0x01);clear(); GPS_track(); f1=0; } i=0;z=0; for(i=0;i<43;i++) { a[i]='\0'; } f2=0; EA=1; } cmd(0x01);cmd(0xc0);DTS("Waiting for mess"); } }
This bug have existed for a number of years. Keil really should fix it. It really is not a big job to figure out what condition that trigs it.
But at the same time, they should add some form of code scanner logic - preferably using javascript - that looks for percentage of C keywords and pop up a message "are you _sure_ you haven't posted source code in this post?" in a enough nagging way that people either do add the correct tags or leaves the forum.