Home AMX User Forum NetLinx Studio

String To Hex conversion (Beginner)

Hi,

Is very easy questions but I'm beginner and i need help .

I have Cinterion MC37i ( Is GMS interface Box) and i need interact with Ni-2000 controler.

I can interact by RS232 port, I active all notifications in netlinks studio and i recieve data for this box.

I recieve for exemple data :
Line 5 (10:06:10):: String From [5001:2:242]-[$00$42($40$$00$%($4E$0C$3F]

What is function for convert Hexa to String ?

Commande set document for mc37i, all commande is string command, exemple for start box :
^SYSSTART
AT+CPIN=9999

I can send directly : SEND_STRING 5001:2:0,"'^SYSSTART'" or convert string to hexa before sending ?

Thank's for your help

Comments

  • PhreaKPhreaK Posts: 966
    Hey PMarclyte, welcome to the forums.

    If the device protocol mentions that it's all human readable and you are receiving the data you mentioned above ensure that you have set the baud rate on your control port to match the device. To do this have a look for the device controller in AMX-PI. The command that you want is 'SET BAUD'.

    Regarding communication hex, decimal and characters mean nothing to a computer. These are just different ways of presenting data to us mere humans. The character 'a' can also be written as $61 or 97. These all refer to the exact same value, just different ways of representing it. If you want to send some data represented as characters to a device simply send that string as you are already doing above.
  • catalinocatalino Posts: 25
    Also, the AMX Netlinx Studio also has a feature in the Settings that allows ASCII in the device notifications to be displayed as its corresponding hex value, or by the alphanumeric "A',"B","1","2". I'd check there to make sure your setting is correct. It's a bit confusing as to how you see some hex notations. I've seen the following for Hex character "$0D" (AMX string terminology for carriage return)

    0D
    D
    13
    $0x0d
    $0x0D
    0x0D
    0Dh
    0DH
    CR

    The letter A in hex according to http://www.asciitable.com/ is "$41", or 65 in decimal.

    Protip: The built in "calc.exe" in windows has a programmer mode that can do easy decimal -> hex and hex->decimal conversions for you, as well as hex arithmetic when calculating checksums.

    When you type "^SYSSTART" you are sending the ASCII(2-digit hexadecimal symbols). It's equivalent to if you did it in hex using "$54$59$53..." notation.
Sign In or Register to comment.