hserin and sms controller


Closed Thread
Results 1 to 26 of 26

Hybrid View

  1. #1
    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

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,175


    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

  3. #3
    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   

  4. #4
    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  

  5. #5
    Join Date
    Mar 2009
    Posts
    48


    Did you find this post helpful? Yes | No

    Default thx

    thx ioannis for idea, and i put a hex inverter (invert signal from phone twice) in tx phone to rx pic line and the program is now working. so it search letter A in first readed message in SM location and if it find it turn on led on portb.6
    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'konfigurisi AN pinove kao digital I/O
    anselh=$00
    
    
    ' Definisanje 
    define OSC 4
    DEFINE HSER_SPBRG 25
    DEFINE HSER_TXSTA 24h
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_BAUD 9600
    DEFINE HSER_CLROERR 1
    DEFINE LCD_BITS 4
    DEFINE LCD_DREG PORTB
    DEFINE LCD_DBIT 0
    DEFINE LCD_RSREG PORTB
    DEFINE LCD_RSBIT 4
    DEFINE LCD_EREG PORTB
    DEFINE LCD_EBIT 5
    DEFINE LCD_LINES 2
    
    PORUKA VAR BYTE[16]
    
    I VAR BYTE
    
    HIGH PORTB.7
    PAUSE 2000
    LOW PORTB.7
    
    
    ' provjeri nove poruke
    
    pocetak:
    HSerout ["AT",13,10]' pocni komunikaciju
    
    HSERIN 2000,pocetak,[WAIT("OK")]
     LCDOUT $FE,1,"start"
     pause 1000
    
    textmod:
    HSerout ["AT+CMGF=1",13,10]'postavi text mod
    HSERIN 2000,textmod,[WAIT("OK")]
    
    LCDOUT $FE,1,"text mod" 
     pause 1000
    
    mem:
    HSEROUT["AT+CPMS=",34,"SM",34,13,10]' ciljana memory lokacija
    HSERIN 2000,mem,[WAIT("OK")]
    
    LCDOUT $FE,1,"mem loc"
    pause 1000
    
    IP:
    'HSEROUT["AT+CMGL=",34,"REC READ",34,13,10]' filter za query
    HSEROUT["AT+CMGR=1",13,10]' filter za query
    
    LCDOUT $FE,1,"query"
    
    HSERIN 5000,IP,[WAIT("REC READ"),skip 41, STR PORUKA\16\13] 
    LCDOUT $FE,1,"analizing"
    
    I=0
    
    WHILE I <> 13' count till 13 
            if poruka[i]=$41 THEN ' searc leterr A....
                GOTO UKLJUCI:
                ELSE
                GOSUB NAZAD:
          I=I+1
            ENDIF
    WEND
    
    goto ip:
    UKLJUCI:
    High PortB.6 ' turn on led
     end
    NAZAD:
    RETURN
    
    End

  6. #6
    Join Date
    Mar 2009
    Posts
    48


    Did you find this post helpful? Yes | No

    Default 1 question

    is there any way to get data fom hserin or hserout statement to lcd?????

  7. #7
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,175


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by xxxxxx View Post
    is there any way to get data fom hserin or hserout statement to lcd?????
    Have you used LCD before?

    Ioannis

  8. #8
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,175


    Did you find this post helpful? Yes | No

    Default

    The Hserout/Hserin will NOT work with these circuits! Be careful also not to destroy your phone with this 3.3/5 volt adapters. I would suggest to test with the Serout2/Serin2 commands in invert mode.

    Hserout/Hserin pressume that you have included inverters in your circuit (like the common MAX232, which obviously there are not).

    I would use a 3.3 driver for the UART like MAX3232 for example.

    Ioannis

  9. #9
    Join Date
    Mar 2009
    Posts
    48


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Ioannis View Post
    The Hserout/Hserin will NOT work with these circuits! Be careful also not to destroy your phone with this 3.3/5 volt adapters. I would suggest to test with the Serout2/Serin2 commands in invert mode.

    Hserout/Hserin pressume that you have included inverters in your circuit (like the common MAX232, which obviously there are not).

    I would use a 3.3 driver for the UART like MAX3232 for example.

    Ioannis
    but it's working, i put a hex inverter 74LS04 and inverted the signal two times, 1 x 2 times logical not give 1, and put one zener didode 2v7 in tx line of phone!!!!so it's protected from over voltage!!!

  10. #10
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default How to invert hardware serial port

    Quote Originally Posted by Ioannis View Post
    Hserout/Hserin pressume that you have included inverters in your circuit (like the common MAX232, which obviously there are not).

    I would use a 3.3 driver for the UART like MAX3232 for example.
    The above was an older post. Since then, a way to invert the hardware serial port has been spotted in the 400+ page datasheets of the PIC18 devices.......
    See http://www.picbasic.co.uk/forum/showthread.php?t=10361 for a little more information.

    To command it to do so:
    Code:
    	BSF BAUDCON,RXDTP
    	BSF BAUDCON,TXCKP
    Pretty cool stuff. I have tried it on a few projects, including a bootloader, and it works great. Nice to eliminate the max232 hardware when you can.
    Last edited by ScaleRobotics; - 10th February 2010 at 16:58.

  11. #11
    Join Date
    May 2007
    Location
    Republic Serbia
    Posts
    105


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by xxxxxx View Post
    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
    The Atronix work 100% ok.I use that with Nokia 6210 all the time.
    You must use 19200 to comunicate with Nokia phones.

    Regards Robert

  12. #12
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,175


    Did you find this post helpful? Yes | No

    Default

    At the first AT the device auto syncs to the baud rate. Usually the 9600 is the default.

    No 19200 as standard.

    Ioannis

  13. #13


    Did you find this post helpful? Yes | No

    Default

    Hi,

    Nokia 7110 only work for me in 19600 bauds...

Similar Threads

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

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