08-07-2020 11:20 AM
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!!!
08-07-2020 10:08 PM - edited 08-07-2020 10:08 PM
Simpler
08-08-2020 10:01 AM
@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.
08-08-2020 10:29 AM - edited 08-08-2020 10:48 AM
I typically slightly complicate it by using a well named typedef (not shown) cluster and "bundle by name".
Advantage:
A typedef cluster also makes it easy to go the other way:
(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.)
08-08-2020 10:44 AM
@altenbach wrote:
I typically slightly complicate it by using a well named typedef (not shown) cluster and "bundle by name".
Advantage:
- Self-documenting
- You'll get coercion dots if you wire a constant with the wrong representation
- Defaults value can be set in the cluster, no need to wire them as constants.
- etc.
Well, yes. That's really the way I do it, but the general idea was what I was in agreement with. 🙂
08-08-2020 08:59 PM
@altenbach wrote:
I typically slightly complicate it by using a well named typedef (not shown) cluster and "bundle by name".
Advantage:
- Self-documenting
- You'll get coercion dots if you wire a constant with the wrong representation
- Defaults value can be set in the cluster, no need to wire them as constants.
- etc.
A typedef cluster also makes it easy to go the other way:
(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:.
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.
08-08-2020 11:52 PM
@paul_cardinale wrote:
@altenbach wrote:
I typically slightly complicate it by using a well named typedef (not shown) cluster and "bundle by name".
Advantage:
- Self-documenting
- You'll get coercion dots if you wire a constant with the wrong representation
- Defaults value can be set in the cluster, no need to wire them as constants.
- etc.
A typedef cluster also makes it easy to go the other way:
(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:.
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...
08-10-2020 05:49 AM - edited 08-10-2020 05:49 AM
Hi Paul,
@paul_cardinale wrote:
I like to arrange my clusters like this:.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:
08-11-2020 06:06 PM
I love this solution with the added constant to document everything.
Thanks for all the great solutions!