LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Bidirectional connection between array and controls

Solved!
Go to solution

Hi Mark

So what is your suggestion?

Imagine you want to monitor the variables and flags of your software code of Micro to verify its execution and you don't have any hardware platform to test the code and just Labview can help you 🙂

Thanks

0 Kudos
Message 11 of 40
(1,970 Views)

Hi Laian, 

 

When you read the values from VISA, are you getting them all as a single string?

 

Then you're parsing this string into the 300 variables (values, flags etc) and populating controls via local variable?

 

It's already been said several times that grouping your controls where possible will make your code much simpler to deal with.

 

It might also be useful to consider whether other string formatting tools and array/cluster manipulations can reduce the work processing the variables (e.g. Array to Spreadsheet String perhaps, or the Array to Cluster you mentioned).

 

Can you show your code? Or a demonstration with maybe ~10 controls and the same method, with a string saved as default for the input?


GCentral
Message 12 of 40
(1,957 Views)

Hi Cbutcher

this is my VI for just 4 bytes. Now I am trying to do it with cluster as I want to be able to move the control cells wherever I want on the control panel separately  

Thanks

0 Kudos
Message 13 of 40
(1,953 Views)

Hi GerdW

@GerdW wrote:

You don't need the ClusterToArray function to read/write data from/to a cluster. You need (Un)Bundle(ByName)…

 

how to connect VISA read buffer to cluster?

Thanks

0 Kudos
Message 14 of 40
(1,933 Views)

Hi all members

how to connect visa read buffer to a cluster?

I want to display the serial data on a cluster with several controls instead of an array

thanks to all

0 Kudos
Message 15 of 40
(1,963 Views)

Can you post some code that you have done so far so we can getter a better idea of what you are trying to achieve. 

as a starting point look and the bundle by name function in the clusters palette. To help Lear how you use it look at the detailed help for that function (make sure the help window is visible, Ctrl +H, hover over the bundle by name and press detailed help. 

also. I imagine there will be some data parsing. Converting the data from the serial buffer to whatever you have in your cluster. Without know what data you are working with it is difficult to offer any advice 

Message 16 of 40
(1,963 Views)

Hi Niatross

Thanks for your reply. Imagine for getting 4 bytes from visa serial and showing on control displays of cluster what should I do?

I have done it with array (in the attachment) but I want to know how it would be done by clusters?

Thanks

0 Kudos
Message 17 of 40
(1,947 Views)
Solution
Accepted by topic author Laian

Hi Laian,

 


@Laian wrote:

Hi Cbutcher

this is my VI for just 4 bytes.


This is very convoluted…

No need to check if you really read 4 bytes: either you get your 4 bytes or you get an error…

No need to check if you really wrote 4 bytes: the bytes will be written to the serial port buffer - or you get an error…

No need for the sequence frame.

No need for two (different) wait statements in the loop…

No need for all those coercion dots!

Are you reading/writing just bytes (U8) from/to your microcontroller? Are there any other datatypes involved?

 

It would be much better when you could give an example of the data structure you are transporting with those 300 values. This way we can give examples on how to decode that data structure from the string and how to convert back to string after modification…

 

Edit:

Laian, please don't start the very same question in several threads! Keep discussion in one place!

 

Example for using a cluster:

check.png(using UnflattenFromString)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 18 of 40
(1,933 Views)

@Laian wrote:

Hi Mark

So what is your suggestion?

Imagine you want to monitor the variables and flags of your software code of Micro to verify its execution and you don't have any hardware platform to test the code and just Labview can help you 🙂

Thanks


Without knowing your specific data it is hard to say what would work best. Some suggestions though would be to use a table or a tree to display the data. If you simply want to view a larger piece of memory from the micro controller then I would use a string indicator and display the data as hex values. Somewhere I have some code that formats binary data and displays it similar to what you see in something like Wireshark. The data includes "addresses" so it is easy to look through a large buffer. Some of your data might be best display as some clusters. Another approach would be to use a tab structure and break you data up into more meaningful pieces and have a tab for each group of data.

 

When designing a UI the general rule of thumb is that after about 7 pieces of important data, people start to lose focus of what they are seeing.Having 300 controls is simply too complicated to really be meaningful to anyone.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 19 of 40
(1,920 Views)

Hi Laian,

 


@GerdW wrote:

It would be much better when you could give an example of the data structure you are transporting with those 300 values. This way we can give examples on how to decode that data structure from the string and how to convert back to string after modification…


As Gerd said, there's actually not really any "handling" per-say in your uploaded VI.

That makes it more or less impossible to suggest changes.

 

Below is a possible example for handling a fictional collection of bytes. Obviously this won't directly work for your code, since I made up the values...

Decode ValuesDecode Values

 

Here is the VI to produce the string I used. Of course, this is probably the code equivalent to that on your microcontroller:

Encode ValuesEncode Values

 

Your code is probably very different, but this hopefully shows at least one way to split values into multiple controls (including clusters) and then display them in more useful blocks.

 

If you show us a more realistic version of your code, maybe we could show you various ways to handle it.


GCentral
Message 20 of 40
(1,876 Views)