Pic to GSM Phone connection (HSerin problems)


Closed Thread
Results 1 to 40 of 289

Hybrid View

  1. #1
    Join Date
    Sep 2005
    Location
    Switzerland
    Posts
    46

    Default

    Hi everybody !
    Here I'm again.
    I moved to pic 16F876A + Crystal 20MHZ
    Here is the code:

    DEFINE OSC 20
    DEFINE HSER_TXSTA 24h
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_BAUD 19200
    DEFINE HSER_SPBRG 64 ' 19200 Bauds
    DEFINE HSER_CLROERR 1

    Caller VAR BYTE[5]

    HSerout ["AT",13,10]
    Pause 1000

    HSerout ["AT+CMGF=1",13,10] 'Set Text Mode
    Pause 1000

    Loop:

    HSerout ["AT+CMGL",13,10]
    Pause 1000
    HSerin 5000,loop,[wait("REC READ"),STR Caller\5]
    HSerout [STR Caller,13,10]

    End

    Here is what i get on monitor:

    AT
    OK
    AT+CMGF=1
    OK
    AT+CMGL
    +CMGL: 1,"REC READ","44544",,"05/05/31,16:58:21+08"
    Super! Viel Gluck in der Verlosung! - Bonne chance au tirage au sort! - Buona fortuna per l'estrazione! Swisscom Mobile
    OK

    And it loops endless.

    There is only one sms, and it has REC READ
    I'm waiting to see something after the OK, it should be "44544" or anything else but it should !!
    Am I right or not ?
    Please help me !
    Thanks
    Lotondo

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    i'm not a pro of SMS but i think it refer to that part
    Code:
    Loop:
    
    HSerout ["AT+CMGL",13,10]
    Pause 1000
    HSerin 5000,loop,[wait("REC READ"),STR Caller\5]
    HSerout [STR Caller,13,10]
    
    End
    probably you need a delay after the HSERIN and a GOTO after the HSEROUT.

    I can be wrong but i think it make sense. With the current, after the Hserout, your program can jump to XYZ places so ... hard to say what's happen.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Sep 2005
    Location
    Switzerland
    Posts
    46

    Default

    I did some delay, nothing changed.
    I made another test, here is the code:

    DEFINE OSC 20
    DEFINE HSER_TXSTA 24h
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_BAUD 19200
    DEFINE HSER_SPBRG 64 ' 19200 Bauds
    DEFINE HSER_CLROERR 1

    main:
    HSerout ["AT",13,10]
    HSerin 5000,main,[WAIT("OK")]
    HSerout ["WELL DONE",13,10]
    End

    Despite i receive the ok from the phone, the program continues to
    loop and no WELL DONE.

    I don't know what to search and/or test anymore !!

    Thanks for any help.
    Bye
    Lotondo

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,184

    Default

    Quote Originally Posted by Lotondo
    main:
    HSerout ["AT",13,10]
    HSerin 5000,main,[WAIT("OK")]
    HSerout ["WELL DONE",13,10]
    End
    I can not understand where will the "WELL DONE" message be displayed. You are sending it back to the mobile, is this correct? What can the mobile do with this message?

    On you previous post you had a pause 1000 after HSerout ["AT",13,10]. You did well removing it.

    So, I guess a sample like this might help you:

    main:
    Green_Led=0
    HSerout ["AT",13,10]
    HSerin 5000,main,[WAIT("OK")]
    Green_Led=1
    End

    Ioannis

  5. #5
    Join Date
    Sep 2005
    Location
    Switzerland
    Posts
    46

    Default

    Ioannis
    thanks for answering.
    As you know i have problems with hserin.
    The WELL DONE should come out on the screen cause i'm monitoring
    via max232 what it's happened between the pic & phone.
    I tried as you said to add the Led lines. The led did not turn on.
    The pic sends out the AT, the phone answers back OK, the pic now
    should understand that it has received an OK and with Hserin should
    turn a led on or send out a WELL DONE.
    Of course the phone does not understand what the purpose but I should
    see it on the monitor and the pic ends to run.
    Thanks for any further help
    Lotondo

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,184

    Default

    I know it might sound silly, but are sure you are communicating between mobile and PIC with the correct levels? May be your PIC does not see the appropriate voltage levels if you don't use a MAX232 device.

    Other than that, I cannot see what might be wrong.

    Ioannis

  7. #7
    Join Date
    Sep 2005
    Location
    Switzerland
    Posts
    46

    Default

    Well,
    I think so. I'm using Kasamiko's schema + max232 to monitor the dialog between pic & phone.
    I already tried several code list, I can send sms out if an event happens at a programmed port and many more.
    Now i wanted to try the opposite, if it receives a sms the pic should, for example, turn a led on.
    I believe I have to use hserin to catch a part of the sms (text or pdu) but it seems not working properly.
    I don't know, i'm using all my knowledge (not a lot), I read more than hundred posts, it seems that i'm using hserin correct but ..........
    Thanks for any help.
    Bye
    Lotondo

Similar Threads

  1. Serial VB 2005 pic 16f877a problems
    By Snap in forum mel PIC BASIC Pro
    Replies: 28
    Last Post: - 8th July 2013, 00: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, 14:46
  3. problem with the GSM controller
    By Dariolo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 30th May 2009, 20:33
  4. Automatic VB6 to pic serial connection
    By arniepj in forum Code Examples
    Replies: 13
    Last Post: - 10th January 2008, 07:57
  5. Pic to GSM Phone connection
    By samertop in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 14th July 2005, 13:40

Members who have read this thread : 0

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