Home AMX User Forum NetLinx Studio
Options

HEX Send_string problem

hi

i will send some hex string to rs232 on a ni900, but not the completed string will be going out!

example:

SEND_STRING dvAM_____1,"$0F,$33,$90,$1E,$1A"

will be send:

$0F3$90$1E$1A (see $33 ,there is only send 3)

if i send:

SEND_STRING dvAM_____1,"$0F,$01,$DB,$01,$01"

will be send:

$0F$01$DB$01$01 (the full command!)

and here:

SEND_STRING dvAM_____1,"$0F,$2E,$F4,$02,$03"

will be send:

$0F.$F4$02$03 ( see the . )

what's going on here?!

has anyone any help

thanks
john

Comments

  • Options
    ericmedleyericmedley Posts: 4,177
    You might try converting all the chars over to decimal numbers and see what happens. It should not make any difference but I have seen occasions where (for whatever reason) hex strings get goofed up. There is no logic to this idea other than oddities in the compiler.
  • Options
    AMXJeffAMXJeff Posts: 450
    John,

    What you are seeing is the ASCII equivalent to the hexadecimal number you are sending. $33 equals '3' and $2E equals '.'. AMX will display the ASCII equivalent if applicable and then hex if none exists. So the displayed messages are correct in your example. At the end your sending bytes, and the diagnostic tools has no idea what format you used. Hope this makes sense.

    // These messages are identical
    SEND_STRING dvAM_____1,"$0F,$33,$90,$1E,$1A"
    SEND_STRING dvAM_____1,"$0F,'3',$90,$1E,$1A"
    SEND_STRING dvAM_____1,"$0F,51,$90,$1E,$1A"

    ASCII Chart
    http://www.asciitable.com

    Jeff
  • Options
    hi together.

    i think this must be the (problem) solution :-)

    thanks a lot
    john
  • Options
    HedbergHedberg Posts: 671
    I know this response is a little late, but perhaps someone will find it helpful.

    As mentioned, what you are seeing in diagnostics is the ASCII representation of the data, if there is a printable ASCII, and hex for everything else. The display format in the diagnostics window is selectable. Go to settings/preferences/diagnostics and look at the section titled "Notification View". It's self explanatory.

    If you're doing a lot of work where you want to see the hex representation exclusively, you can select "Hex Values." In the last 13 years or so I think I've needed to do that about twice.
Sign In or Register to comment.