Sign in to follow this  
Followers 0

Map and Shift Data, then insert more data

2 posts in this topic

My goal is to map data (M101-M104) that is remotely turned on/off from our MES US module over to either a D-register or L bits. Only reason I thought L bits was to keep their value upon a power loss, but data shifting is much easier with D registers (and I believe these can be latched in parameters to hold their value also). Then I want to pass this data in the D-register (shift it) through our line to the other stations in order to make decisions on whether the original data (M101-M104) was turned on/off in the first station.

Here is what I have so far, and haven’t tested it yet so correct me if I am wrong:

BMOVP K1M101 D0 K1     (moves M101-M104 into the lower four bits of D0) So M101 is moved to D0.0, M102 to D0.1, M103 to D0.2 and M104 to D0.3)

DSFLP D0 K10 (moves D0 to D1, D1 to D2...D8 to D9, where D0 = station 1 data, D1 = station 2 data....D9 = station 10 data)

I can then make decisions by looking at D(station#).(bit #)

For example, ---||---D2.0 would be station 3 looking to see if M101 was turned on back in station 1.

Here is where I am stuck though; I want to be able to add/insert data (bits) as the box/data pass through a station. This would involve mapping more M bit data (M105-M107) from our MES module to the same shifting data registers, but at other stations. For example, M105-M107 turn on in station 3 and I want to insert this to D2.4 –D2.7 in station 3 without affecting the other bits in D2 (D2.0-D2.3 which is station 1 data). I could map the data to a different register, but I’m not sure how to shift multiple D registers multiple times without overwriting data. Maybe I could use the DSFLP instruction 5 times to shift the data if there are 5 stations for example?

In a nutshell, how can I map data at the first station and shift it through stations while also being able to map more data in other stations to finally reach the end station and make decisions based on all the data.

I am using a Q03UDECPU


Edited by Paolo_911

Share this post

Link to post
Share on other sites

I think I'm just going to have each station have a reserved number of D-registers and shift them at the same time unless someone can help come up with a better plan. I'm sure I made this wayyy more complicated than it needs to be. This is the first time I am trying something like this.

Max 10 stations, D0-D9 Station 1 data, D10-D19 Station 2, D20-D29 Station 3...etc., where D0 is station 1 data at station1 and D1 is station 1 data at station 2...etc.

One input trigger to shift all the data at once,

BMOVP K1M101 D0 K1





Then at Station 3, 

BMOVP K1M104 D22 (D22 because D22 = "station 3 data at station 3" since D12 = "station 2 data at station 3" and D2 = "station 1 data at station 3")

This way I can track all the station data along and shift it together with the same trigger. I will also have an awareness where each station's data is stored and easily observe it being passed through as long as my timing is correct and doesn't pose any issues with moving station 3 data (M104) into D22 at the correct time to coincide with the trigger.   

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0