Sunteți pe pagina 1din 7

4/5/2016

Siemens S7 Indirect addressing help - PLCS.net - Interactive Q & A

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

This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
Try ouronline PLC Simulator- FREE. Click here now to try it.
---------->>>>>Get FREE PLC Programming Tips
your first name your email address
Get The PLC Tips Now!
New Here? Please read this important info!!!

PLC S.net - Interactive Q & A > PLC S.net - Interactive Q & A > LIVE PLC Questions And Answers

Siemens S7 Indirect addressing help


Register

FAQ

Calendar

Downloads

User Name User Name


Password

PLC Reviews

PLCS.net Store

Log in
Today's Posts

Thread Tools
November 27th, 2005, 06:05 PM

http://www.plctalk.net/qanda/showthread.php?t=18972

Remember Me?

Search

Display Modes
#1

1/7

4/5/2016

Siemens S7 Indirect addressing help - PLCS.net - Interactive Q & A

PLCKeef

Siemens S7 Indirect addressing help

Member

Hi all
I need a bit of help with the program below.
I have a thumwheel switch and I want to transfer the left hand three digits to a dat wod specified by the
right hand digit.
The program works , but seems to transfer to the wrong data word.
for example if I have 1234 dialed up on the thumbwheel switch , 123 should be transfered to data word 4.
But it actuall goes to data word 8?
The data at MW20 seems to be doubled when put into the pointer ?

Join Date: Nov 2005


Location: Australia
Posts: 65

Any ideas ?
thanks

//Indirect adddressing example


OPN DB 10 //open data block 10 as the resident DB
L IW 124
L W#16#F
AW
T MW 20 //left hand digit on it's own
//
L IW 124
AW W#16#FFF0
SRW 4
T MW 50 //right hand 3 digits on their own
//
//
L MW 20
http://www.plctalk.net/qanda/showthread.php?t=18972

2/7

4/5/2016

Siemens S7 Indirect addressing help - PLCS.net - Interactive Q & A

