09-10-2013 08:53 AM
I am sending control messages via a serial port which are constructed in a series of bytes. Currently I have all these messages in an excel file which is 8 columns of 224 rows. The messages are the exact hex display I need for my program to work. To verify my setup I tested a few messages by manually typing in the messages using a string constant and set to hex display and everything works fine. How can I get the strings from my file to be recognized as they are using hex display.
Thanks for any suggestions.
Solved! Go to Solution.
09-10-2013 09:09 AM
Setting hex display it's a matter of convenience. It doesn't change a string content at all.
So the program would work whether you set hex display or not.
If you show some example of what you should send and what is written in the file (text? numbers?), we may better understand the problem.
09-10-2013 10:09 AM
When I use a probe and view the output this is what I get. The picture on top would be the manuaul entry and my device will recognize the message. Then the bottom is trying to read the message in from a .csv file and it displays the exact string that is in file but device does not respond. As you will see I will be putting these values in an array and reading, so the first string input would be the same value as the bottom example.
09-10-2013 10:33 AM
So if I correctly understood you're reading an ASCII representation in hex format of the command strings.
You need to convert ASCII to bytes and then to string, this way:
The input string on the left should be read from your file, of course.
Remark that the integer constant's representation must be U8.
You don't need the Trim whitespace function if you are sure that the string doesn't contain extra characters beyond the last hex number.
09-10-2013 10:34 AM
You must be doing something different within your VI for your two modes of entry, assuming the strings are the same. Could you upload the VIs (at least until the string gets transmitted to your device) for both cases so we could see?
Cameron
09-10-2013 02:29 PM
The solution you offered was perfect, thanks for the quick response!!