S7-1200 copy 180 bytes from %IB60 to UDT

AlfredoQuintero

Lifetime Supporting Member
Join Date
Feb 2015
Location
Yokohama
Posts
1,546
Hello: I have been working in what I thought would be a relatively easy thing to do and I am stuck. Would be grateful for some advice. I have one Profinet device with 180 bytes input. IN Codesys the GSDML file described datatypes are shown clearly and the IO mapping is straight forward.

On the S7-1200 I need to get this block of 180 bytes from the %IB area and copy it to a user defined data type on a DB on the S7-1200 program, and I cannot find the way to do this.

Tried MOVE_BLK_VARIANT but I get return "80B4" (The data types do not correspond. Instead of an ARRAY of Struct, use an ARRAY of PLC data type (UDT).) Not sure what this error means, because for DEST I am using a UDT.

Thanks for reading and advice.
 
Do you really need to move the data? You could just tie the UDT directly to the input area in the tag table. If you then need to move the data just move the complete structure using the regular move instruction
 
LD, thanks very much. You are absolutely right. I do not need to move the block of data if I could map the IO to a user defined data tape PLC tag, but I tried to do this and get an error. Maybe the screen below would let you realized what is it I am doing incorrectly.

S71200_IO_Mapping.jpg
 
Thanks very much. I removed Tag1, but the error is that the data type is not compatible. It says "The address entered does not match the data type of the tag". That is my problem. I would like my tag which is based in a UDT to start in this address, which is where the input data for this remote IO starts.
Thanks again.

S71200_IO_Mapping1.png
 
LD, thanks very much. I am doing progress but I do not yet achieve what I need, hence your expertise would be greatly appreciated once more.

I am able to map the Profinet IO inputs to an Array[0..179] of Bytes in the PLC tag area. Thanks a lot for this tip.

But now I want to copy those same 180 bytes to either another PLC tag or to a variable in a DB which has the same size of 180 bytes, but internally has been declared with a different user data type. I have tried VariantPut, MOVE_BLK_VARIANT, without a happy end.

Again, thanks to anyone with the expertise and patience to shed light on this issue so hard to my mind.

S71200_IO_Mapping3.jpg
 
Last edited:
LD, thanks very much. I am doing progress but I do not yet achieve what I need, hence your expertise would be greatly appreciated once more.

I am able to map the Profinet IO inputs to an Array[0..179] of Bytes in the PLC tag area. Thanks a lot for this tip.

But now I want to copy those same 180 bytes to either another PLC tag or to a variable in a DB which has the same size of 180 bytes, but internally has been declared with a different user data type. I have tried VariantPut, MOVE_BLK_VARIANT, without a happy end.

Again, thanks to anyone with the expertise and patience to shed light on this issue so hard to my mind.


1st: Why do you have two different datatypes? Do you NEED the data as an array of bytes in addition to the structured data? If not, just use the data type for the structured data at input tag.



2nd: If you do need the data as both types, Take a look at the Deserialize command. It takes data from an array of bytes and moves it into a structure (as long as the structure isn't more data than the array). Serialize is its partner to take structured data and move it to a byte array.
 
Hi all!

Sorry for disturbing so often, but since S7-1200 has THE WORST DOCUMENTATION EVER, and it was released UNFINISHED, i must ask even this:

I have a DB1 with 5 real variables in it.
I have a DB2 with array of byes, 20 bytes in total.

How to copy (in less then five MOVE instructions- that I know) DB1.DBD1 to 4 bytes in DB2, starting from byte 4 in DB2?
And form DB2 four consecutive bytesto real in DB1?

Thanks.
 

Similar Topics

Hi all, Currently having trouble getting a speed reference to write over modbus to an Omron M1... I can successfully write a run command and...
Replies
6
Views
230
HI i would like to know how to get a variable that will store the amount of times a program has been executed. The issue is I have 3 DBs for 1 FB...
Replies
2
Views
75
Hi, I have attached herewith one image which our programmer has been used in S7 1500 PLC. Now we need to use the same instructions in S7 1200 PLC...
Replies
4
Views
118
commentaire communiqué siemens s7-1200 avec vfd delta ? (cablage et sur tia portal )
Replies
0
Views
122
Hi, I have a 1214 on ip 192.168.0.100. This is connected to other modules through a switch on same network. I need to connect this to a company...
Replies
1
Views
172
Back
Top Bottom