SandstromDJ
Member
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.
Example:
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..15] OF BOOL
+ 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.
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.
Example:
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..15] OF BOOL
+ 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.
Last edited: