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,358
Hello, i am using profibus as communication between plc and fanuc arm. I can easily send inputs from plc to arm, but i can't monitor any outputs...
Replies
0
Views
16
Hello, I need to write the following program in Ladder language, but I could not integrate the Fibonacci sequence into the ladder. Can you help...
Replies
11
Views
150
Hi All, Someone at work has put a PLC system on my desk, that's just been taken off an idle production line. He said "It's an S7 PLC. We don't...
Replies
10
Views
269
Hi guys , I'm new with Allen Bradley, but I have experience with Tia portal (s7 1200 ,s7 1500) I want to convert my project from Tia portal to...
Replies
2
Views
210
Back
Top Bottom