Color Sensor FC ENO?

brunoVBel

Member
Join Date
Oct 2013
Location
Europe
Posts
5
Hello!

I'm still at school, learning the basics...
In an attempt to program a function which is checking a color sensor i'm stuck.

The plc (cpu 314c) is enabling 4 outputs, one at a time, to activate 4 different bank switches on a color sensor. If there is a match the color sensor's output becomes high. This is detected in the FC and the corresponding value is stored.

This Fc is called from another functionblock. When this FC is succesfull the ENO output should be high to make it possible for the program to continue. (for ex. ATT of the color...).

Unfortunately the ENO of the FC is only high if the move instruction in NW5 was succesfull.
I presume earlier succesfull move instruction are overwritten by the following.


Can anyone tell me how to enable the ENO of the FC when ANY of 4 MOVE instructions are succesfull please?

The Set / SAve instruction (as suggested on this forum) doesn't work.

Thanks in advance!

ps: reminder, student :)
 
looks like the MOV is staying on
I am wondering why you are using Move if the output is binary
should it be a compare statement?
I am a bit rusty with siemens havent looked at it for 3 years
 
note that you have to look at 4 conditions
00 - 01 - 10 - 11
so output 00 is used twice and Output 10 is used twice
the same as output 01
you need to code for this
use 00 as the default - no output = red
 
Ian,

Thanks for your answer.

I notice I forgot to make something clear.

The color sensor is mounted near a conveyor belt which transports boxes. Each of these boxes have a different color. (Red, Green, Blue, Yellow).
The color of each box as well as their order is stored in a FIFO register.
Enabling the possibility to do some evalutation in a later process.

I store the color of each box in a WORD format.
using: W#16#0000 for RED, W#16#0001 for Green, ...

The function I'm having problems with is to obtain the color of the present Box.

When there is a negative edge detected at I100.0 i'm sure the box is in front of the color sensor.
The color sensor compares his image to a image saved in its memory. 4 memory places are available. Each stored in a different bank.
I can switch banks by activating 4 different outputs of the plc.
If there is a match the output of the color sensor is high.

IN case of a match i MOVE a constant (red=0, green=1, Blue=2, Yellow=3) to a MW.
And the function should exit giving ENO=HIGH to make it possible for the program to continue.

I think when explained like this the Move instruction is correct. My problem with ENO of the FC remains.

Thanks for your time!
 
Code:
SET;
SAVE;
Sets BR (ENO) bit via first setting RLO (SET) and then saving it to BR (SAVE). If you need it conditional, you need to use only:

Code:
SAVE;
After executing logic that results in RLO you want to save.

For example, last network could be

Code:
O #IsRed;
O #IsGreen;
O #IsBlue;
O #IsYellow;
SAVE;
And you would add coils behind move that assing temp bits IsRed, IsGreen, IsBlue and IsYellow. I did not actually check what your code does, so some modification might be needed.
 
Last edited:
It also looks like you are using a temp variable for the negative edge detection store - this is a no-no.
 
TurpoUrpo, L D[AR2,P#0.0],

Thanks a lot!

I've tried the set/save instruction before, without succes. Your explanation is what I was looking for. Sometimes, when learning, you need to read a dozen times the same explanation untill someone uses the words you understand. Thanks!

The Temp-variable for the negative edge... I should have known.. Thanks!

ALthough this is now working the way i wanted I keep having the feeling its clumsy and there should be a better way. If i find one. I'll post it!

Thanks guys!

ps: working program in attachment.
 
well... I'm using TIA V11 and i've been looking for such a handy tool.
unfortunately i didn't find it.

Exporting as PDF is also an option but that will only generate more unusablel information..
 

Similar Topics

I have an application where sometimes there is a splice in the film that is red. The film can be any other color but none are red. I would like to...
Replies
18
Views
7,268
Does anyone know how to set the background colors of instuction blocks (TON, MOV, etc)?
Replies
1
Views
160
HEllo, still satruggling with the curse WinCC Unified. See attached picture. I just want to change the fill colour from turqoise to grey and then...
Replies
5
Views
525
Hello all. It's already have been discussed here and over internet, but I'd like to have your opinion again on the topic. If you physically...
Replies
17
Views
1,665
Dumb question, Hooking up two wire reed switches out in the field. They are wired into sinking input cards. Once the wires leave the panel, do...
Replies
5
Views
1,527
Back
Top Bottom