Jump to content

1012 - Illegal Net error

Recommended Posts



The following net is giving me a 1012 - Illegal Net error



I've narrowed it down to the MB 38 NO contact, as when I remove it from the rung I do not get the error. Something is flying over my head and I don't get why have that bit is parallel would be causing an illegal net error. Any tips would be greatly appreciated 


Here is the STL view.image.thumb.png.c2e4006906fb71cbe140a09289f57778.png 


Link to comment
Share on other sites

  • MVP 2023

You need to break that network into four separate networks.  Each one should have a separate and complete logical statement.  It's good that you know how to use STL view, and it is showing you that you're over-working the compiler with all the LBs (virtual Local Bits) it has to create to try to accommodate you.

There's no memory cost for more networks.

Joe T.

Link to comment
Share on other sites

  • MVP 2023

Every time you see a "!" in STL the compiler is starting it's own logical statement.  It's kind of like assembly language and it takes liberties and re-arranges your rung.  It can only make one decision at a time and writes results to the temporary memory.

For example, look at the first few lines-

!   MB 6

/   MB 38

=   LB 0


Look at MB 6 OR MB 38 and store the temporary result in LB 0.

!  TD 4

=   LB 1

Store TD 4 in LB 1.   You can see here that it's looking at TD 4 before it's even called

!N   MB 35  

&   LB 0 

=   TD 4

Look at NOT MB 35 AND my LB 0; if true run TD 4


And so on.

The more lines you have in STL View with "LB" in them, the more the compiler is performing somersaults to get your code to work.  It's mission is to get it all in.  Other brands of PLCs force you to finish a rung and number each one.  Unitronics does not have that limitation but it can get you in trouble.

When you create a new network, the slate is wiped clean and the result much more resembles what you were thinking.  Compare the STL views after you break it up an you'll see what I mean.

Joe T.  



  • Like 2
Link to comment
Share on other sites

  • MVP 2023
13 hours ago, Action22 said:

The following net is giving me a 1012 - Illegal Net error

Think about what ladder logic is all about. It's a high level language where each ladder rung is intended to encompass a single line of code. It's not just a blank slate with some random lines drawn. Separate lines of code belong in separate ladder rungs. You tried to put 4 lines of code in a single ladder rung. Sometimes you can get away with it, but it's fraught with risk and is very poor form.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...