Pic to GSM Phone connection (HSerin problems)


Closed Thread
Results 1 to 40 of 289

Hybrid View

  1. #1
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762

    Default

    ... do I need an hex inverter? or a max232?
    You will never get this to work if you don't take the time to read any datasheet.
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  2. #2
    dimitrin's Avatar
    dimitrin Guest

    Default

    don't quite understand your comment.

    thanks for your input.

  3. #3
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762

    Default

    Quote Originally Posted by dimitrin
    don't quite understand your comment...
    ...nor RS232
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  4. #4
    dimitrin's Avatar
    dimitrin Guest

    Default so now you confuse me more

    because it does work with rs 232.

    thanks again for you help

  5. #5
    aruran's Avatar
    aruran Guest

    Question Ericsson T18

    I got an Ericsson T18 phone, which works with the data cable for AT commands.. Going through the internet I found that it doesn't support Text mode, Only pdu mode available. So can I make it work by using bitmaniac's PDU decoder. And I am going to use PIC16F877A. If I do the necessary changes it should work right......

    thanks in advance
    aruran

  6. #6
    PIC Coder's Avatar
    PIC Coder Guest

    Default Samsung SCH-N356.

    Hello,
    I am look out for technical details of Samsung SCH-N356. I also want to make SMS controled relay. Please suggest.
    Bye

  7. #7
    aruran's Avatar
    aruran Guest

    Thumbs up SMS using T18

    Hai all,

    First of all thank you all for the help rendered. I have successfully made a Ericsson T18 to send SMS using PIC16F877A. I give the PIC using I2C bus some data from a main PIC for my microcontroller project. I have written a dynamic PDU encode routing to handle the dynamic texts sent by the main pic. This was achieved mainly from the help of bitmaniac's PDU encode...

    Thank you all
    aruran

  8. #8
    Royce's Avatar
    Royce Guest

    Default PIC to GSM modem

    Hi

    I am very new to PIC's so please excuse some of the comments that I have added to the following code.

    I have put this together using data that was available earlier in this post. I have got the SMS sending working great whenever I push a button but I am also wanting an LED to be switched on when the GSM modem receives and SMS containing "SWITCH"

    I think I have got everything that I require within the program but I am wondering what commands I should use in order to read the GSMBuffer then if it is true then switch on the LED.

    I have added the line just to give an idea of what I'm trying to do:

    IF GSMBUFFER = "SWITCH" THEN LED = 1

    Here is the code:

    ' Setup PIC tx and rx serial port
    DEFINE OSC 8
    DEFINE HSER_TXSTA 20h
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_BAUD 9600
    DEFINE HSER_CLROERR 1

    'Setup the names that will be used throughout the program for the led and switch
    PushButton var PORTB.0 ' Setup the name PushButton to mean PortB input 0
    LED VAR PORTB.1 ' Setup the name LED to mean PortB output 1

    ' SMS receive buffer setup:
    GSMBUFFER VAR BYTE[16] '16 is used to tell buffer to store max of 16 characters
    Caller VAR BYTE[13] '13 is used to tell buffer to store max of 16 characters
    GSMTime VAR BYTE[17] '17 is used to tell buffer to store max of 16 characters

    ' Set all PortB i/o 1 to be an output and all other i/o as inputs
    TRISB = %11111101

    Main:

    IF PushButton = 0 THEN SMS 'If button is pressed then run the SMS routine below

    goto main ' however if the button is not pushed then just go back to the Main
    ' routine to wait for the button to be pressed

    SMS: ' this is the SMS commands routine in order to send an SMS

    HSEROUT ["AT" ,13,10] ' send AT to modem followed by a CR and line feed

    HSERIN 5000, SMS, [WAIT("OK")] ' now wait for 5secs until OK is received however
    ' if it is not then goto the SMS routine again

    HSEROUT ["AT+CMGF=1" ,13,10]

    HSERIN 5000, SMS, [WAIT("OK")]

    HSEROUT ["AT+CMGS=+447977578999"]

    HSEROUT [13,10]

    HSERIN 5000, SMS, [WAIT(">")]

    HSEROUT ["BUTTON HAS BEEN PRESSED!"]

    HSEROUT [26] ' this is ASCII for Ctrl+Z of which completes SMS sending

    HSERIN 15000, SMS, [WAIT("+CMG")] ' then PIC should receive +CMG from modem

    HSEROUT [10] 'ascii code for a line feed

    goto main

    READSMS: 'Use this routine to read first 16 characters of new messages and then
    ' store them in the GSMBUFFER variable above then you are able to add a line at
    ' the end in order for an led to be switched on whenever the modem receives the
    ' correct SMS command such as LED ON or SWITCH etc

    HSEROUT ["AT+CMGF=1",13,10] 'Instruct modem to use text mode

    HSerout ["AT+CMGL",13,10] 'List new Messages

    ' Below I Read Caller ID, time and 16 CHARs of Message
    ' The timeout value in the HSERIN statement is important, it takes some time
    ' before the phone replies to the AT+CMGL command
    ' skip works like this: skip 4 (skips 4 characters) - this is a sample of the
    ' message that would be received after the AT+CMGL command is sent:
    ' +CMGL: 2,"REC UNREAD","+447977578999" Test
    ' Please note that I can't seem to receive the time in the reply as in this
    ' example: (of which the line of code is written for below - so maybe I should
    ' edit the line of code below in order to miss it - also remember to update
    ' GSMTime variable above i.e. remove it if your going to adit the line below)
    ' +CMGR: "REC READ","+xx1234567890",,"05/05/26,17:19:23+00" GOOD
    ' Loop could be setup as a routine such as:
    ' Loop:
    ' List new Messages again - as above (think about it)
    ' HSerout ["AT+CMGL",13,10]

    HSerin 5000,loop,[wait("UNREAD"),skip 3,STR Caller\13,skip 4,STR GSMTime\17,skip 6, STR GSMBUFFER\16\13]

    ' Basically in the above line, \13 - stores 13 characters and \17 - stores 17 characters etc into
    ' each of the buffers i.e. Caller & GSMTime etc etc

    HSerout ["AT+CMGD=1;+CMGD=2",13,10] 'Intruct modem to delete SMS's from location
    ' 1 & 2 as this is where any new messages will be stored, so its a good idea to
    ' delete them after we have processed the SMS command above - please note that
    ' it would be a good idea to wait for an OK after this command but we can add
    ' this at a later time

    ' --- Put your code to output the result here i.e. IF gsmbuffer = (your sms command) then goto
    ' subroutine etc

    IF GSMBUFFER = "SWITCH" THEN LED = 1

    Thank you for your time.

    Kind Regards,
    Royce

  9. #9
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170

    Default

    On the following code the phone responds ..."REC READ",... if the message was read sometime before. If you have a fresh new message then this becomes UNREAD as you state on your code.

    So, why don't you change your code to:

    HSerin 5000,loop,[wait("READ"),... since the word READ is present all the time?

    Ioannis

    ' +CMGR: "REC READ","+xx1234567890",,"05/05/26,17:19:23+00" GOOD
    ' Loop could be setup as a routine such as:
    ' Loop:
    ' List new Messages again - as above (think about it)
    ' HSerout ["AT+CMGL",13,10]

    HSerin 5000,loop,[wait("UNREAD"),skip 3,STR Caller\13,skip 4,STR GSMTime\17,skip 6, STR GSMBUFFER\16\13]

  10. #10
    Royce's Avatar
    Royce Guest

    Default

    Thank you for the info.

    I was wondering if you could tell me how I should use the data that is captured within the GSMBuffer i.e. the SMS text as I would like use this to switch on an LED. Should it be something like this:

    IF GSMBuffer = Switch on then LED = 1

    Thanks in advance.

    Kind Regards,
    Royce

  11. #11
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170

    Default

    PBP does not have such string compring capabilities.

    You have to make your own subroutine to compare byte to byte the two string array. Like that:

    i=0
    while i less_than gsmbuffer_length (I cant sen the less character! Why?)

    if gsmbuffer[i]=compare_array[i] then
    'gsmbuffer[i]=0
    i=i+1
    else
    goto wrong_sms
    endif
    wend
    correct_sms:
    'your code here

    wrong_sms:
    'your code here

    You understand that in compare_array you have to put your characters in some other place of the program prior to the above subroutine.
    Last edited by Ioannis; - 26th July 2005 at 11:25.

  12. #12
    Royce's Avatar
    Royce Guest

    Default

    Thanks again but I'm afraid I dont quite understand. Really sorry but would it be possible to be little clearer.

    Thanks again.

    Kind Regards,
    Royce

  13. #13
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170

    Default

    Hmm, what part you are not understanding?

    Ioannis

Similar Threads

  1. Serial VB 2005 pic 16f877a problems
    By Snap in forum mel PIC BASIC Pro
    Replies: 28
    Last Post: - 8th July 2013, 01:52
  2. HSERIN & Interupts (aka controlling PIC programs from a remote PC)
    By HankMcSpank in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 17th June 2009, 15:46
  3. problem with the GSM controller
    By Dariolo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 30th May 2009, 21:33
  4. Automatic VB6 to pic serial connection
    By arniepj in forum Code Examples
    Replies: 13
    Last Post: - 10th January 2008, 08:57
  5. Pic to GSM Phone connection
    By samertop in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 14th July 2005, 14:40

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts