[phpBB Debug] PHP Warning: in file [ROOT]/includes/session.php on line 214: htmlspecialchars(): charset `set_var' not supported, assuming utf-8
[phpBB Debug] PHP Warning: in file [ROOT]/includes/session.php on line 215: htmlspecialchars(): charset `set_var' not supported, assuming utf-8
[phpBB Debug] PHP Warning: in file [ROOT]/includes/session.php on line 216: htmlspecialchars(): charset `set_var' not supported, assuming utf-8
[phpBB Debug] PHP Warning: in file [ROOT]/includes/session.php on line 87: htmlspecialchars(): charset `set_var' not supported, assuming utf-8
[phpBB Debug] PHP Warning: in file [ROOT]/includes/session.php on line 129: htmlspecialchars(): charset `set_var' not supported, assuming utf-8
[phpBB Debug] PHP Warning: in file [ROOT]/includes/session.php on line 130: htmlspecialchars(): charset `set_var' not supported, assuming utf-8
[phpBB Debug] PHP Warning: in file [ROOT]/includes/session.php on line 1685: htmlspecialchars(): charset `set_var' not supported, assuming utf-8
PROMOTIC FORUM • View topic - Transform loaded from PLC variable

Transform loaded from PLC variable

This is the main technical forum for discussing problems that were encountered by users while developing PROMOTIC applications, and their possible solutions.

Transform loaded from PLC variable

Postby roman66 » Fri 09. Aug 2024 15:54:54

Hi,
i need to do the byte swap of variable, what i get from Siemens PLC.
with 2 variable its work:
pMe.Pm("/Data/#vars/v1").Value = Pm.TransformValue(pMe.Pm("/Data/#vars/v1_raw").Value, 1)

i don't understand - how it must work with 1 variable, same variable what i read from PLC to PmaData with comm.data extension?
newbie
PM 9.0.28.0 64bit
roman66
 
Posts: 14
Joined: Tue 09. Jul 2024 12:07:38

Re: Transform loaded from PLC variable

Postby Petr Návrat » Tue 13. Aug 2024 13:00:45

If you want to read a 2-byte variable from a Simatic PLC (I assume using the PmS7 driver)
and as a result you want to have a swapped value (12->21) in the variable in the PmaData object,
then the best is:
do not use the data extension,
place the variable in the PmaCommGroup
and in the onDataReceive event convert the value of this variable using Pm.TransformValue(v,1)
and assign it to the variable in PmaData without using the data extension.

Petr Návrat
navrat@microsys.cz
Petr Návrat
Administrátor
 
Posts: 100
Joined: Thu 13. Dec 2012 14:32:08


Return to I don't know how to...

Who is online

Users browsing this forum: No registered users and 4 guests

cron