- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.
Posted: 2024-11-20 10:01 PM
Creating Arrays in ESME HVAC
Hi Guys,
I'm stuck while trying to create an Array with its size (Upper bound) being a EEPROM variable instead of a set constant value.
Here, Num_Units is an EEPROM variable which is also UINT. When I compile it, I got the following error.
If I replace the Num_Units with its value (eg: 10), it complies successfully and creates an array of size 11 (0-10). I tried declaring inside the ST program like the following, but the program does not allow me to do so:
How can I achieve this please? Any advice would be greatly appreciated. Thanks.
- Labels:
-
HVAC
- Tags:
- english
Link copied. Please paste this link to share this article on your social media post.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.
Posted: 2024-11-22 05:59 AM
Hi,
this is not supported, the size of an array has to be based on a constant value or a constant variable, because the space is allocated at compilation time.
You have to define the array with a size equal to the maximum value that can be assumed by your EEprom parameter and use just part of it when the EEprom value is lower than maximum.
Link copied. Please paste this link to share this article on your social media post.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Link copied. Please paste this link to share this article on your social media post.
Posted: 2024-11-22 05:59 AM
Hi,
this is not supported, the size of an array has to be based on a constant value or a constant variable, because the space is allocated at compilation time.
You have to define the array with a size equal to the maximum value that can be assumed by your EEprom parameter and use just part of it when the EEprom value is lower than maximum.
Link copied. Please paste this link to share this article on your social media post.

