From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Hex concatenating...

Solved!
Go to solution

Thank you! I was completely lost in all this byte/hex talk and was just trying to piece together what seemed like the obvious solution and what I found in other forum posts. This is simple, easy to follow and most importantly IT WORKS!!!

0 Kudos
Message 11 of 19
(748 Views)
Message 12 of 19
(729 Views)

@RavensFan wrote:

Simpler

 


This is the way I usually end up doing it, but I always make sure the output is correct, mostly because I'm paranoid that I will eventually find a case where it doesn't work.

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 13 of 19
(712 Views)
Solution
Accepted by plasmageek

I typically slightly complicate it by using a well named typedef (not shown) cluster and "bundle by name".

 

Advantage:

  1. Self-documenting
  2. You'll get coercion dots if you wire a constant with the wrong representation
  3. Defaults value can be set in the cluster, no need to wire them as constants.
  4. etc.

 

altenbach_0-1596900333619.png

 

 

 

A typedef cluster also makes it easy to go the other way:

 

altenbach_0-1596901242152.png

(NOT SHOWN: Of course you might want to do some validation, e.g. check the string length, etc. Note that "unflatten from string" would have "error" and "remaining string" outputs and is a little bit safer. Similarly, use "flatten to string". You can even set the byte order.)

 

Message 14 of 19
(708 Views)

@altenbach wrote:

I typically slightly complicate it by using a well named typedef (not shown) cluster and "bundle by name".

 

Advantage:

  1. Self-documenting
  2. You'll get coercion dots if you wire a constant with the wrong representation
  3. Defaults value can be set in the cluster, no need to wire them as constants.
  4. etc.

 

altenbach_0-1596900333619.png

 


Well, yes.  That's really the way I do it, but the general idea was what I was in agreement with.  🙂

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 15 of 19
(704 Views)

@altenbach wrote:

I typically slightly complicate it by using a well named typedef (not shown) cluster and "bundle by name".

 

Advantage:

  1. Self-documenting
  2. You'll get coercion dots if you wire a constant with the wrong representation
  3. Defaults value can be set in the cluster, no need to wire them as constants.
  4. etc.

 

altenbach_0-1596900333619.png

 

 

 

A typedef cluster also makes it easy to go the other way:

 

altenbach_0-1596901242152.png

(NOT SHOWN: Of course you might want to do some validation, e.g. check the string length, etc. Note that "unflatten from string" would have "error" and "remaining string" outputs and is a little bit safer. Similarly, use "flatten to string". You can even set the byte order.)

 


I like to arrange my clusters like this:c.png.

To do that automatically, place the attached file in C:\ ... \LabVIEW ????\Project\.  After that, you'll be able to select the cluster and chose "Arrange Cluster Constant Nicely" from the tools menu.

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

@paul_cardinale wrote:

@altenbach wrote:

I typically slightly complicate it by using a well named typedef (not shown) cluster and "bundle by name".

 

Advantage:

  1. Self-documenting
  2. You'll get coercion dots if you wire a constant with the wrong representation
  3. Defaults value can be set in the cluster, no need to wire them as constants.
  4. etc.

 

altenbach_0-1596900333619.png

 

 

 

A typedef cluster also makes it easy to go the other way:

 

altenbach_0-1596901242152.png

(NOT SHOWN: Of course you might want to do some validation, e.g. check the string length, etc. Note that "unflatten from string" would have "error" and "remaining string" outputs and is a little bit safer. Similarly, use "flatten to string". You can even set the byte order.)

 


I like to arrange my clusters like this:c.png.

To do that automatically, place the attached file in C:\ ... \LabVIEW ????\Project\.  After that, you'll be able to select the cluster and chose "Arrange Cluster Constant Nicely" from the tools menu.


I just skip all that and use the icon.  At that point, I'm more interested in what it is than what's inside it...

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 17 of 19
(667 Views)

Hi Paul,

 


@paul_cardinale wrote:

I like to arrange my clusters like this:c.png.

To do that automatically, place the attached file in C:\ ... \LabVIEW ????\Project\.  After that, you'll be able to select the cluster and chose "Arrange Cluster Constant Nicely" from the tools menu.


Thanks for this VI.

Small bug report: It mostly works, but has problems to align array constants inside the cluster:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 18 of 19
(637 Views)

I love this solution with the added constant to document everything.

 

Thanks for all the great solutions!

0 Kudos
Message 19 of 19
(612 Views)