TIA portal - byte swaped PLC-HMI

rQx

Lifetime Supporting Member
Join Date
Oct 2010
Location
Trelleborg
Posts
1,051
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,383
Hey Guys, I am using a siemens IPC with a siemens RFID setup (Part numbers below). I am looking to create a screen where I can add/remove users...
Replies
11
Views
128
i am using profibus, i want to insert a hexadecimal word or byte to 4 byte like in the phot but i don't know how
Replies
6
Views
148
Hello guys, I recently bought s7 1200 DC/DC/DC to practice programming siemens. upon powering up a device, I saw red light on error and maint...
Replies
3
Views
209
Hi! Is it possible to open the project I'm creating on a latest version? I'm working on TIA Portal V19, but the customer needs it on v18.
Replies
10
Views
357
Back
Top Bottom