Page 1 sur 1

Indexage Variable HMI Tia Portal V17

Posté : 01 déc. 2023, 11:31
par divxera
Bonjour,

Je souhaites faire une seule vue qui gère 20 éléments d'un tableau.
Ma valeur d'index est attribuée sur ma première vue par simplement un bouton (Bt1 = 1, Bt2 = 2 etc)
Mon tableau dans le DB est un array 1..20.

Quand ma valeur d'index dans la variable Interne HMI est à 1, il prend l'élément tableau 2 dans le DB ainsi de suite.

Donc un décalage de 1. Je suppose que c'est normal mais il doit y avoir une explication qui est sans doute basic :lol:

Merci.

Edit: Je fais démarré une variable à partir de 0 ainsi c'est bon mais c'est bricole non...

Re: Indexage Variable HMI Tia Portal V17

Posté : 03 déc. 2023, 21:00
par divxera
Bonsoir,

Trouvé sur un tuto (dmcinfo) concernant l'indexage et cette personne informe que:

(Je cites) 'One more helpful hint - you will find that your index on the HMI will be zero based, regardless of the way you define your array on the PLC. For example, if I defined my array (on the PLC) to be [1 .. 20], an "Index" of 0 will actually access the first element, [1], in my array.'

Donc ok, normal.
Maintenant, quelle est la cause technique exact ...

Merci.