Pic to GSM Phone connection (HSerin problems)


Closed Thread
Results 1 to 40 of 289

Hybrid View

  1. #1
    Join Date
    May 2004
    Location
    brighton
    Posts
    149

    Post Sorry But Please Help

    Sorry Guys to bring this nokia 6210 thing up again i know you have all tried to give all the advise that you can, but i am a bit lost here.
    I am trying to communicate with a Nokia 6210 with my pic using( Melabs LAB-X1 Experimenter/Lab Board) but i dont get any response from the phone .
    i am using the Original Nokia DLR-3 Data Cable that i ordered from Nokia.
    the phone works ok when i use the cable with Hypertheminal and i know my Hardware is ok because i can communicate with my pc with my project board
    so where do you think the problem lies.

    Regards
    Isaac

    i am trying to run the following program


    Define LOADER_USED 1
    Include "Modedefs.Bas"
    DEFINE OSC 20

    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 20h
    DEFINE HSER_BAUD 9600
    DEFINE HSER_CLROERR 1
    ' Define LCD connections
    Define LCD_DREG PORTD
    Define LCD_DBIT 4
    Define LCD_RSREG PORTE
    Define LCD_RSBIT 0
    Define LCD_EREG PORTE
    Define LCD_EBIT 1


    ' Define program variables
    col var byte ' Keypad column
    row var byte ' Keypad row
    key var byte ' Key value


    OPTION_REG.7 = 0 ' Enable PORTB pullups

    ADCON1 = 7 ' Make PORTA and PORTE digital
    Low PORTE.2 ' LCD R/W low (write)

    Pause 100 ' Wait for LCD to start

    Lcdout $fe, 1, "Press any key" ' Display sign on message

    loop: Gosub getkey ' Get a key from the keypad
    Lcdout $fe, 1, #key ' Display ASCII key number
    if (key =5) then
    gosub sms
    endif
    Goto loop ' Do it forever


    ' Subroutine to get a key from keypad
    getkey:
    Pause 50 ' Debounce

    getkeyu:
    ' Wait for all keys up
    PORTB = 0 ' All output pins low
    TRISB = $f0 ' Bottom 4 pins out, top 4 pins in
    If ((PORTB >> 4) != $f) Then getkeyu ' If any keys down, loop

    Pause 50 ' Debounce

    getkeyp:
    ' Wait for keypress
    For col = 0 to 3 ' 4 columns in keypad
    PORTB = 0 ' All output pins low
    TRISB = (dcd col) ^ $ff ' Set one column pin to output
    row = PORTB >> 4 ' Read row
    If row != $f Then gotkey ' If any keydown, exit
    Next col

    Goto getkeyp ' No keys down, go look again

    gotkey: ' Change row and column to key number 1 - 16
    key = (col * 4) + (ncd (row ^ $f))
    Return ' Subroutine over

    'Send SMS Test-Message
    sms:

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

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

    HSerout ["AT+CMGS=",34,"+447895711481",34,",129",13,10]
    Pause 500

    HSerout ["Test-Message",10,13]
    HSerout [26]
    Pause 500

    RETURN ' return from subroutine

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

    Default

    Quote Originally Posted by isaac View Post
    .....

    'Send SMS Test-Message
    sms:

    HSerout ["ATZ",13,10]
    Pause 1000 <<<<<<<<<<<<<< [1]

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

    HSerout ["AT+CMGS=",34,"+447895711481",34,",129",13,10]
    Pause 500 <<<<<<<<<<<<<< [3]

    HSerout ["Test-Message",10,13]
    HSerout [26]
    Pause 500 <<<<<<<<<<<<<< [4]

    RETURN ' return from subroutine
    General all the above lack the response from the mobile. Every command has a response and that response comes with different timing. Other sooner other later.

    So my suggestion is to:

    [1]: Wait for the 'OK' response
    [2]: Wait for the 'OK' response
    [3]: Wait for the '>' response
    [4]: Wait for the 'OK' response

    Also, have put the phone in TEXT mode or is it in PDU mode?

    A monitor on the RS232 lines to see what text is transmitting to both ends would be very helpfull. If your PC has a second Port use it for stealling the signals with two 10K and drive the Rx pin of the second RS232 com port.

    Ioannis

  3. #3
    Join Date
    May 2004
    Location
    brighton
    Posts
    149

    Default

    Ioannis

    Thanks for your quick reply.
    i delibrately removed the WAITS as i was debuging the phone because the phone was not sending any response back my program kept looping in sms.
    i have only got one serial port on my pc so would be able to experiment as to your suggestion.
    Is it true that i just neeed Tx/Rx & Gnd connection?

    Here is my original code
    Define LOADER_USED 1
    Include "Modedefs.Bas"
    DEFINE OSC 20

    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 20h
    DEFINE HSER_BAUD 9600
    DEFINE HSER_CLROERR 1
    ' Define LCD connections
    Define LCD_DREG PORTD
    Define LCD_DBIT 4
    Define LCD_RSREG PORTE
    Define LCD_RSBIT 0
    Define LCD_EREG PORTE
    Define LCD_EBIT 1


    ' Define program variables
    col var byte ' Keypad column
    row var byte ' Keypad row
    key var byte ' Key value


    OPTION_REG.7 = 0 ' Enable PORTB pullups

    ADCON1 = 7 ' Make PORTA and PORTE digital
    Low PORTE.2 ' LCD R/W low (write)

    Pause 100 ' Wait for LCD to start

    Lcdout $fe, 1, "Press any key" ' Display sign on message

    loop: Gosub getkey ' Get a key from the keypad
    Lcdout $fe, 1, #key ' Display ASCII key number
    if (key =5) then
    gosub sms
    endif
    Goto loop ' Do it forever


    ' Subroutine to get a key from keypad
    getkey:
    Pause 50 ' Debounce

    getkeyu:
    ' Wait for all keys up
    PORTB = 0 ' All output pins low
    TRISB = $f0 ' Bottom 4 pins out, top 4 pins in
    If ((PORTB >> 4) != $f) Then getkeyu ' If any keys down, loop

    Pause 50 ' Debounce

    getkeyp:
    ' Wait for keypress
    For col = 0 to 3 ' 4 columns in keypad
    PORTB = 0 ' All output pins low
    TRISB = (dcd col) ^ $ff ' Set one column pin to output
    row = PORTB >> 4 ' Read row
    If row != $f Then gotkey ' If any keydown, exit
    Next col

    Goto getkeyp ' No keys down, go look again

    gotkey: ' Change row and column to key number 1 - 16
    key = (col * 4) + (ncd (row ^ $f))
    Return ' Subroutine over

    'Send SMS Test-Message
    sms:
    HSerout ["ATZ",13,10]
    HSERIN 5000, SMS,[WAIT("OK")] ' wait for response ok for 5 seconds
    HSerout ["AT+CMGF=1",13,10] 'Set Text Mode
    HSERIN 5000, SMS,[WAIT("OK")] ' wait for response ok for 5 seconds
    HSerout ["AT+CMGS=",34,"+447895711481",34,",129",13,10]
    HSERIN 5000 , SMS, [WAIT(">")]
    HSerout ["Test-Message",10,13]
    HSerout [26]
    Pause 500

    RETURN ' return from subroutine

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

    Default

    You are welcome.

    Of course I cannot debug from here, but can suggest to send the commands from terminal program and check what the phone responds.

    If all seems OK then check if the PIC communicates OK with the terminal window and you emulate the phone by typing the responses (you have to be quick here...!)

    Also check the settings of the DEFINES for the Baud and XTAL you use. I don't remember if these you use are correct.

    Ioannis

  5. #5
    Join Date
    May 2004
    Location
    brighton
    Posts
    149

    Default

    Just a quick one
    Do i need RTS and DTR etc as those are not connected on the LAB-X1 Experimenter board ?

    Isaac

  6. #6
    Join Date
    May 2004
    Location
    brighton
    Posts
    149

    Default

    Just tried it with RTS/DTR tried to +5v but still no joy
    maybe i need to get another nokia cable

    Isaac

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

    Default

    First you do not need to use the RTS or other signal as long as you have low data rate and be able to process the data. I am using the 9600 mobile modem to transfer blocks of 66 bytes without any problem.

    Second, have you check if the phone responds as I stated in my previous post?

    Have you also checked the responses from your controller (PIC)?

    What were the results?

    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, 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 : 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