You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old May 16th, 2005, 02:47 AM   #1
Johnny T
Member
United Kingdom

Johnny T is offline
 
Johnny T's Avatar
 
Join Date: Jul 2003
Location: Fife, Scotland
Posts: 640
Words in S7 and Modicon

I was recently telling an engineer about bits/bytes/words and double words in S7.

I drew the following diagram to represent a Marker Word in S7.


_______MW10________
| |
0000 0000 0000 0000
| | | |
---MB10-- ---MB11--



With M11.0 being the bit furthest on the right and M10.7 being the bit furthest on the left. I also explained about how to work out in binary the value of the word, with the Least Significant Bit being on the right and the Most Significant Bit being on the left.

He had some Modicon experience (which I don't) and said that the diagram was the same as Modicon except that in Modicon the MSB is on the right and the LSB is on the left...

Can anyone with Modicon experience confirm this? It doesn't sound right to me?

Puzzled from the UK...
__________________
I'm beta testing life...
  Reply With Quote
Old May 16th, 2005, 04:18 AM   #2
dchartier
Member
Canada

dchartier is offline
 
Join Date: May 2003
Posts: 1,519
Hello Johnny T;

This is a Big Endian/Little endian problem: byte ordering is processor dependant. For example, Intel chips are Big Endian (the order you show in your post) , Motorolla is little Endian (reversed).

Say you have a 16-bit register in your microprocessor in which you have copied the hex value F4DE:
-in an Intel chip, you will see F4DE
-in a Motorola chip, you will see DEF4
Both representing the same value, and doing calculations correctly.

the term comes from Swift's Travels of Gulliver:
Big-Endian / Little-Endian


two factions within Lilliputian society: Big-Endians break their eggs at the larger end ("the primitive way"), while the Emperor commanded all his subjects to break the smaller end. Resistance by traditionalists and their subsequent suppression by the government had resulted in civil unrest. The Big-Endian faction had the support of neighboring Blefuscu, a further source of friction between the traditional enemies. Thus Swift satirizes the suppression of Catholics that had racked England and subject nations from the reign of Henry VIII to Swift's own time.
the Emperor ... published an Edict, commanding all his Subjects, upon great Penaltys, to break the smaller End of their Eggs. The People so highly resented this Law, that our Historys tell us there have been six Rebellions raised on that account; wherein one Emperor lost his Life, and another his Crown. (I:4;4)


Consequences
for us programmers: when you exchange between a s7 CPu and a Modbus slave, you will probably have to swap the byte order of the values you recieve, so that the Siemens CPu can make sense of the slave's messages.


Google on Big Endian or Byte swap to see more details.

Hope this helsp,
Daniel Chartier
  Reply With Quote
Old May 16th, 2005, 04:18 AM   #3
D.Duy
Member
Viet Nam

D.Duy is offline
 
D.Duy's Avatar
 
Join Date: Feb 2005
Location: SaiGon
Posts: 5
Just a comment

Hi,

I'm not experienced with Modicon but I have some with Telemecanique
With Telemecanique (same Schneider group with Modicon), Byte and Word order are reversed when compared with Siemens.
(This was my problem when I converted Telemecanique_premium program to S7 400)

Bit order in Byte is same
Byte and Word order are reversed:

S7: Byte1 Byte2 Byte3 Byte4

is same value in the following Telemecanique order:

Telemecanique: Byte4 Byte3 Byte2 Byte1

I hope (!) Modicon and Telemecanique are same

Duy
  Reply With Quote
Old May 16th, 2005, 04:36 AM   #4
Johnny T
Member
United Kingdom

Johnny T is offline
 
Johnny T's Avatar
 
Join Date: Jul 2003
Location: Fife, Scotland
Posts: 640
Thanks for the informative and entertaining replies... love that story about Gullivers travels!!


Well, that's cleared that up. I'm a Big Endian man in my thinking, but, as an understanding and compassionate person, I shall bear the Little Endian philosophy in mind in the future!

Thanks again

__________________
I'm beta testing life...
  Reply With Quote
Old May 16th, 2005, 04:49 AM   #5
Michael Chan
Guest
 
Posts: n/a
Smile Senior Technical Support Engineer

In the Modicon PLC, there are two type of programming language, one is "984 Ladder Logic Programming" and the other is "IEC 1131-3 Programming Language".
The old way of programming is the 984LL (984 Ladder Logic) which is correct, MSB bit 16 is on the right and the LSB bit 1 is on the left. Programming software used are Modsoft (DOS based) and PROWORX 32 (Window 2000/XP).
With the IEC 1131-3 standard, you will following the IEC standard with LSB bit 0 on the right and MSB bit 7 on the left. Programming software used are IEC Concept Programming Software (Windows 2000/XP) and Unity Pro (Windows 2000/XP).
S7 is following the IEC standard and most PLCs in the market are going towards IEC 61131-3 programming standard.

Quote:
Originally Posted by Johnny T
I was recently telling an engineer about bits/bytes/words and double words in S7.

I drew the following diagram to represent a Marker Word in S7.


_______MW10________
| |
0000 0000 0000 0000
| | | |
---MB10-- ---MB11--



With M11.0 being the bit furthest on the right and M10.7 being the bit furthest on the left. I also explained about how to work out in binary the value of the word, with the Least Significant Bit being on the right and the Most Significant Bit being on the left.

He had some Modicon experience (which I don't) and said that the diagram was the same as Modicon except that in Modicon the MSB is on the right and the LSB is on the left...

Can anyone with Modicon experience confirm this? It doesn't sound right to me?

Puzzled from the UK...
  Reply With Quote
Old June 25th, 2009, 01:49 PM   #6
TomBrady
Member
Zambia

TomBrady is offline
 
Join Date: May 2009
Location: Zimbabwe
Posts: 20
>This is a Big Endian/Little endian problem: byte ordering is processor
>dependant. For example, Intel chips are Big Endian (the order you show in
>your post) , Motorolla is little Endian (reversed).

Actually, Intel is Little Endian and Motorola is Big Endian.
  Reply With Quote
Old June 25th, 2009, 02:27 PM   #7
MannyM
Member
South Africa

MannyM is offline
 
Join Date: Oct 2008
Location: JHB
Posts: 70
I am confused.
  Reply With Quote
Old September 9th, 2009, 08:43 AM   #8
dahnuguy
Member
United States

dahnuguy is offline
 
Join Date: Mar 2007
Location: SC
Posts: 567
Quote:
Originally Posted by MannyM View Post
I am confused.
there is always wikkipedia lol
  Reply With Quote
Old September 10th, 2009, 01:47 AM   #9
Peter Nachtwey
Member
United States

Peter Nachtwey is offline
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: Vancouver, WA, UMSA, United Marxist States of America
Posts: 5,910
Modicon LSB is on the right as stated in the first post but bites 1 through 8 are the low byte not the high byte. MODBUS and MODBUS PLUS send the high byte first.

32 bit numbers are all screwed up in modicon since it was added as an after thought. 4x1 is the least significant word and 4x2 is the most significant word. This means the bytes get sent 4x1_HI, 4x1_LO, 4x2_HI and 4x2_Lo. The true test of compatibilty is to be able to read and write 32 bit values from a Modicon PLC.
__________________
"Living is easy with eyes closed, misunderstanding all you see...." Strawberry Fields Forever, John Lennon
  Reply With Quote
Old September 10th, 2009, 08:23 AM   #10
dahnuguy
Member
United States

dahnuguy is offline
 
Join Date: Mar 2007
Location: SC
Posts: 567
http://en.wikipedia.org/wiki/Endianness

I wasn't kiding.

It's a good explaination of the basics. Then at least one could better understand the specific differences of each manufacturer.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Siemens S7 w/ Modicon I/O ??? estover LIVE PLC Questions And Answers 4 December 27th, 2002 12:28 PM


All times are GMT -5. The time now is 06:30 PM.


.