Mitsubishi to B&R RIO through Profibus. Byte problem.

3 posts in this topic

Hi all.
Long time reader, first time poster.

I am tasked to make a couple of module specific function blocks for communication between our Mitsubishi PLC (GX IEC Developer 7.04) and a B&R remote IO over Profibus. A number of these blocks would then be used, depending on the RIO setup.

Reading should be straight forward, just read X amount of words, starting from address Y.
Writing is trickier as Mitsubishi prefers 16/32 bit Data whereas B&R batches Data in bytes!

As I have several output modules in the RIO. I need to send my info "chained" together.
Module 1: 2 Bytes
Module 2: 3 Bytes
Module 3: 2 Bytes
Totals: 7 bytes or 4 words.

Sending the first word is no problem. Neither is the next two words (I will just have 1 empty byte at the end of the third word). But then the info to the third module should start in the middle of the third word.

Any idea how I could solve this?

Experimental: At the moment the blocks have inputs (bits), which are stored to a bit-array inside the block and then linked to an output. My idea at the moment is to merge all module-wise output bit arrays to one big bit array, converting that to INT and sending it off to the Profibus address. But I have not yet found a way to merge the arrays and shift them so all data is where it should be.
Above example:
+ ARRAY [0..23] OF BOOL
+ ARRAY [0..15] OF BOOL
Totals: ARRAY [0..63] OF BOOL
or [0..71] counting the spare byte.
Converted to 8 Words and forwarded through Profibus.

Thank you in advance.

Edited by SandstromDJ
Typo. Word count mistake.

Share this post

Link to post
Share on other sites

Which PLC are you using? 

Why aren't you using GX Works 2?(Or is this still A-series?)

Than GX Config is inside GX Work2 and you can just set adressen and let the compiler take care of the rest.

Alternatively: Why not use Swap and WAND to change the low and high byte and delete unwanted bits

If you want to copy an Bit Array to a Word you schould use MOV K4[Arrayname] .....

Share this post

Link to post
Share on other sites

PLC type: Q04UDEH

GX IEC Developer is the program of choice at the company for the moment.


I looked at Swap and WAND, they will most likely be useful down the road.

My main issue at the moment is how I should handle the bits best. Through an array as my idea or directly to WORD? The conversions between bit, array, word etc is not a problem. Problem is how I handle the overlapping words without overwriting or leaving an empty byte.


The RIO will read everything and distribute the Data to the modules in the order they come in.


It would be easy to just have everything in one block, but the objective is to make the module FB's "modular" so we can reuse and reorder them in future projects as well.


Thank you Gambit for your reply!

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