hserin and sms controller


Closed Thread
Results 1 to 26 of 26

Hybrid View

  1. #1
    Join Date
    Mar 2009
    Posts
    48

    Default hserin and sms controller

    hello
    here is my problem, i want to read sms message from nokia phone and if sms message is present, activate some output pin on pic. here is some sample code that was faound on som previous thread on this forum


    checksms:

    HSerout ["AT",13,10]' start modem
    Pause 1000

    HSerout ["AT+CMGF=1",13,10]'set text mod
    Pause 500

    'hserout ["AT+CPMS=SM",13,10]'optional set memory location

    loop:
    HSerout ["AT+CMGL",13,10]'list new sms msg
    pause 500

    ' read

    HSerin 1800,loop,[wait("REC UNREAD"),skip 3,STR CALL\13,skip 4,STR GSMT\17,skip 6, STR GSMMSG\16\13]

    if gsmmsg(1)=$41 THEN' msg sent to phone is leter A
    HIGH PORTB.6
    PAUSE 1000
    ENDIF
    GOTO LOOP
    end


    thx in advance for any help!!!!!!!!!!!!!

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,820


    Did you find this post helpful? Yes | No

    Default

    1. Get rid off the Pause 500 after HSerout ["AT+CMGL",13,10]'list new sms msg. Phone may answer ASAP and you will loose the string!

    2. What problem do you have after this?

    3. I suggest to check that phone accepts every command you send. Just to be sure...

    Ioannis

  3. #3
    Join Date
    Mar 2009
    Posts
    48


    Did you find this post helpful? Yes | No

    Default thx ionnis i appreciate for your reply

    thx in advance, i use pic 16F887 and 4 MHz XT osc, i can send msg, delet it, but with reading is not going well, i noticed that teh voltage on rx line of pic is about 2.3 - 2.4 V, and i asume that is not sufficient. i tried with this code but nothing happends!

    Code:
    '****************************************************************
    '*  Name    : UNTITLED.BAS                                      *
    '*  Author  : [select VIEW...EDITOR OPTIONS]                    *
    '*  Notice  : Copyright (c) 2009 [select VIEW...EDITOR OPTIONS] *
    '*          : All Rights Reserved                               *
    '*  Date    : 20/02/2009                                        *
    '*  Version : 1.0                                               *
    '*  Notes   :                                                   *
    '*          :                                                   *
    '****************************************************************
    ansel=$00
    anselh=$00
    OUTPUT PORTB
    PORTB=%00000000
    
    ' Def 
    define OSC 4
    DEFINE HSER_SPBRG 25
    DEFINE HSER_TXSTA 24h
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_BAUD 9600
    DEFINE HSER_CLROERR 1
    
    sms VAR BYTE[16]
    
    I VAR BYTE
    
    HIGH PORTB.7
    PAUSE 2000
    LOW PORTB.7
    
    
    ' check sms
    
    begin:
    HSerout ["AT",13,10]' start comm
    HSERIN 2000,begin,[WAIT("OK")]
    
    textmod:
    HSerout ["AT+CMGF=1",13,10]'set text mod
    HSERIN 2000,textmod,[WAIT("OK")]
    
    mem:
    HSEROUT["AT+CPMS=",34,"ME",34,13,10]' mem location
    HSERIN 2000,mem,[WAIT("OK")]
    
    query:
      'HSEROUT["AT+CMGL=",34,"REC READ",34,13,10]' filter for query
    HSEROUT["AT+CMGL=",34,"REC READ",34,13,10]' filter for query
    HSERIN 5000,query,[WAIT("REC READ"),skip 41, STR sms\16\13] 
    
    I=0
    
    WHILE I <> 13' count until 13
            if sms[i]=$44 THEN ' searching for letter A ?
                GOTO turnon:
                ELSE
                GOSUB back:
          I=I+1
            ENDIF
    WEND
    
    goto query:
    turnon:
    High PortB.6
    pause 1000
    low portb.6
    return
    back:
    RETURN
    
    End

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,820


    Did you find this post helpful? Yes | No

    Default

    Can you put an LCD on a spare port of the PIC?

    You could check that the commands are executed in the order you send and see up to where the program goes or fails.

    How do you connect PIC to Mobile?

    Ioannis

  5. #5
    Join Date
    Mar 2009
    Posts
    48


    Did you find this post helpful? Yes | No

    Default

    i'm going to tried that!!! here is simple schematic of wiring pic and nokia!
    the first one is from admin of www.elektronika.ba, but with this circuit i dont get sufficient voltage on rx pin....i'm gona give shot to the second one tonight it' from some spanish forum!
    Attached Images Attached Images   

  6. #6
    Join Date
    Mar 2009
    Posts
    48


    Did you find this post helpful? Yes | No

    Default

    and this is from www.atrox.at...as i mentioned before i assume the rx line of pic does'n responding, 2.4 V, and need it min 3.3V
    Attached Images Attached Images  

Similar Threads

  1. Replies: 11
    Last Post: - 19th August 2009, 15:23
  2. problem with the GSM controller
    By Dariolo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 30th May 2009, 20:33
  3. Replies: 0
    Last Post: - 21st May 2009, 00:58
  4. parsing string from hserin
    By xxxxxx in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 2nd April 2009, 18:42
  5. Reading a SMS to an array
    By KA5MAL in forum GSM
    Replies: 3
    Last Post: - 17th June 2008, 17:24

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