Automatic assignment of external variable

Für Themen rund um logi.RTS und logi.CAD 3
Post Reply
mirko.comparetti
Posts: 36
Joined: 04 Jun 2018, 11:01
Location: Lomazzo

Automatic assignment of external variable

Post by mirko.comparetti »

Hello,
I have a string variable that contains the name of an external variable. How can I use the value of that string to get the proper value from the external?

The pseudocode of what I'd like to do is here

Code: Select all

PROGRAM someProgram
	VAR
		someString : STRING[50];
		someWord : WORD;
	END_VAR
	VAR EXTERNAL
		someExternalA : WORD;
		someExternalB : WORD;
	END_VAR
	
	someString := 'someExternalA';
	
	someWord := SOMEGET(IN := someString); //GET THE VALUE OF someExternalA
	
	someString := 'someExternalB';
	
	someWord := SOMEGET(IN := someString); //GET THE VALUE OF someExternalB
END_PROGRAM
so basically I'd like to find a way to assign the proper value to

Code: Select all

someWord
based on the content of

Code: Select all

someString
using a method

Code: Select all

SOMEGET(IN := someString);
(or something similar).

Thanks
Post Reply