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 and pic16F877 interface

Status
Not open for further replies.

Abdulmajeed

Newbie level 3
Joined
Apr 26, 2009
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,324
usart_read_text

hey guyz...

i'm interfacing a GSM modem (seimens gsm35) with a PIC16F877.. connected the modem to the USART bus of PIC... i need to send an sms from my gsm.. i wrote this code in microbasic but there's a couple of stuff that i'm not sure about... would you please check my code:


Code:
program USART_Test

main:

PORTC = 0     'initialize port C
TRISC = $D0   'configure port C bits

SPBRG = 25
TXSTA = $24
RCSTA = $90
     
Usart_Init(19200)                 ' Initialize USART module

Usart_Write_Text("AT+CMGF=1" + Chr(13) + Chr(10))
Usart_Write_Text("AT+CMGS="+962796626060"" + Chr(13) + Chr(10))
Usart_Write_Text("hello!!")

end.

1- how do i send the CR character? did i handle it correctly with Chr(13)+Chr(10)??
2- in the CMGS command i'm supposed to put the destination in qoutes"" how do i send these???!!!
3- after typing the message code i'm supposed to click CTRL+Z, how do i do this serially from the PIC?!!!
4- assuming constant baud rate should i initiate the USART baud rate to the same baud rate of the GSM?? and plz help me with the AT command that initiates a constant baud rate??

i'm running out of time.. any help appreciated guyz...
regards...[/code]
 

pic16f send at modem commands

1 - You don't need to add the LF after the command, only the CR is needed - at least all of the GSM modules I've used work that way.
2 - You use Chr(34) to send a Double quote (")
3 - You send a CTRL-Z with Chr(26)
4 - the command for setting Baud Rate is: AT+IPR=n - where n is the Baud Rate
 

mikrobasic usart con 16f877

Thnx man you ROCK!!... i realy appreciate it bud..
i'm afraid that's not just about it!!.. :D

now i connected the PIC (Rx pin) to GPS as the GPS is only a transmitter... i need the PIC to receive the NMEA message from the GPS (in text mode).. here's the code:

Code:
Usart_Init(19200)                 ' Initialize USART module
delimeter = "$GPGLL,3723.2475,N,12158.3416,W,161229.487,A,A*41"
if Usart_Data_Ready() = 1 then   ' If data is received
    received_byte = Usart_Read_Text(received_txt,delimeter)  
end if

i want to make sure, does the (USART_Read_text) function expect to receive the same delimeter string i put in the code as is??.. because it won't receive the delimeter i assigned in the code, it will receive the calculated data from the GPS, i just used this delemeter for length and format!!... does it make any sense??..

if this doesn't work should i just use the (USART_Read) function and save the read data into a string with the same length of my message???
 

pic16f877 gps

Thnx man you ROCK!!... i realy appreciate it bud..

now i connected the PIC (Rx pin) to GPS as the GPS is only a transmitter... i need the PIC to receive the NMEA message from the GPS (in text mode).. here's the code:

Code:
Usart_Init(19200) ' Initialize USART module
delimeter = "$GPGLL,3723.2475,N,12158.3416,W,161229.487,A,A*41"
if Usart_Data_Ready() = 1 then ' If data is received
received_byte = Usart_Read_Text(received_txt,delimeter)
end if


i want to make sure, does the (USART_Read_text) function expect to receive the same delimeter string i put in the code as is??.. because it won't receive the delimeter i assigned in the code, it will receive the calculated data from the GPS, i just used this delemeter for length and format!!... does it make any sense??..

if this doesn't work should i just use the (USART_Read) function and save the read data into a string with the same length of my message???
 

May i know you use which software to write that type of programming?Is it Mikro C with C programming?
I will appreciate for the help.Thanks.
 

Re: usart_read_text

Usart_Write_Text("AT+CMGF=1" + Chr(13) + Chr(10))
Usart_Write_Text("AT+CMGS="+962796626060"" + Chr(13) + Chr(10))
Usart_Write_Text("hello!!")

thes code for send sms what the code for receved sms and test the sms if="1" then led on
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top