Documente Academic
Documente Profesional
Documente Cultură
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
FAQ
Calendar
Downloads
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
PLCKeef
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 ?
Any ideas ?
thanks
2/7
4/5/2016
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
tehu
#2
The code looks Ok. Siemens is doing the numbering in bytes, so actually word 4 equals byte 8.
Member
PLCKeef
Member
#3
http://www.plctalk.net/qanda/showthread.php?t=18972
3/7
4/5/2016
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.
#5
Member
Ok thanks
But how does 4 become 8 ?
I have
0000 0000 0000 0100
in MW20
I shift it left 4 spaces
0000 0000 0100 0000
PLCKeef
SimonGoldsworthy
Member
#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
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
seppoalanen
Member
#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
SimonGoldsworthy
Member
#8
Quote:
http://www.plctalk.net/qanda/showthread.php?t=18972
5/7
4/5/2016
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.
Digg
del.icio.us
StumbleUpon
Posting Rules
You
You
You
You
may
may
may
may
not
not
not
not
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
PLC dave
15
douyi
18
guest
21
Johnny T
douyi
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