GSM interfacing with 8051

Thread Starter

PY01A0080

Joined Mar 7, 2013
42
Hi Friends,

i want to test a GSM module sim300.
i've tested it with Hyper-Terminal and some AT and it works perfectly.

After i tried the code from EngineerGarage, but when i try with Proteus ISIS, the virtual terminal shows a line with ascii code, why?
i configure the virtual terminal but nothing to do.
Could you help to configure correctly the virtual terminal,
please see attached file.

Thank you

code:
Rich (BB code):
void serialcomm()
{

 TMOD=0x20;        // Mode=2
 TH1=0xfd;   // 9600 baud
 SCON=0x50;        // Serial mode=1 ,8-Bit data,1 Stop bit ,1 Start bit  , Receiving on
 TR1=1;           // Start timer 
}

void delay(unsigned int value)
   {
     unsigned int i,j;
     for(i=0;i<value;i++)     
       for(j=0;j<1275;j++);
   }


void serial(unsigned char x)
 {
  SBUF=x;
  while(TI==0);
  TI=0;
 }


void Send2Gsm(char *aaa)
 {
 unsigned int i;
 for(i=0;aaa!=0;i++)
  {
  serial(aaa); 
  }
 }


void main()
{

  

serialcomm();

Send2Gsm("AT\r\n");
delay(50);

Send2Gsm("AT+CMGF=1\r\n");
delay(50);

Send2Gsm("AT+CMGS=\"+919016347670;\"\r\n");
delay(50);

Send2Gsm("Hello bad news, your has benn stolen now!!!");
serial(0x1a);


  while(1);
     
 } 
 

Attachments

Top