09-15-2021 06:44 AM
Hello,
i want to send command in visa write in hexadecimal. my command format is like \02\1F\highbyte\lowbyte\03.
these high and low byte i have to take from user in decimal array and convert in hexadecimal and by using concatenation. but i am having problem with \ i am not getting this so if any one can help.
Solved! Go to Solution.
09-15-2021 07:03 AM
the \ is codes display, not exactly hex values.
To get that right click on string control, select properties and choose codes display. For string constant just right click and select codes display.
Here is how to convert between formats for your highbyte/lowbyte.
09-15-2021 07:17 AM
i used \ code display but i am not getting \ between high and low byte. i have attached my result.
09-15-2021 07:27 AM
Hi malik,
@malik240 wrote:
i used \ code display but i am not getting \ between high and low byte. i have attached my result.
When you don't get the expected result then you did something wrong!
As you didn't attach your VI so far we cannot debug it for you - you need to debug on your own…
(Keep in mind: images of (parts of) code is pretty useless as we cannot edit/run/debug them with LabVIEW!)
09-15-2021 07:32 AM
The command packet must be exactly 5 bytes long. Set the string display mode to Hex to see what's your mistake. The backslash is not to be sent, it acts only as a visual delimiter for the Codes string display.
Please post your vi or a simplified version where you build the command.
If you insist to post images, let the display mode be visible on string indicators and constants (right click -> Visible -> Display Style), otherwise it's impossible to say what is the actual string value.
09-15-2021 07:40 AM
here i s VI.
09-15-2021 07:52 AM - edited 09-15-2021 08:06 AM
09-15-2021 08:13 AM
I believe what you are after is this.
09-15-2021 08:23 AM
yes you are right but i want to implent this one by one on each element of array. another thing in this you know in this method with \ some values will automatically convert to other values like \32 will convert to 2. so is there any solution for this to.
09-15-2021 08:26 AM - edited 09-15-2021 08:27 AM
I would actually avoid the \ Codes display here. Instead, use the Hex display. Everything else you seem to be trying is a red herring. You just need to take you temperature, multiply by 100, set that to a U16, use Flatten To String, and then concatenate build the rest of the command around it.
And since you are dealing with a hex/binary/raw communication protocol, do make sure the Termination Character is turned OFF.