Welcome, Guest
Username: Password: Remember me

TOPIC: Global variables

Global variables 1 year 1 week ago #1227

  • flitec
  • flitec's Avatar
  • Offline
  • New Member
  • Posts: 3
  • Thank you received: 1
  • Karma: 0
Good morning
Is there any way to declare "global" variables/array in ST language, I mean variables/arrays that are visible for the whole project?
Thanks and best regards
The administrator has disabled public write access.

Global variables 1 year 1 week ago #1228

  • fatkhrus
  • fatkhrus's Avatar
  • Offline
  • Administrator
  • Posts: 534
  • Thank you received: 73
  • Karma: -112
Hello,

If you want to declare variables for the whole project including graphical part it’s better to declare local tags (without binding to PLC).
If you want to declare global variables only for ST scripts you can use global arguments: teslascada.com/HTML/global-arguments-library.html

Best regards,
Ruslan
The administrator has disabled public write access.

Global variables 1 year 1 week ago #1229

  • flitec
  • flitec's Avatar
  • Offline
  • New Member
  • Posts: 3
  • Thank you received: 1
  • Karma: 0
Thanks Fatkhrus for your answer,
some more questions......
if I understood well is not possible to declare an array as global argument....
In ST scripts I can access a tag array ...array[n]=Tags.name but how can I write back an item in tag array ?..... I mean Tags.name=value
Last....is it possbile to pass arrays in userdefined functions?
Thanks for your collaboration
The administrator has disabled public write access.

Global variables 1 year 1 week ago #1230

  • fatkhrus
  • fatkhrus's Avatar
  • Offline
  • Administrator
  • Posts: 534
  • Thank you received: 73
  • Karma: -112
Hello,

Yes it's not possible to write array to the global arguments. Only its elements.
To write back you can make simple assignment like Tags.Tag = array. See attached example picture and project.
About user-defined functions. Yes, you can use arrays like an argument. See attached example picture.





File Attachment:

File Name: tagsarray.tsp2.zip
File Size:2 KB


Best regards,
Ruslan
The administrator has disabled public write access.
Go to top