07-13-2011 09:58 AM
Hi,
I am trying to control my device using a RS232 Control Box with Visa. The device requires HEX commands to run. When i run my VI the visa write has no errors but then the read times out. The device works with the supplied software so the connection isnt the problem. what I think is wrong is that im not sending the commands in HEX. In my VI I have different inputs (Numeric control, boolean and constant) being converted into hex string then concatenated to form the command (cmd eg: 020F0F07000D) when I send this to a string indicator on hex display I get 303030304646 which obviously isnt right. The Problem Could be that I am not converting the inputs to HEX correctly?? I have attached my VI and the manual for the control box. Any help or advice would would be appreciated....
Solved! Go to Solution.
07-13-2011 10:16 AM - edited 07-13-2011 10:16 AM
Hi Kane,
so you are the "number to HEX conversion" guy of the month (or is it week?)!
You should read your manual carefully and try something like this:
This one will build an array of U8 numbers (=BYTES!) and convert them to a string. Just look at the string in hex display...
07-14-2011 01:40 PM
Thanks GerdW,
Yea that worked! but i have come across another problem the command goes through the visa write and the return count says their is 6 bytes there. which is correct.. ive wired a property node: bytes to read into the visa read but that says 0 bytes and i get a warning saying there could be more bytes at port.. when i wire a constant 7 to Visa read i just get a timeout error.. Any ideas as to why this is happening and how to get it to work???
Cheers
Kane
07-15-2011 01:43 AM
12-18-2013 08:01 AM
Dear GerdW,
Greetings...!!!
I have a problem
Please see the image above... This is for Modbus communication...
In the first VI, i have simply concatenated the three Hex strings... and the concatenated string is showing the correct string... This is what the result i need..
But in the second VI, I have simply converted the number (300) to the same hex string of first (012C), But the concatenated string 2 is showing a different value. Whenever I am trying to convert the number to hex string, i am getting this problem...
I need to implement the second option in my program but i dont know how to correct it...
Please help me and Kindly help me to get it corrected...
Thanks in advance...
12-18-2013 08:17 AM - edited 12-18-2013 08:19 AM
In your second piece of code, you are not converting correctly. If you had probed the output, you would see an ASCII string of "012C". Not at all the same thing when you select a string for hex display. You should be using a U16 and type cast. And please, post actual code. An image makes it harder to know what you are doing.
12-18-2013 08:30 AM
My ascii chart shows String litteral "012C" would be char array [0x30, 0x31, 0x32, 0x43]
Seams thats exactly what you are getting.
12-18-2013 09:20 AM
Dear Dennis_Knutson
How to attach the VI here...? When I try to attach it, it shows "The contents of the attachment doesnt match its file type"
12-18-2013 09:24 AM
What are you trying to attach? A VI should attach fine. So should a zip file. There were some recent problems but I think they are all straightened out. Another option is attaching a snippet. Snippets are special png files and are explained in the help.
In any case, your problem should be solved.
12-18-2013 09:27 AM
Herewith I am attaching the VI