the question is still too fuzzy. based on what i understand from it, you want to check if certain combination of bits is received and if that is the case, turn on some bit (output for example).
there are different ways to do this but first - learn the hexadecimal numbers (it's only 0-F but they are perfectly suited for this kind of work):
you could evaluate bits using ladder for example. to check if you have all 16 bits in specific configuration you could do:
CODE
--||----------[MOV D0 k4M0]
M15 M14 M13 M12 M11 M10 M9 M8 M7 M6 M5 M4 M3 M2 M1 M0 Y0
--|/|---|/|---|/|---|/|------| |---| |---|/|---|/|-------|/|---|/|---| |---| |-------|/|---| |---|/|---| |---()
Note that BMOV is meant for blocks of registers (multiple registers), don't use it if you only need one or two 16-bit words (this is what MOV and DMOV are for).
This checks if the code received in D0 is 0000 1100 0011 0101b (or H0C35). If your PLC supports bit addressing of the D register, you don't need to use M bits, you could address D bits directly:
CODE
D0.F D0.E D0.D D0.C D0.B D0.A D0.9 D0.8 D0.7 D0.6 D0.5 D0.4 D0.3 D0.2 D0.1 D0.0 Y0
--|/|---|/|---|/|---|/|------------| |----| |-----|/|-----|/|---------|/|---|/|----| |----| |-------|/|---| |---|/|---| |------()
however, this will make for very messy code if you have more than few outputs to be controlled this way.
you could replace it by this:
CODE
[= D0 H0C35]-------(Y0)
now you can see where the hex comes in place - one hex digit defines four bits and if you know the 0-15 of binary/decimal/hex this is piece of cake.
note that this code is still only practical for very few comparisons - for more you need to have comments which becomes a burden when typing every time - specially is same comparison is used multiple times.
one way to do this is:
- initialize all expected "messages":
- compare receved word with register
this allows for very flexible system so codes can be changed on the fly - if needed. (why not from HMI, this way customer becomes responsible for maintenance for example.)
This is what "Program memory - Devices" is for but it can also be done in code (on first scan for example):
CODE
---| |----+------[MOV H03C5 D100]
|
+------[MOV H8750 D101]
|
+------[MOV H3A67 D102]
|
+------[MOV H233C D103]
|
+------[MOV H5569 D104]
then add comments to D100 and others ("pressure too high", "barcode scanned", "fault detected" etc.) and then when you do comparison in code, everyone can see what is this supposed to be (comments attached to D100 etc.):
CODE
[= D0 D100]------------(Y0)
[= D0 D101]------------(Y1)
[= D0 D102]----+-------(Y2)
[= D0 D103]----+