LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Hex concatenating...

Solved!
Go to solution

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...

 

 

0 Kudos
Message 1 of 19
(2,169 Views)

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!  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 19
(2,139 Views)

No problem. Chapter 4 (page 208) is probably what you're looking for.

 

Thanks!

 

 

0 Kudos
Message 3 of 19
(2,129 Views)

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.

"If you weren't supposed to push it, it wouldn't be a button."
Message 4 of 19
(2,086 Views)

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.

0 Kudos
Message 5 of 19
(2,053 Views)

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

0 Kudos
Message 6 of 19
(2,040 Views)

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.

0 Kudos
Message 7 of 19
(2,036 Views)

@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).

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 8 of 19
(2,020 Views)

@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.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 9 of 19
(2,015 Views)
Solution
Accepted by topic author plasmageek

Hi geek,

 

why don't you just put the needed bytes (aka U8 values) into a byte array as described?

 

Another way of achieving the same result:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Download All
Message 10 of 19
(1,988 Views)