some very good responses here
I read this post a few days ago, and just haven't had time to reply, but was definetly thinking of the photo-eye example. It usually tripped me up after about a 10 hour day on an install. I used it to gage when it was time to go home. As soon as I couldn't figure out the photo-eyes anymore, I would call it a day. What made it worse was that the plant couldn't decide on one type of operation. Some where "light operate" and some were "dark operate".
Correct me if I am wrong here:
light operate = input goes high when light reflects off of reflector; nothing blocking photo-eye; PE contact is normally (sorry) open but held closed.
used to represent PE clear
---| |--
used to represent PE blocked
----|\|--
dark operate = input goes low when light reflects off of reflector; nothing blocking photo-eye; PE is normally closed but held open.
used to represent PE clear
---|\|--
used to represent PE blocked
----| |--
This can be quite confusing. What I did, and I think someone may have partly mentioned this is......
Use an internal coil to represent all inputs. This coil would be commented to reflect its true state. For example.
PE1 PE1 Clear
I:XX1 B3/1
--| |---( )
PE2 PE2 Clear
I:XX2 B3/2
--|\|--( )
Then, when you were using the coil in logic you could read it to yourself as follows....
PE2 Clear
B3/2
--| |--
"If PE2 Clear Then"
or
PE2 Clear
B3/2
--|\|--
"If PE2 NOT Clear Then"
It sounds silly, but it really helps when you can fly through your code without having to stop and think about states of contacts. Every time you see a normally open contact, XIC, XON (whatever), you can read the comment as the condition that needs to happen. Every time you see a N.C. contact (XIO, XOF?) you can read the comment with a "NOT" in front of it.
This is my favorite way for dealing with this. My second favorite is when people use:
1 = "this"
0 = "that" in the comment field
but this still stops you in your tracks for a second, if you haven't had that first cup of coffee (I am up to red eyes now).
Oh, and I forgot about them photo-eyes with a N.O. and a N.C. set of contacts. Oh, and that darn PNP NPN dilema.
And darn if allen bradley... (love hate relationship) didn't right after I thought I was comfortable with "examine on" and "examine off" go off and change their terminology to "examine if closed" and "examine if open". Oh, if that didn't just clear it all up for everybody. No need for the F1 key anymore after that fix.
I do have the XIC and XIO thing permanently installed in my brain now after all that programming in ASCII--- easy to forget that not everyone knows AB.
Man... hard to get the thoughts on to paper. And to think that I wanted to be a teacher.
time for the preview