08-05-2020 04:49 PM
I realize there are a slew of posts about this, and I've been through a ton of them. I've gotten close to my solution, but I'm just shy of what I need. Here's the jist:
I need to send a serial command to a camera and it has to be in hex; the first part is given. It's a write command, followed by an address command: 5705 48...
The remaining part I need to create myself, by turning a number into hex (and it has a specified length). I finally got my number to go into a string that when displayed in hex displays the correct value and length. However, when I concatenated it with a string (in hex format), it came out wrong...And I don't know why...
Solved! Go to Solution.
08-05-2020 05:47 PM
It would be extremely helpful if you could upload the manual here, or at least cut and paste the part that describes the message structure.
Thanks! 🙂
08-05-2020 05:55 PM
No problem. Chapter 4 (page 208) is probably what you're looking for.
Thanks!
08-05-2020 10:03 PM
Your code doesn't convert anything to hex. The TypeCast function merely changes the interpretation of the bits.
The "Hex in Hex" indicator is showing hex because you've set that to be the display format; the conversion to hex occurs only inside the indicator, the data is still binary. You probably want this: functions -> Programming -> String -> Number/String Conversion -> Number to Hexadecimal String.
08-06-2020 09:24 AM - edited 08-06-2020 09:25 AM
Number to hexidecimal string gives you an ASCII string with the Hex code (this is the number one issue in most of the forum posts). You can't combine it with a Hex code, and if you try to display it as 'hex' you get the wrong code, b/c it's an ASCII format.
My understanding of what I need is when viewed in 'hex' is the code that I have. I need to combine it with the other hex code, and when I view it (in hex) it should be the hex code that I need in total, so that when it sends and is converted to Hex, it is converted to the correct Hex code.
08-06-2020 12:11 PM
Have you tried connecting your camera to your PC (I presume via an Ethernet cable?) and seeing if MAX can see it? According to the manufacturer, it supports GigE Vision, hence should be compatible with IMAQdx.
Bob Schor
08-06-2020 12:54 PM
Hi Bob,
Yes, I can fully talk to the camera via MAX (we had to custom write the .icd file) through a frame grabber. The only thing I can't get the file generator to do properly is set the exposure to a (random) time. I've put into the .icd file some commands for generic exposure times, but ideally we'd like to be able to tailor it case by case. As I understand it, the only way to do this is by sending the commands over serial, which means I need to ensure the formatting when converted to hex is correct.
It seems like the commands I'm using are nearly there, I have my two pieces of hex data, but they're just not combining together in such a way that the hex command is correct.
08-06-2020 03:30 PM
@plasmageek wrote:
Number to hexidecimal string gives you an ASCII string with the Hex code (this is the number one issue in most of the forum posts). You can't combine it with a Hex code, and if you try to display it as 'hex' you get the wrong code, b/c it's an ASCII format.
My understanding of what I need is when viewed in 'hex' is the code that I have. I need to combine it with the other hex code, and when I view it (in hex) it should be the hex code that I need in total, so that when it sends and is converted to Hex, it is converted to the correct Hex code.
What are you really trying to say? Hex is always ASCII or (Unicode).
08-06-2020 03:34 PM
@plasmageek wrote:
Number to hexidecimal string gives you an ASCII string with the Hex code (this is the number one issue in most of the forum posts). You can't combine it with a Hex code, and if you try to display it as 'hex' you get the wrong code, b/c it's an ASCII format.
My understanding of what I need is when viewed in 'hex' is the code that I have. I need to combine it with the other hex code, and when I view it (in hex) it should be the hex code that I need in total, so that when it sends and is converted to Hex, it is converted to the correct Hex code.
You seem to be misusing the word "Hex". Which makes it impossible to figure out what you are trying to say.
Hexadecimal is always a string, wherein each character represents the numeral for one digit.
08-07-2020 01:33 AM - edited 08-07-2020 01:42 AM