06-29-2015 10:34 AM
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
Solved! Go to Solution.
06-29-2015 11:11 AM - edited 06-29-2015 11:13 AM
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.
06-29-2015 11:13 AM
Hey Altenbach, I have 2014.
06-29-2015 11:14 AM
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.
06-29-2015 11:22 AM
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
06-29-2015 11:26 AM
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.
06-29-2015 11:27 AM
Many thanks guys
06-29-2015 05:20 PM
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.
06-29-2015 05:33 PM
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?
06-29-2015 05:51 PM
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)