Currently i am working on a new project for which im using Unitronics vision oplc ide .This is my first time using unitronics plc . I have a doubt , while i'm using invertbit,would the object be a NC toggle switch or a NO toggle switch and why?
-
2Please use capital letters and punctuation correctly so we know where sentences start and end, so that we can identify proper nouns (brand names) and so that you respect your readers. Link to any relevant manuals in your question. Welcome to EE.SE. – Transistor Mar 21 '21 at 20:32
2 Answers
On a PLC, your physical switch stays the same. It is either Normally Closed, or Normally Open. When you do something with it in software, the physical switch remains exactly the same type as before and the name doesn't change. If you invert the input, it is now an inverted NC or inverted NO. The original designation doesn't change.

- 376
- 1
- 6
It is hard for me to understand on whether you are referring to a real life hardware toggle switch or an analog ladder diagram instruction. An NC contact instruction in ladder diagram or NC toggle switch as you would say, is basically the same as inverting the logic of a digital input. So in that case, inverting the bit would be the same like using an NC contact instruction in ladder diagram.
The answer to why is this the case could be described by a simple example. Imagine you have a digital input X1 and the following program:
If you have a logic 0 at the X1 input then the lightbulb would be turned on because the contact would remain closed. If you had logic 1 at the X1 input then the lightbulb would be turned off since the contact would be open.
Now imagine that you define the state of the lighbulb as: Lightbulb = invertbit(X1) In this case if: X1 = 0 then Lightbulb = invertbit(0) => Lightbulb = 1 which means the lightbulb turns on. In case of: X1 = 1 then Lightbulb = invertbit(1) => Lightbulb = 0 which means it is turned off.
If you compare the two cases above you will notice that they are the same which means the an NC contact is the same as inverting a bit.
I hope I reached the correct topic because it was very hard for me to understand the question.

- 367
- 1
- 12