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.

Interfacing pic 16f688 with TELIT gprs modem

Status
Not open for further replies.

khamar_98495

Newbie level 3
Joined
Mar 17, 2010
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,308
Hi,

I am interfacing pic 16f688 with TELIT gprs modem.
When i send AT command to GPRS modem, i was able to receive "OK" in hyper terminal.

similarly if i send AT command to GPRS modem from pic, it is responding with "OK". I was not able to store this OK in micro controller.
This OK is coming till receiver pin of micro controller but not able to store in a buffer.

Please help me.

Thanks in advance
 

Hi,

Why cannot you store the data 'OK' ??

Post your program source code so we can see what you are trying to do.
 
Hi wp100,

Here i am attaching the code, Please do the needfull.

#include "htc.h"
#include "Pic.h"
#include "pic16f688.h"

__CONFIG(FCMDIS & IESODIS & CPD & MCLREN & WDTDIS & INTIO & PWRTEN & INTCLK & BOREN);

unsigned char receive_byte; //variable to store byte from RCREG
unsigned char receive_array[10]; //Array to store the response
unsigned int long d;

void OscillatorConfiguration(void) //Oscillator initialise
{
OSCCON = 0x71;
}

void UartInit(void) //uart initialise
{

//BRG16 = 0; // tO DO
SPBRG = 12;
BRGH = 0; //data rate for sending
SYNC = 0; //asynchronous
SPEN = 1; //enable serial port pins
CREN = 1; //enable reception
SREN = 0; //no effect
TXIE = 0; //disable tx interrupts
RCIE = 0; //disable rx interrupts
TX9 = 0; //8-bit transmission
RX9 = 0; //8-bit reception
TXEN = 0; //reset transmitter
TXEN = 1; //enable the transmitter
}

void UartTxChar(unsigned char ch) //function to transmit character
{
//CLRWDT();
while(!TXIF);
TXREG = ch;
}

void UartTxString(unsigned char *str) //function to transmit string
{
while(*str != '\0')
UartTxChar(*str++);
UartTxChar(13);

}

void serial_receive() //function to take the value from RCREG
{
while((RCIF == 0) && (d != 50000))
{
d++;
}

if(RCIF)
{
receive_byte = RCREG;
RCIF = 0;
}
else
{
receive_byte = 'A';
}


}

void receive() //function to store the received vale in array
{
unsigned char i;

d = 0;
for( i = 0; i < 9; i++)
{
serial_receive();

receive_array = receive_byte;
}

}

void main(void)
{
OscillatorConfiguration();
UartInit();
UartTxString((unsigned char*)"AT");

receive();

UartTxString(receive_array);
while(1);
}


Thank you in advance
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top