05-18-2020 03:07 AM
Hi Dear Members
I have a cluster of boolean data I want to send the data via VISA write function. How can I transfer each 8 boolean indicators as a byte to VISA write function?
Thanks
Solved! Go to Solution.
05-18-2020 03:18 AM - edited 05-18-2020 03:19 AM
05-18-2020 03:19 AM - edited 05-18-2020 03:20 AM
Oops, I misread the original post.
05-18-2020 04:40 AM - edited 05-18-2020 04:41 AM
Hi Mr GerdW
I have error "Polymorphic terminal cannot accept this data type"
see the attach image
thanks
05-18-2020 05:09 AM
Hi Laian,
then your cluster does not contain just boolean values!
Your question was:
How can I transfer each 8 boolean indicators as a byte
and I presented a solution to convert a cluster containing just 8 boolean values…
When your cluster contains more than just 8 booleans then use Unbundle(ByName) and BuildArray to create the boolean array instead of ClusterToArray!
05-18-2020 11:18 PM - edited 05-18-2020 11:55 PM
Hi dear members
Thanks Mr GerdW
another issue: for reading process by VISA as the attachment I have used unflatten from string to connect my cluster. as it is shown it gets 20 bytes from VISA read function and should convert these 160 bits to 160 boolean value. But it seems that it sets each byte for each boolean indicator instead of each bit to each boolean indicator?
thanks
Regards
05-19-2020 12:27 AM - edited 05-19-2020 12:30 AM
previous post edited:also I should add that I have corrected my cluster to 160 boolean control displays. just boolean not other types
thanks
05-19-2020 02:02 AM - edited 05-19-2020 02:02 AM
next edit: I have found that Labview stores a boolean data as a byte. So the question is how to change it for a single bit?
thanks
05-19-2020 02:23 AM - edited 05-19-2020 02:29 AM
Hi Laian,
@Laian wrote:
next edit: I have found that Labview stores a boolean data as a byte. So the question is how to change it for a single bit?
As is written in the LabVIEW help! (So you did read the help? :-))
Why do you need to change the way how LabVIEW handles boolean values internally?
I already have shown how to create a boolean array and to combine several bits into one byte: what is the real problem?
as it is shown it gets 20 bytes from VISA read function and should convert these 160 bits to 160 boolean value. But it seems that it sets each byte for each boolean indicator instead of each bit to each boolean indicator?
This seems to be the real problem:
Read those 20 bytes. Convert the string to an U8 array. Convert each U8 value into a boolean array. Concatenate all boolean arrays into a larger one holding all 160 bits:
Or read the help for TypeCast, especially the paragraph mentioning older "Early" versions of LabVIEW!
05-19-2020 05:14 AM - edited 05-19-2020 05:16 AM
Thanks it works on the array
but it doesn't show in my boolean cluster I/O.