Mask out 16 bits in a word

Berra

Member
Join Date
Mar 2007
Location
Sweden
Posts
137
hi experts.
I have a small thought: how can I mask out a 16-bit words.

each bit of the word is to a picking station. So if the bits are set as this: 0100 0100 1000 0100
and I'll bulge out the boxes to the picking stations first station 3 then station 8,then station 11,and then station 15

or can I compare the word instead of hexcode
brainstorm :) example:

l / 16 # 8908 barcodes reader
l / 16 # 8908 mask
== I
Set M1 / bulge out box to the picking stations
 
I'm not sure I fully understand what you are asking...

Define
Station1 = 1
Station2 = 2
Station3 = 4
Station4 = 8
Station5 = 16
Station6 = 32
Station7 = 64
.
.
.
Station15 = 16384


Bitwise AND the reference word with the defined station numbers. If the result is non-zero then the station bit is set.

You can add the stations together to build a more complex mask:
Mask = Station2 + Station8 +Station11
 
If I understand this right, you can use bit addresses directly to this on Siemens, you don't need and inscructions for this.

I mean, ex. word address MW0 uses bit addresses M0.7-M0.0 and M1.7-M1.0.
If you have value 3 on MW0 then, if you look at bit addresses you see that bits M1.1 and M1.0 are on. If you have value 8 then only bit M1.3 is true...
 
Last edited:
lare is correct only counting is difficult.
better is stationword AND workword if true the set.
or
do it with ror or shift. and a counter.
 
If I understand this right, you can use bit addresses directly to this on Siemens, you don't need and inscructions for this.

I mean, ex. word address MW0 uses bit addresses M0.7-M0.0 and M1.7-M1.0.
If you have value 3 on MW0 then, if you look at bit addresses you see that bits M1.1 and M1.0 are on. If you have value 8 then only bit M1.3 is true...



True, but with the AND WORD function, he can look for several stations at the same time as well as ignore any stations with a single function (less code to write).
 

Similar Topics

I have a program that I've used 100 times. SQO settings: File N7:0, Mask 0FFFFh, Dest B3:1, Control R6:0, Length 8, Pos 2. Length & Position...
Replies
48
Views
943
Hi. Rockwell learning curve 132-1b. I was having trouble to change IP address on a EN2TR. Finally found out that I need to change the IP...
Replies
1
Views
746
I am working with a 1768-ENBT and I was able to connect to it through my laptop. My laptop IP is 192.168.1.10 subnet 255.255.255.0 and the PLC...
Replies
12
Views
1,554
Hi there, I'm trying to perform a mask move operation in RSlogix 500 using the S2(Status) so that it will be easier to transfer them to our SCADA...
Replies
6
Views
2,650
I could not connect to or PLC over or network so I checked and the IP address is correct, but the subnet and gateway are incorrect. It has a...
Replies
2
Views
1,983
Back
Top Bottom