Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

GSM 300 Response on LCD wit PIC16F877A

Status
Not open for further replies.

deekshit

Newbie level 5
Joined
Jan 20, 2014
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Location
tytryt
Activity points
97
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 ...


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#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++;
}
buffer[i]= '\0';
 
for(i=0;buffer[i]!='\0';i++)
{
buffer[i]+= 0x30;
lcd_goto(0x00+i);
wait(10);
lcd_putch(buffer[i]);
wait(50);
} while(1);
 
 
void clearBuffer()
{
for(i = 0;i < 95;i++)buffer[i] = ' ';
 
}



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:

Response from GSM SIM 300 will be in string format like \r\nOK\r\n, so, you don't have to add 0x30 to them.

UART receive interrupt should be enabled by setting RCIE bit before do {...}while(1); loop.


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
do {
 
    i = 0;
 
    Tx_string("AT\r");
 
    //while(!RCIF);
 
    while(i < 6) {  // \r\nOK\r\n = 6 characters
        if(RCIF)
            buffer[i++] = RCREG;
 
        RCIF = 0;
                
    }
 
    buffer[i]= '\0';
 
    for(i = 0; buffer[i] != '\0'; i++)
    {
        if((buffer[i] != '\r') || (buffer[i] != '\n')) {
        
            lcd_goto(i);
            wait(10);
            lcd_putch(buffer[i]);
            wait(50);
        }
    }
 
} while(1);

 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top