TIA portal - byte swaped PLC-HMI

rQx

Lifetime Supporting Member
Join Date
Oct 2010
Location
Trelleborg
Posts
1,049
Hi!

I got a little bit confused when I downloaded a program today.
In the PLC tag table I have a MW300 that represent Alarm1-16.
I then use M300.0 as alarm 1, M300.1 as alarm 2 etc.

In the HMI alarm setup I then specified MW300 as my alarm word and specified MW300.x0 as alarm 0.

When I then started the PLC and HMI the byte where swaped. Now M300.0 in the PLC is represented as MW300.x8 in the HMI to make it work.

Why does the byte order swap? Just a question of curiosity.

/Tim
 
Siemens is big endian, so...
Code:
   Byte 0     Byte 1      Byte 2      Byte 3
   Word0HI    Word0Lo     Word2Hi     Word2Lo
DW bits24-31  bits16-23   bits8-15   bits0-7

The behaviour you were expecting is for little endian memory storage, as found in some other PLC brands.
 
You have non Siemens panel?
Look from communication setting if there is settings for swapping bytes (bits only) inside words.

p.s If there is only option for swapping bytes allways, then you have bits on right order, bt all word values are wrong
 
Last edited:
Maybe I was a little bit unclear but both the PLC and the HMI is siemens, that's why I'm confused :p
 
I have never had this problem before but it is also the first time I arrange the alarms in the PLC in the tags editor. Usually I have an alarmword in a datablock and slice it, but since I can't name the slices individually I tried with tags editor this time.

Ok so on:
MW300
the M300.0 represent the 9th and M301.0 the 1st
but if I slice it MW300.x0 it is the 1st bit?

I declare my MW300 as an integer. If M300.0 is set what value does it represent? 1 or 256?
 
In order of left to right, Most Significant Bit/Byte (MSB) to Least Significant Bit/Byte (LSB):

Double Word: MD300
Word: MW 300, MW 302
Byte: MB 300, MB301, MB 302, MB 303
Bit: M300.7 ... M300.0, M301.7 ... M301.0, M302.7 ... M302.0, M303.7 ... M303.0
 
The slice based addressing really does make things easier (as you found before), the downside is you have to be more careful about how you add comments, because you can't do it in the name.

What I've heard is that the HW siemens uses now in the 1200's and 1500's is actually big endian, so they have to convert to little endian any time you use absolute addressing. I was told this is one of the reasons that they push the symbolic addressing and opitimized code so hard. For compatibility reasons, they couldn't change Endianness of the absolute addressing, but the system doesn't actually think that way any more, and there is a performance hit to switch when it needs to.
 

Similar Topics

Hi all, Got a new project with a Siemens S7-300 (CPU 312). I've just tried to copy in my motor control FB's from an S7-1200 project I did earlier...
Replies
5
Views
5,285
Im trying to create a level indicator for water Tank i have used the ADD function while the pump is on and level increasing everything works...
Replies
8
Views
42
My PLC (S7-1200 with CPU-1212C) has now been delivered to customer site. They've asked me to do some updates to the software. I can do that on my...
Replies
21
Views
327
Does anyone know why the connection interface is greyed out and says why I can only use Teleservice instead of the other options like PN/IE? I am...
Replies
0
Views
44
Hi guys I after a bit of advice on Tia portal graphics, I would like to add a conveyor belt graphic to a hmi and the conveyor in the basic...
Replies
3
Views
130
Back
Top Bottom