Quantcast
Viewing latest article 17
Browse Latest Browse All 83468

JavaScript Scripting Issue – Writing Integer to Internal Tag Prevents Bit Toggle

Hi everyone, I'm working on JavaScript scripting in WinCC Unified and encountered an issue when handling tag operations. I need to: Read the status of two tags (one internal and one external). Toggle the external bit tag. Write an integer value to the internal tag. I can successfully toggle the bit tag, but when I add the step to write an integer value to the internal tag, the bit toggle stops working. Here’s my script: export function gfxStateContentboard5_1_OnTapped(item, x, y, modifiers, trigger) { let ToggleTag = Tags("Machine_VFD_Cmd_ManModeSelected"); let MachineSts = tags("MachineState"); let ToggleTagVal = ToggleTag.Read(); //............................... if (ToggleTagVal) { ToggleTag.Write(false); MachineSts.write(4); } else { ToggleTag.Write(true); MachineSts.write(1); } }

Viewing latest article 17
Browse Latest Browse All 83468

Trending Articles