RECEBE SMS1 pic

download RECEBE SMS1 pic

If you can't read please download the document

description

Programa pic

Transcript of RECEBE SMS1 pic

I am using PIC18F4550 for interfacing with GSM SIM 900. i have cheked it via hyperterminal at baud rate of 9600 and the gsm work perfectly, but when now at the controller it dosn't give the expected results. The c code written in mp lab is given. please help me with this, why isn't it working. #include#include# pragma config WDT=OFF# pragma config LVP=OFF# pragma config FOSC=HS# pragma config IESO=OFF# pragma config MCLRE=ON# pragma config PBADEN=OFFunsigned char value=0;int i=0, k=0,j=0;unsigned char *at_cmd="AT";unsigned char *sms_format="AT+CMGF=1";unsigned char *sms_write="AT+CMGS=\"03006464297\"";unsigned char *sms="Hello";unsigned char enter=0x0D;unsigned char *data;#define FREQ 11059200#define baud 9600#define spbrg_value (((FREQ/64)/baud)-1)unsigned char rx_data(void);void tx_data(unsigned char serial_data) ;void gsm_cmd(unsigned char *);int check(unsigned char *);void main(){ TRISB=0; LATB=0; TRISC=0xC0; //BAUDCONbits.WUE=1; TXSTAbits.SYNC=0; BAUDCONbits.BRG16=0; SPBRG=spbrg_value; // Fill SPBRG register to set the baud rate INTCONbits.GIE=1; // Enable Global interrupt INTCONbits.PEIE=1; // Enable Peripheral interrupt RCSTAbits.SPEN=1; // To activate serial port (Tx and Rx pins) PIE1bits.RCIE=1; // Enable Reception interrupt RCSTAbits.RX9=0; RCSTAbits.CREN=1; // Activate Reception PIE1bits.TXIE=1; PIE1bits.RCIE=1; TXSTAbits.TX9=0; TXSTAbits.TXEN=1; // Activate Transmissiom RCSTAbits.RX9=1; while (1){ {PORTBbits.RB0=1; gsm_cmd(at_cmd); Delay10TCYx(500); i=0;while(i