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.

Pic18 interfacing with GSM module

Status
Not open for further replies.

m.waqas

Junior Member level 1
Joined
Dec 1, 2009
Messages
17
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
pakistan
Activity points
1,404
Hi
i am new to this forum and hope that i will get help from here.
i want to communicate my GSM module sim300DZ with server.
i want to send AT commands serially via microntroller (PIC18F65J15) to GSM module
and establish a TCP/IP connection and send data serially.
please tell me how can i send AT commands
here i tried my self is this ok



void sendATcommand(unsigned char);
main()
.
.
.
.
sendATcommand('A');
sendATcommand('T');
sendATcommand('+');
sendATcommand('C');
sendATcommand('I');
sendATcommand('P');
sendATcommand('S');
sendATcommand('T');
sendATcommand('A');
sendATcommand('R');
sendATcommand('T');
sendATcommand('=');
sendATcommand('"');
sendATcommand('T');
sendATcommand('C');
sendATcommand('P');
sendATcommand('"');
sendATcommand(',');

}
void sendATcommand(unsigned char m)
{
while(PIR1bits.TX2IF==1);
TXREG2=m;

}
 

You are using GPRS ...
instead of sending character by character write a function that sends String...

and i hope you have to add carriage return and line feed and end of each AT commands
 

thanx vijay for your reply
yes i am using GPRS.
plz help me how can i send a string on serial port........
i have found a function in pic mikroc UART2_Write_Text
can i send a complete string using this function.....
and how to add carriage return and line feed.

waiting.........
 

I don't use MickroC so I don't know about the UART2_Write_Text function, but to send a string you can use a function like this:
Code:
void PutString(char *string_ptr)
{
    BYTE c;

    while (c = *(string_ptr++))           // Outputs data until zero-termniator
    {
         while(PIR1bits.TX2IF==1); 
         TXREG2=c; 
     }
}

Then to send a string you do this:

    PutString("AT+CGATT=1\r");

The "\r" is a carriage return. You don't need a line-feed when sending commands to the module.
 

Actually i am trying to build a vehicle tracking system for my final project.
I am using PIC18F65J15,it has 2 EUSART modules.I am receiving GPS data on UART1 and using UART2 to interface with GSM module.
If i uses interrupts to receive data serially from GPS now how can i access the data received on UART1 to send it through UART2.Because the GPS data i have received and extracted LAT and LONG info from it is in ISR for UART1.I am using C language.
may i declare a global variable for this ISR and access this data in other function directly
any other suggestion....
 

m.waqas said:
may i declare a global variable for this ISR and access this data in other function directly
Yes, you can either read the entire NEMA string and store that in a buffer, or extract the data "on-the-fly". In either case, make the variables that hold the data global and set a flag when you've captured the data you want. You can then test that flag to see when you should send data.
 

Thanx GSM Man
Plz tell me the sequence to establish a TCP connection and then send and receive data.May i use this sequence
**broken link removed**
i have tried this from hyperterminal
AT+CGATT=1
ok
AT+CGDCONT=1,"IP","ufone.pinternet"
ok

but after that it give error for AT+CSTT and AT+CIICR
what DNS ip ishould use also i dont have user name and password i have left those fields blank
Also please tell me what are ppp commands and how can i implement them??????
 

You can use any public DNS server for the CDNSCFG command.

You need to get the user name and password from your service provider. You won't be able to connect to their network without these.
 

i am totally confused at present and don't know what to do:cry::cry:
my confusion is that i do'nt know whether there is a serial link built in the GSM/GPRS modem or not?
i have heared from someone that for SIM300DZ serial link is built in and you just send AT commands from PIC and establish a TCP connection and you will be able to send and receive data in PIC.
and for wavecom i have to built a serial link in modem first and then i will be able to send and receive data in PIC.
is this right?????????
 

When you say "Serial Link" do you mean a serial port for sending and receiving data with the module, or do you mean a "TCP/IP Stack".

Every module that I'm aware of has a serial port for communications. Not all modules have built-in TCP/IP stacks - it varies by manufacturer and model. All of the SIMCom modules have a built-in TCP/IP stack.
 

how do i use the putstring codes in C? i am using C language with MPlab as compiler, pickit2, p16f886
 

Does any one have the Commands for TCP/IP Stack I have to stream data to a specific destination say 119.205.118.133:9595 etc
please advice in this regard
 

Does any one have the Commands for TCP/IP Stack I have to stream data to a specific destination say 119.205.118.133:9595 etc
please advice in this regard

Which module are you using - the commands are specific to each manufaturere/module.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top