Alarming problem


Closed Thread
Results 1 to 17 of 17

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Has your string TelephoneNo been converted to ASCII first?

    Except for the first example being terminated with CR, ASCII conversion
    handled in-line, and the number of digits dialed, it looks like both should
    work the same.

    Does something like his work?
    Code:
    STRING VAR BYTE[6]
    X VAR BYTE
    
    MAIN:
        FOR X = 0 TO 5
        STRING[X] = X + "0" ' convert digits to ASCII
        NEXT X    
        HSEROUT [34,STR STRING\6,34]
    
    DONE:
        GOTO DONE
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  2. #2
    Early1's Avatar
    Early1 Guest


    Did you find this post helpful? Yes | No

    Default

    Hi Bruce

    No I have never included ASCII conversion and yes previously both did work the same. Curious is it not!!

    and even more curious is the way that they do both work when connected to hyperterminal.

    I will do some more testing tomorrow.

    Maybe I need to set the modem to ATE0.

    Thanks

    Steve

  3. #3
    Early1's Avatar
    Early1 Guest


    Did you find this post helpful? Yes | No

    Default

    Here is some test code.


    define OSC 20 ' set the correct speed here!!
    define LOADER_USED 1

    define HSER_RCSTA 90h
    DEFINE HSER_TXSTA 20h
    DEFINE HSER_BAUD 9600
    DEFINE HSER_SPBRG 32
    DEFINE HSER_CLROERR 1



    Teladd var byte
    TelephoneNo1 var byte[16]

    For Teladd = 0 To 15 ' Read Telephone number in memory

    Read Teladd,TelephoneNo1[Teladd]

    Next TelAdd


    sms:

    'THIS WORKS
    hserOUT [65,84,13] 'Sending "AT" and Carraige return to GSM module
    hserin 5000, SMS,[WAIT("OK")] ' wait for response ok for 5 seconds
    hserOUT ["AT+CMGS=",34,"07771716175",34,13] 'Here the GSM module is told the desitnation phone number
    hserin 15000,SMS,[WAIT(62)]
    hserOUT ["WJ Groundwater Limited One Pump Failed",26]
    hserin 15000,SMS,[WAIT(43,67,77,71)]
    'AND THIS DOES NOT
    hserOUT [65,84,13] 'Sending "AT" and Carraige return to GSM module
    hserin 5000, SMS,[WAIT("OK")] ' wait for response ok for 5 seconds
    hserOUT ["AT+CMGS=",34,str TelephoneNo1\16,34,13] 'Here the GSM module is told the desitnation phone number
    hserin 15000,SMS,[WAIT(62)]
    hserOUT ["WJ Groundwater Limited One Pump Failed",26]
    hserin 15000,SMS,[WAIT(43,67,77,71)]


    serout portc.5,6,[12, "msg SENT"]

  4. #4
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    The version that works is sending an 11 digit phone number. The version that
    doesn't is sending a 16 digit number that may or may not be in ASCII format.

    Does this work?
    Code:
       TelephoneNo1 var byte[16]
       X VAR BYTE
       Y VAR BYTE
    
        FOR X = 0 TO 10    ' 11 digit phone #
          LOOKUP X,["07771716175"],Y
          TelephoneNo1[X] = Y
        NEXT X
    
       hserOUT [65,84,13] 'Sending "AT" and Carraige return to GSM module
       hserin 5000, SMS,[WAIT("OK")] ' wait for response ok for 5 seconds 
       hserOUT ["AT+CMGS=",34,str TelephoneNo1\11,34,13] 'Here the GSMmodule is told the desitnation phone number
       hserin 15000,SMS,[WAIT(62)]
       hserOUT ["WJ Groundwater Limited One Pump Failed",26]
       hserin 15000,SMS,[WAIT(43,67,77,71)]
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  5. #5
    Early1's Avatar
    Early1 Guest


    Did you find this post helpful? Yes | No

    Default

    Hi Bruce

    A couple of very good points you have made there.

    I had the same qeries when I originaly wrote the program.

    The telephone numbers are stored on the eprom and non digits are padded out with nulls so

    012345678912 in the eprom looks like
    012345678912______ where _ is null or 0 in hex

    the program then loads this data into the telephone variable and when viewed in ICD mode looks like

    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    49
    50
    0
    0
    0
    0
    0

    Now what happens is that when I use the hserout str function it automaticaly detects the first null and concatinates to 012345678912

    and looks like this in hyperterminal AT+CMGS="012345678912"

    I was well impressed when it worked, over the moon sort of thing and it was the easiest of many issues to solve. I2C master and slave mode were the hardest by the way.

    But this time it does not work.

    I will try your suggestions.

    I believe that we are foucusing in on the root cause of the issue.

    Thanks

    Steve

  6. #6
    Early1's Avatar
    Early1 Guest


    Did you find this post helpful? Yes | No

    Default

    Well changing fro a 16 to 11 character string did the trick, it works.

    Thanks

  7. #7
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Great. I think I may have found out why.

    Try running this with a terminal program. When you change array elements
    11-15 in TelephoneNo1 from ASCII 0's to null characters, it does not output
    what you might expect.
    Code:
    DEFINE LOADER_USED 1
    DEFINE OSC 4
    
    TelephoneNo1 var byte[16]
    X VAR BYTE
    Y VAR BYTE
    
    MAIN:
        FOR X = 0 TO 10
          LOOKUP X,["01234567890"],Y ' 11 digit phone number
          TelephoneNo1[X] = Y
        NEXT X
        FOR X = 11 TO 15 ' Now load unused array elements with something
          TelephoneNo1[X] = "0" ' Change this to = 0 VS "0" to see the effect.
        NEXT X
           
        HSEROUT [34,STR TelephoneNo1\12,34]
        HSEROUT [13,10]
        PAUSE 500
        GOTO MAIN
         
        ' Incorrect
        ' Outputs this when 11-15 are assigned null chars
        ' "01234567890"01234567890"01234567890"01234567890"01234567890
        ' Should be (assuming it continues when reaching the 1st null char #12)
        ' "01234567890"
        ' "01234567890", etc,,
    
        ' Correct
        ' Outputs this when 11-15 are assigned ASCII 0's
        ' "012345678900"
        ' "012345678900"
        ' "012345678900"
        ' "012345678900"
    The null characters seem to be screwing up things. Assuming HSEROUT will
    drop the 1st null character in your string, then send the next valid characters
    afterwards, may be the problem.

    It seems to choke after bumping into the 1st null char, and not send the
    remainder of data as expected in the HSEROUT line.

    Maybe the one that originally worked was with an earlier version of PBP, and
    an error has been introduced in the latest version? Could explain why it
    worked then and doesn't now with the same code.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. Problem with ASM IRQ using FSR0 on PIC18F252
    By mytekcontrols in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 11th March 2008, 20:48
  2. USART Problem , but don't know where, in pc? or in PIC?
    By precision in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th July 2007, 08:12
  3. Microcode Studio 18f2455 problem?????
    By volkan in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 21st May 2007, 21:04
  4. Hardware problem or what ?
    By Steve S. in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 4th March 2007, 21:39
  5. 1 slave 1 master 1 MAX232 1 problem ?
    By SuB-ZeRo in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 31st July 2005, 22:59

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