Home AMX User Forum NetLinx Studio

hex send problem

anybody can help me with hex send issue

if i send from netlinx or telnet : send_string 1:1:1,"$81,$73,$01,$05"
actually i send this string : [$81s$01$05]

Comments

  • Joe HebertJoe Hebert Posts: 2,159
    vladimirk wrote: »
    anybody can help me with hex send issue

    if i send from netlinx or telnet : send_string 1:1:1,"$81,$73,$01,$05"
    actually i send this string : [$81s$01$05]
    There is nothing wrong with the values. $73 = ASCII s.
    They are both the same thing, it?s just the way they are displayed.
  • hex send problem

    its correct that $73=s, but the divice that i send to should recive a string at hex.
    when i send under than $20 and over than $80
    for example: send_string 1:1:1,"$73" the controller send to port 1
    send_string 1:1:1,"$05" the controller send to port 1 [5]

    i cant understand why a week ago it worked properly, without making any change.
    for example: send_string 1:1:1,"$81,$73,$01,$05" the controller send to port 1 [$81$73$01$05]
    and the divice worked fine.
    For now when i send: send_string 1:1:1,"$81,$73,$01,$05" the controller send to port 1 [$81s$01$05]
    the divice doesnt work.
  • Joe HebertJoe Hebert Posts: 2,159
    vladimirk wrote: »
    its correct that $73=s, but the divice that i send to should recive a string at hex.
    The device (or any device) doesn't know what a hex string is. The device sees $73 and ASCII s as the same exact thing. If it's not working it's because something else must be wrong.
  • jweatherjweather Posts: 320
    If you go to Preferences/Diagnostics, you can set the Notifications view to "Display As... Hex Values". You will then see what you were expecting in the output.

    What Joe is trying to say is that four bytes are always four bytes. There's no such thing as an ASCII byte or a hex byte. Each byte has a value between 0-255 (decimal), $00-$FF (hex). Some of those values happen to be printable ASCII characters, and AMX defaults to showing those as characters.

    "$74,$65,$73,$74" is the same four bytes as "'test'", and both result in sending the same thing out the serial port.
  • TurnipTruckTurnipTruck Posts: 1,485
    Could the device want to see literal hex, which is the ascii represenation of hex? Instead of "$80" maybe you should be sending '80' ???
  • ericmedleyericmedley Posts: 4,177
    Could the device want to see literal hex, which is the ascii represenation of hex? Instead of "$80" maybe you should be sending '80' ???

    I have ran into one device (which escapes me at the moment) that actually wanted an ascii string spelling out a hex string. It was creepy.

    the ascii string was something akin to '0h00,0h25,0h5F' and then followed by a real <CR> That one threw me for a loop for quite a while. The engineer at the manufacturer said it was more secure. I still ponder that statemt... I've been blown off before, but never so blatantly... :D

    It was the equivalent of me telling our designers, "Ah, well, I can't tell you. It's highly electrical and dangerous."
  • TurnipTruckTurnipTruck Posts: 1,485
    Literal hex is easily accomplished with the format command
    SEND_STRING,"FORMAT('%02X',nNumber)"
    
    would send 'FF' if nNumber=255
  • mpullinmpullin Posts: 949
    I've been told before by an engineer at a television company that will remain nameless:

    "Send zero, h, and then two zeros. It's a lowercase h."
  • ericmedleyericmedley Posts: 4,177
    mpullin wrote: »
    I've been told before by an engineer at a television company that will remain nameless:

    "Send zero, h, and then two zeros. It's a lowercase h."

    Ha! :D
    There's always that lonely feeling when you throw out something like that and get nothing but increadulous stares back...
  • Spire_JeffSpire_Jeff Posts: 1,917
    Since we are discussing engineers and display units, I will toss out the display company that locks in a 115,200 baud speed with absolutely no way to change it. I was told that this is because it is the best baud rate to use, so they didn't see any reason to use anything else.

    Unfortunately, you can't easily run this baud rate at distances over 40-50ft with out having all sorts of issues.

    By the way, the longest control command consisted of about 12 characters as I recall. Data coming back from the unit was about the same 12-15 chars. Lastly, they indicated that some control systems might send data to quickly and they recommended putting in a delay between commands being sent.

    Jeff
  • TurnipTruckTurnipTruck Posts: 1,485
    With 115K serial ports, I use RS-422 to a converter at the display. You can for for hundreds of feet this way.
Sign In or Register to comment.