02-14-2018 07:30 AM
Hi,
I Tried to store data in the table whenever the boolean is true and values are changing. The value to be stored is final iteration value of for loop. consider, while loop condition will always be false. Because this is not the actual case. This one is simplied to understand. In actual case, The while loop will continuously run to check plc coil status for every 500 ms and executes operation. The stop condition is used by the operator only at the end of the working shift.
The VI is attached. Kindly support me.
02-14-2018 08:29 AM
Can you be more specific about what trouble you're having? If you want to update the table in the loop then obviously you'll need to put the table somewhere inside the loop. To preserve the contents of the table from loop iteration to iteration, you can use a shift register or feedback node.
02-14-2018 09:18 AM
What you need here is a proper program architecture like a State Machine. Think about how your program needs to operate and break it down into steps, one or more of those steps will become a "state" in the state machine. Then jumping from state to state based on conditions or booleans is trivial.
02-15-2018 10:28 PM
Mr. arteitle,
I have attached the VIs for reference. I am able to get appended rows of data in data logging vi but not in Main8.VI. is the problem is due to modbus shift register ?.How do i get data in appended array or table in main8 VI. Or is it possible to index rows using feedback node. If it is possible give an example. .
Thanks
prabhu
02-16-2018 01:25 AM
Hi prabhu,
on "data logging":
- use BuildArray instead of InsertIntoArray
- put the BuildArray inside the case structure: you only want to concat data to the table in ths case…
How do i get data in appended array or table in main8 VI.
You need to wire the shift register data through ALL cases of your "state machine"!
Do you think you need to duplicate code? Why not use a subVI handling the ModBus value conversion?
And what's the point in converting a string to an U8 array, building a 2D array from it, getting the first row of this 2D array and converting the U8 array back to string? This is pure Rube-Goldberg!!!
(The other conversion stuff also looks very Rube-Goldbergish…)
02-16-2018 03:08 AM
Hi Gerdw,
Thanks for the reply,
And what's the point in converting a string to an U8 array, building a 2D array from it, getting the first row of this 2D array and converting the U8 array back to string? This is pure Rube-Goldberg!!!
I accept that and I removed it.
In my case shift register didnt go well, so I used feed back node. It worked well.