LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Manipulati​ng array

Solved!
Go to solution

 

 Register name                                                                                                      type              modbus location

FAULT uint16_t 300004
TEMPA uint8_t None
TEMPB uint8_t None
TEMPA/TEMPB uint16_t 300005

 

 

I'd like to search through a string array and if i find a uint8 variable I'd like to create a new row entry which is TEMPA/TEMPB   MSB,LSB uint16 like above.

Then continue the search. I have 300 variables in this string array and need to pull out all of the unit8 variables in this fashion and put them into uint16 for modbus registers transmission.

I dont need to append to the current array, creating a new array from the old one is preffered. 

I can then search through the final array and link the uint16s with modbus registers if  location != none 

 

How can i do this ? Any ideas?

 

James

0 Kudos
Message 1 of 15
(5,356 Views)
Solution
Accepted by topic author jamesy777

Autoindex on the 2D array, get the second element (index=1), do the pattern match on it, and autoindex on a conditional output tunnel whenever the type is correct. What LabVIEW version do you have?

 

Typically, you shoud provide more detail. Do you have a 2D array with three colums? Do you have a 2D array where each element contains 3 fields seperated by delimiters? Easiest would be if you could attach a small VI containing typical input data as a diagram constant.

0 Kudos
Message 2 of 15
(5,334 Views)

Hey Altenbach, I have 2014.

0 Kudos
Message 3 of 15
(5,331 Views)

OK, that means you have conditional tunnels and you should be all set.

If you have problems, follow the advice at the end of my earlier message.

0 Kudos
Message 4 of 15
(5,327 Views)

This is a 2D array of strings. I didnt know about conditional tunnels, that means the new array is only added to when my case selector is true, excellent.

Basic question, whats the best way to store my msb, lsb names between auto index loops? Local variables? I'm thinking shift registers?

James

0 Kudos
Message 5 of 15
(5,316 Views)
Solution
Accepted by topic author jamesy777

jamesy777 wrote:  Basic question, whats the best way to store my msb, lsb names between auto index loops? Local variables? I'm thinking shift registers?

Definately shift registers.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 15
(5,312 Views)

Many thanks guys

0 Kudos
Message 7 of 15
(5,308 Views)

So i used a counter and a shift register to attempt solve this issue.When the system detects a uint8_t array entry then counter ++. When counter == 2  a Sub-VI is called(BuildUInt32Array)  which appends UINT32 values to a new array.

My plan is to add OutPutArray and UINT32Array together at the end.

I'm sure there is a much neater way to do this.

 

The overall goal is to create shared variables for the labview DSC module which does not support uint8 variables. I have to go ahead and feed it uint16 variables created from 2 uint8 variables.

I'm trying to create a master table to use for the variable binding and deployment . ( I included an excel sheet of what Im trying to do)

 

Problem: My Uint32ARRAY is blank with "conditional indexing" unless i select "last value". but then i only see the last row.

 

In general the problem I face is how to initialize my counter shift register back to 0.  I check counter == 2 to make the conditonal tunnel decision, then i need to reset it.

 

I included my labview VIs and project. The Main VI is called ArrayManipDebugv001a, the rest are subVIs. 

Any ideas would be great. I sure there is a way to avoid using 2 arrays, one array would be great.

 

James. 

0 Kudos
Message 8 of 15
(5,229 Views)

Please use plain zip files, not everybody has 7zip

 

Also try to reduce the problem to a manageable size. we don't want to wade through gigantic oversized diagram jost to try to figure out where your problem is. 

 

Seems most of the question is handled by the first FOR loop. What is the purpose of the shift registers and why aren't they initialized?

0 Kudos
Message 9 of 15
(5,220 Views)

No problem. I'm learning how to use forums as well as labview. Yes the problem is all in the first for loop.

 

The counter shift reg in the for loop is a plain old counter. When it reaches 2 the case structure triggers to create a row in the array UINT32Array.

The top Pink shift reg stores the current register name and the name from the previous iteration. it's used by the subVI to create : TEMP_C/TEMP_D for example. So "previous register name" / "current register name"

The bottom pink shift register is used to store the modbus location from the previous iteration. ( the Uint32 always uses this modbus address)

 

They aren't initialized becuase i didnt know they had to be. I'm guessing I wire up indicators with defaults set to 0 ? 

I also have a typo ( Uint32 references should be called Uint16)

0 Kudos
Message 10 of 15
(5,212 Views)