SLD 4
LAR1 //put the right hand digit in the correct pointer format
//
//
L MW 50
T DBW[AR1, P#0.0] //transfers the data to the DW specified by MW20

November 28th, 2005, 01:00 AM

tehu

#2

The code looks Ok. Siemens is doing the numbering in bytes, so actually word 4 equals byte 8.

Member

Join Date: Nov 2005


Location: Tnsberg
Posts: 1

November 29th, 2005, 04:50 PM

PLCKeef
Member

Join Date: Nov 2005


Location: Australia
Posts: 65

#3

I still don't understand , looking at what I have below , if MW20 has 4 in it


L MW 20
SLD 4
LAR1
then when I execute the next part
L MW 50
T DBW[AR1, P#0.0]
MW 50 gets transferred to DBW 8 , not 4 as I would expect ?

http://www.plctalk.net/qanda/showthread.php?t=18972

3/7

4/5/2016

Siemens S7 Indirect addressing help - PLCS.net - Interactive Q & A

November 29th, 2005, 04:58 PM

SimonGoldsworthy
Member

#4

If you want to write to a byte address, you shift the number left 3 bits. You are shifting the number 4
bits left (as you should if you are writing a DBW), hence why you are writing to DBW 8.

Join Date: Mar 2005


Location: England
Posts: 1,079

November 29th, 2005, 07:23 PM

#5

Member

Ok thanks
But how does 4 become 8 ?

Join Date: Nov 2005


Location: Australia
Posts: 65

I have
0000 0000 0000 0100
in MW20
I shift it left 4 spaces
0000 0000 0100 0000

PLCKeef

so the pointer would be 4.0 ?

November 30th, 2005, 03:41 AM

SimonGoldsworthy
Member

Join Date: Mar 2005


http://www.plctalk.net/qanda/showthread.php?t=18972

#6

The bottom 3 bits of a pointer define the bit address, the remainder of the bits (when shifted right 3
bits) define the byte address. Pointer addresses increment as below:
0000
0000
0000
0000
0000

0000
0001
0010
0011
0100

= 0.0
= 0.1
= 0.2
= 0.3
= 0.4
4/7

4/5/2016

Siemens S7 Indirect addressing help - PLCS.net - Interactive Q & A

Location: England
Posts: 1,079

0000
0000
0000
0000
0001
0001
0010
0010
0011
0011
0100
etc.

0101
0110
0111
1000
0000
1000
0000
1000
0000
1000
0000

= 0.5
= 0.6
= 0.7
= 1.0
= 2.0
= 3.0
= 4.0
= 5.0
= 6.0
= 7.0
= 8.0

Last edited by SimonGoldsworthy; November 30th, 2005 at 03:44 AM.

November 30th, 2005, 07:53 AM

seppoalanen
Member

Join Date: Jan 2003


Location: Finland
Posts: 1,132

#7

S7 indirect pointing is simple. Pointer (DWORD) points the bit number in open memeory space.
"SLD 3", "LAR1" etc. are not necessary, but mostly helpful.
L L#3
T #Pointer // points bit 3 (from zero)
L L#1
+D
T #Pointer2 // 1-bit more (4) than #Pointer (3)
L DBD[#Pointer] // Loads bits 3-34 to accu
T DBD[#Pointer2]// Writes from accu to bits 4-35

November 30th, 2005, 09:29 AM

SimonGoldsworthy
Member

#8
Quote:

Originally Posted by seppoalanen


S7 indirect pointing is simple
Unfortunately, the code you have posted may have caused more confusion than anything else.

http://www.plctalk.net/qanda/showthread.php?t=18972

5/7

4/5/2016

Siemens S7 Indirect addressing help - PLCS.net - Interactive Q & A

Join Date: Mar 2005


Location: England
Posts: 1,079

Firstly using the variable #Pointer is not possible because it is a reserved word. I would recommend
cutting/pasting example code from the block editor into the thread - that way you can only post code
that will be acceptable to the Step 7 block editor.
Secondly, you cannot reference a DBD from any address unless the bit number is zero (i.e. the bottom 3
bits of the pointer must be zero). Attempting to execute this code will cause the plc to fault out with an
alignment error. I would recommend running code in the plc simulator before posting it, that way you
know the posted code will do as you say.

Jump to Live PLC Question and Answer Forum


Bookmarks
Twitter

Reddit

Digg

del.icio.us

StumbleUpon

Google

Previous Thread | Next Thread

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

Posting Rules
You
You
You
You

may
may
may
may

not
not
not
not

post new threads


post replies
post attachments
edit your posts

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

Forum Jump
LIVE PLC Questions And Answers

Go

Similar Topics
Thread
http://www.plctalk.net/qanda/showthread.php?t=18972

Thread Starter

Forum

Replies

Last Post
6/7

4/5/2016

Siemens S7 Indirect addressing help - PLCS.net - Interactive Q & A

Siemens S7 indexed addressing

PLC dave

LIVE PLC Questions And Answers

15

March 25th, 2015 05:43 PM

S7: Problem with Pointer and indirect addressing

douyi

LIVE PLC Questions And Answers

18

February 2nd, 2010 04:17


AM

Siemens s7 ladder indirect addressing

guest

LIVE PLC Questions And Answers

21

June 27th, 2009 06:39 AM

S7 indirect addressing examples?

Johnny T

LIVE PLC Questions And Answers

October 3rd, 2005 04:32 AM

S7 Indirect Addressing of Array

douyi

LIVE PLC Questions And Answers

September 21st, 2005


08:25 AM

All times are GMT -5. The time now is 04:53 AM.
Contact Us - PLCS.net - Text - Top
.

http://www.plctalk.net/qanda/showthread.php?t=18972

7/7

S-ar putea să vă placă și