Reading a Hex value from a Modem and showing it as Decimal..


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2005
    Location
    Bellevue
    Posts
    125

    Question Reading a Hex value from a Modem and showing it as Decimal..

    I have a simple gosub which asks the modem for a value, and this value is returned as a HEX value. Example in Hyperterminal:

    "+++" ' sent to modem to enter AT command
    OK ' modem responds OK
    ATRS ' sent to modem - what is your RS value?
    33 ' modem response (actually it sends back HEX values)
    ATCN ' sent to modem to exit AT command

    The value of RS will typically range from 6 – 54 (0x06 – 0x36 hex). This above answer of '33' equates to a decimal value of 51.

    I want to read this RS on my 16F88, and display RS as a DECIMAL value and can't seem to get the right numbers to come out.. Here is the code:

    dis4:
    ' third pass - RSSI
    ' Send command to radio and read RS value back

    Serout2 Cpinout,84,["+++"]
    Serin2 Cpinin,84,1000,noradio,[Wait ("K")]
    Serout2 Cpinout,84,["ATRS",10,13]
    Serin2 Cpinin,84,1000,noradio,[STR RSSI\2]
    serout2 cpinout,84,["ATCN",10,13]
    SSD1=RSSI[1]
    SSD2=RSSI[2]
    RSSIval=(ssd2*16)+ssd1 ' convert to dec
    serout2 Apinout, 16468, [I,CLR]
    serout2 Apinout, 16468, [I,L1_C1]
    serout2 Apinout, 16468, ["RSSI: ",#RSSIval Dig 2, #RSSIval Dig 1]
    pause 1000
    Return

    Anyone have any ideas? I am seeing '03' or '04' when it should be sending '51' or some number in that range...

    NAKKK!!

  2. #2
    Join Date
    Jul 2003
    Location
    Sweden
    Posts
    237


    Did you find this post helpful? Yes | No

    Post

    Modems usually respond very fast to commands, that means that your pic may not be ready to recieve when the modem sends. You may for this reason miss the first character in each transmission. To cure this problem you can try running at 20MHz , if that's not enough you need to use the hardware USART. The 16F88 should have one ..... i think.

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