GSM SIM responce on LCD problem

Status
Not open for further replies.

dhanajaya

New Member
Sir I have tested for the following code with PC hyperterminal its working fine for both send and receive the GSM response , but GSM SIM 300 with PIC 16F877A its working only for sending commands is fine but like sending message and dailing its ok but I want to check the whether its response is OK or error .So it will display only for Carrage return(CR) and Line feed (LF)values i have checked the ASCII table. because i have adding 0x30 to GSM data so it will display like =: on LCD so it will in the ASCII table but not display like OK

please help me... what are the instructions to do this getting like OK . I think it will not given OK from GSM SIM response please check my code and correct it ...

C:
#ifndef _SERIAL_H_
#define _SERIAL_H_

#define _XTAL_FREQ 4000000L

//#ifndef _SERIAL_H_

#define _SERIAL_H_
#define BAUD 9600

#define FOSC 4000000L
#define NINE 0 /* Use 9bit communication? FALSE=8bit */
#define DIVIDER ((int)(FOSC/(16UL * BAUD) -1))
#define HIGH_SPEED 1
#if NINE == 1
  #define NINE_BITS 0x40
#else
   #define NINE_BITS 0
#endif

#if HIGH_SPEED == 1
  #define SPEED 0x4
#else
  #define SPEED 0
#endif

#define RX_PIN TRISC7
#define TX_PIN TRISC6

/* Serial initialization */

#define init_comms()\
RX_PIN = 1; \
TX_PIN = 1; \
SPBRG = DIVIDER; \
RCSTA = (NINE_BITS|0x90); \
TXSTA = (SPEED|NINE_BITS|0x20)
#endif
__CONFIG(XT & WDTDIS & PWRTEN & BORDIS & LVPDIS &

main()
{
   INTCON = 0xC0;
   init_comms();
   wait(10);
   lcd_init();
   wait(10);
   clearBuffer();
   lcd_clear();
   i=0;
   Tx_string("AT\r");
   while(RCIF)
      {
      buffer[I]=RCREG[I];
      i++;
      }
   buffer= '\0';
   for(i=0;buffer!='\0';i++)
      {
      buffer+= 0x30;
      lcd_goto(0x00+i);
      wait(10);
      lcd_putch(buffer);
      wait(50);
      }
   while(1);

void clearBuffer()
      {
     for(i = 0;i < 95;i++)buffer = ' ';
     }
LCD display for only =:

i think its formate like \r\nOK\r\n but it will only display for \r\n

please help me sir...
 
Last edited by a moderator:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…