GSM interfacing with 8051

Discussion in 'Embedded Systems and Microcontrollers' started by PY01A0080, Jun 28, 2013.

  1. PY01A0080

    Thread Starter Member

    Mar 7, 2013
    42
    3
    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:
    Code ( (Unknown Language)):
    1.  
    2. void serialcomm()
    3. {
    4.  
    5.  TMOD=0x20;        // Mode=2
    6.  TH1=0xfd;   // 9600 baud
    7.  SCON=0x50;        // Serial mode=1 ,8-Bit data,1 Stop bit ,1 Start bit  , Receiving on
    8.  TR1=1;           // Start timer
    9. }
    10.  
    11. void delay(unsigned int value)
    12.    {
    13.      unsigned int i,j;
    14.      for(i=0;i<value;i++)    
    15.        for(j=0;j<1275;j++);
    16.    }
    17.  
    18.  
    19. void serial(unsigned char x)
    20.  {
    21.   SBUF=x;
    22.   while(TI==0);
    23.   TI=0;
    24.  }
    25.  
    26.  
    27. void Send2Gsm(char *aaa)
    28.  {
    29.  unsigned int i;
    30.  for(i=0;aaa[i]!=0;i++)
    31.   {
    32.   serial(aaa[i]);
    33.   }
    34.  }
    35.  
    36.  
    37. void main()
    38. {
    39.  
    40.  
    41.  
    42. serialcomm();
    43.  
    44. Send2Gsm("AT\r\n");
    45. delay(50);
    46.  
    47. Send2Gsm("AT+CMGF=1\r\n");
    48. delay(50);
    49.  
    50. Send2Gsm("AT+CMGS=\"+919016347670;\"\r\n");
    51. delay(50);
    52.  
    53. Send2Gsm("Hello bad news, your has benn stolen now!!!");
    54. serial(0x1a);
    55.  
    56.  
    57.   while(1);
    58.      
    59.  }
    60. [/i][/i]
     
Loading...