سؤال

I have a command file with this format:

31 01 FD 37 04
31 01 FD 37 05
31 01 FD 37 06
31 01 FD 37 07

This commands are in ASCII but i have to send my device same numbers just in HEX so: 31 01 FD 37 04 -> 31 01 FD 37 04 NOT(33 31 30 31 46 44 33 37 30 34 )

Any idea?

هل كانت مفيدة؟

المحلول 2

If I understand your question correctly your file contains bytes whose values are 31, 01, FD, 37, 04 etc and you want to send the instrument the string "31 01 FD 37 04". You can do this conversion with a combination of String to Byte Array and Format Into String, for example:

enter image description here

If I've got your question the wrong way round then CharlesB's answer is correct.

نصائح أخرى

There's a "Hexadecimal String To Number" VI in the palette String -> String/Number conversion. Loop 3 by 3 characters skipping space, and you'll get a nice array of numbers to send to your instrument.

Then, you can convert these numbers to a char array (see numeric conversion palette) and make a string out of it, ready to be written by VISA.

You have the file with the correct ASCII characters, so you only need to open the file, read it's contents and forward it to a VISA resource:

FileToVISA

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top