(0)| 9/14/2023 5:06 AM | |
|
Joined: 1/21/2013 Last visit: 1/17/2026 Posts: 4405 Rating:
|
Hi Fresh Engineer, The ARRAY data type does not allow flexible array limits when declaring a memory area to store the date. ARRAY[*] is a data type that allows arrays to be handled with flexible limits, but only within a block where the parameter is passed as a reference. However, you can define an array variable with sufficient size and use a variable - which can be written by the HMI - to stop your algorithm which will handle the array data at the defined limit, instead of using the "UPPER_BOUND" instruction. Kind regards |
| 9/14/2023 6:06 AM | |
|
Joined: 2/14/2022 Last visit: 11/13/2025 Posts: 25 Rating:
|
Hi,
|
Last edited by: Fresh Engineer at: 09/14/2023 06:08:30"The harder you work, the luckier you get." |
|
| 9/14/2023 3:11 PM | |
|
Joined: 7/7/2010 Last visit: 1/16/2026 Posts: 16379 Rating:
|
In the PLC, that user constant "lim_set" defined as INT should be the largest allowed value the HMI can enter. For example, if no more than 100 items are allowed, set to 100. Then in the HMI, you can constrain the amount of the predefined array smaller by passing around the real upper bound. Just be sure the value set in the HMI is never larger than the actual upper bound. Do that in the HMI by constraining the allowed range of the INT being input. Additionally, never trust the HMI programmer (especially when the PLC and HMI programmer are the same person) to correctly constrain the range and in the PLC, if the HMI value exceeds the upper bounds, pop up an error or alert on the HMI and do not accept the HMI value into the running PLC logic.
|
|
science guy |
|
This contribution was helpful to
|
|
Follow us on