Page 1 of 1

one-state button

PostPosted: Wed 16. Nov 2016 13:38:28
by klopot
Hello,
could You provide me with a simple working example of setting one bit in PLC on press of one-state button? (onButtonDown method for example).
I've tried defining methods for panel, methods for data, for pmfolder and calling them from button events but neither of them worked.
PLC is S7-1200, communication is working, two state buttons are working too.
But I need a momentary set button as trigger.
Regards
Klopot

Re: one-state button

PostPosted: Wed 23. Nov 2016 14:50:15
by admin
Dear Klopot,

You need to write a method into the onButtonDown event that uses the SetBit function - see more details here:

http://www.promotic.eu/en/pmdoc/Objects ... SetBit.htm

Example:

dim oVal
set oVal = pMe.Pm(here enter the path to variable in PmData object that is bound e.g. by data extension ExtComm with the variable in the PLC device you want to write to)
oVal.Value = Pm.SetBit(oVal.Value, 4, True)

More detail regarding ExtComm data extension:
http://www.promotic.eu/en/pmdoc/Objects ... xtComm.htm