Ones_Zeros Member O Join Date Feb 2014 Location at work Posts 367 Apr 7, 2018 #1 How is the best way to toggle 2 bits in PLC with one button in Wonderware? Preferably without having to script it? Thanks
How is the best way to toggle 2 bits in PLC with one button in Wonderware? Preferably without having to script it? Thanks
VAN Member V Join Date Apr 2012 Location Wa Posts 509 Apr 7, 2018 #2 ONS to the PLC and have the code to control the toggle in the PLC.
lostcontrol Lifetime Supporting Member L Join Date May 2009 Location NeverSayNever Posts 1,069 Apr 8, 2018 #3 No other way than scripting it.. Assume your using SP (based on previous posts..) Perhaps cleanest way is to have a data change script, then to the toggle in the script, with last line making the second tag = the first. But, as we seem to miss often, why the need to toggle 2x tags. ??
No other way than scripting it.. Assume your using SP (based on previous posts..) Perhaps cleanest way is to have a data change script, then to the toggle in the script, with last line making the second tag = the first. But, as we seem to miss often, why the need to toggle 2x tags. ??
Bit_Bucket_07 Member Join Date Feb 2013 Location Southeast US Posts 1,875 Apr 8, 2018 #4 Ones_Zeros said: How is the best way to toggle 2 bits in PLC with one button in Wonderware? Preferably without having to script it? Thanks Click to expand... Assign Bit1 to a toggle pushbutton and write one line of code in the PLC to make Bit2 = Bit1.
Ones_Zeros said: How is the best way to toggle 2 bits in PLC with one button in Wonderware? Preferably without having to script it? Thanks Click to expand... Assign Bit1 to a toggle pushbutton and write one line of code in the PLC to make Bit2 = Bit1.
NetNathan Lifetime Supporting Member N Join Date Nov 2011 Location Corona, CA Posts 2,199 Apr 8, 2018 #5 Action script on button up.. Bit 1 = 1 Bit 2 = 2
Bit_Bucket_07 Member Join Date Feb 2013 Location Southeast US Posts 1,875 Apr 8, 2018 #6 NetNathan said: Action script on button up.. Bit 1 = 1 Bit 2 = 2 Click to expand... I'd go with: Bit1 = NOT Bit1; Bit2 = NOT Bit2; On either button down or button up.
NetNathan said: Action script on button up.. Bit 1 = 1 Bit 2 = 2 Click to expand... I'd go with: Bit1 = NOT Bit1; Bit2 = NOT Bit2; On either button down or button up.
NetNathan Lifetime Supporting Member N Join Date Nov 2011 Location Corona, CA Posts 2,199 Apr 8, 2018 #7 NetNathan said: Action script on button up.. Bit 1 = 1 Bit 2 = 2 Click to expand... Was I nuts on this...."Bit2 = 2"???? This is better route: ********** If Bit 1 =1 THEN Bit 1 = 0 Bit 2 = 1; ELSE IF Bit 1 = 0 THEN Bit 1 = 1 Bit 2 = 0; ENDIF; ENDIF; ********** This is a simple button script... Is there a reason not use a script?
NetNathan said: Action script on button up.. Bit 1 = 1 Bit 2 = 2 Click to expand... Was I nuts on this...."Bit2 = 2"???? This is better route: ********** If Bit 1 =1 THEN Bit 1 = 0 Bit 2 = 1; ELSE IF Bit 1 = 0 THEN Bit 1 = 1 Bit 2 = 0; ENDIF; ENDIF; ********** This is a simple button script... Is there a reason not use a script?
NetNathan Lifetime Supporting Member N Join Date Nov 2011 Location Corona, CA Posts 2,199 Apr 8, 2018 #8 Bit_Bucket_07 said: I'd go with: Bit1 = NOT Bit1; Bit2 = NOT Bit2; On either button down or button up. Click to expand... What do you do if both bits in plc = 0 or 1? Last edited: Apr 8, 2018
Bit_Bucket_07 said: I'd go with: Bit1 = NOT Bit1; Bit2 = NOT Bit2; On either button down or button up. Click to expand... What do you do if both bits in plc = 0 or 1?
Mara Member M Join Date Jan 2017 Location Finland Posts 86 Apr 9, 2018 #9 NetNathan said: What do you do if both bits in plc = 0 or 1? Click to expand... Maybe code should be: IF <button> THEN BIT1:= 1; BIT2:= 0; ELSE BIT1:= 0; BIT2:= 1; END_IF
NetNathan said: What do you do if both bits in plc = 0 or 1? Click to expand... Maybe code should be: IF <button> THEN BIT1:= 1; BIT2:= 0; ELSE BIT1:= 0; BIT2:= 1; END_IF
CommissioningMan Member C Join Date Sep 2017 Location Denmark Posts 146 Apr 9, 2018 #10 NetNathan said: What do you do if both bits in plc = 0 or 1? Click to expand... Both will just be inverted. Mara said: Maybe code should be: IF <button> THEN BIT1:= 1; BIT2:= 0; ELSE BIT1:= 0; BIT2:= 1; END_IF Click to expand... Now you are just setting bit 1 high as long as you keep the button pressed, and bit 2 high when you release it, what's the point of that? Am I missing something or isn't it just a question of toggling two bits from one command?
NetNathan said: What do you do if both bits in plc = 0 or 1? Click to expand... Both will just be inverted. Mara said: Maybe code should be: IF <button> THEN BIT1:= 1; BIT2:= 0; ELSE BIT1:= 0; BIT2:= 1; END_IF Click to expand... Now you are just setting bit 1 high as long as you keep the button pressed, and bit 2 high when you release it, what's the point of that? Am I missing something or isn't it just a question of toggling two bits from one command?
Bit_Bucket_07 Member Join Date Feb 2013 Location Southeast US Posts 1,875 Apr 9, 2018 #11 NetNathan said: What do you do if both bits in plc = 0 or 1? Click to expand... That script would invert the two bits regardless of their original state. I understood the OP to be asking how to toggle two bits at once. I never got the impression that the OP wanted the two bits in question to always maintain opposite states.
NetNathan said: What do you do if both bits in plc = 0 or 1? Click to expand... That script would invert the two bits regardless of their original state. I understood the OP to be asking how to toggle two bits at once. I never got the impression that the OP wanted the two bits in question to always maintain opposite states.
Mara Member M Join Date Jan 2017 Location Finland Posts 86 Apr 9, 2018 #12 CommissioningMan said: Now you are just setting bit 1 high as long as you keep the button pressed, and bit 2 high when you release it, what's the point of that? Am I missing something or isn't it just a question of toggling two bits from one command? Click to expand... Yeah, you are right with this. Sorry
CommissioningMan said: Now you are just setting bit 1 high as long as you keep the button pressed, and bit 2 high when you release it, what's the point of that? Am I missing something or isn't it just a question of toggling two bits from one command? Click to expand... Yeah, you are right with this. Sorry
NetNathan Lifetime Supporting Member N Join Date Nov 2011 Location Corona, CA Posts 2,199 Apr 9, 2018 #13 I guess we lost the OP....