Siemens Peripheral Inputs and Outputs

Join Date
May 2011
Location
South Carolina
Posts
87
Given this code:

L DBD 8
LAR1
L PID(AR1, P#8.0)
T DBD 38

I understand that whatever is in DBD 8 is loaded into AR1 and then 8 is added to it and that addresses the PID which is transferred to DBD 38. My question is, when it says PID(...), what exactly is it looking at? What would I expect to see in DBD 38, if I looked? Would it be a 32 bit binary number, and if so, where is that number coming from?

Thanks,

David
 
it is indirectly readed from Peripheral input doubleword (PIDx). So PLC read inputs whenever PLC program ask them on scan.

(Normally you use process image area, inputs have status of start of PLC scan and outputs are updated on end of scan. So there is delay on updating. With Peripheral addressing I/O is updated directly)

Not 100% sure, I should check with real PLC if it points to DBD8 value or DBD8 value + 8.

if DBD 8 have value 0 -> PID8 is transferred to DBD38
if DBD 8 have value 10 -> PID18 is transferred to DBD38
if DBD 8 have value 20 -> PID28 is transferred to DBD38

On hardware config you should see same start addressing on DI or AI. PID consist of several inputs

I quess that there is OPN DBx command somewhere before

http://www.plcdev.com/siemens_s7_indirect_addressing
https://support.industry.siemens.co...ou-need-peripheral-addressing-?dti=0&lc=en-WW
 
Last edited:
Thank you for the reply.

Yes there is a command earlier to open DB100. I am still confused though. What is contained in the PID? What number is in there and what does it represent?
 
Look in your h/w config - the data will depend on the device. Here's an example of an Indradrive at PIW/PQW256. The data will depend on how the drive has been parameterised.

piw.jpg
 
PID is readed from PLC's inputs.
You need to look hardwire configuration of PLC program.
If there is digital inputs which starts with same address to where DB100.DBD38 points, then it has 32 consecutive binary inputs.
If analog input have start address, then PID is consist of two analog inputs (or one if analog input is allready 32 bits long, if that kind type even exist)

Either way DB100.DBW38 is demuxed to separate bits or to analog data (measurement) somewhere later on code.

p.s L D was faster ;)
 
Thank you all!! Please bear with me as I am new to Siemens and trying to get a grasp on the STL programming I am faced with.

I did some digging and reading and have found out that in the code in the first post, DBD8 is loaded with P#256.0 earlier in the program in OB100. There is an FM350 counter (6ES7350-1AH01-0AE0) that has an I/O range of 256-271. What I don't get is what the program is looking at in this range, which would be bytes 264, 265, 266 and 267, I think. I am very hindered here because I don't have the old S7 software and Siemens tech support was able to convert the program to TIA Portal for me but without the hardware since the CPU was so old. Here is the part of the code including the snippet I put into the first post. #IN0 is DB100. Wouldn't DBX 41.5 and 6 be referring to B267.5 and 6? And if so, how do I know what those bits are for? If not, what do they refer to?

OPN #IN0
TAR1 DBD 0
L DBD 8
LAR1
L PID[AR1, P#8.0]
T DBD 38
A DBX 41.6
AN DBX 41.5
= DBX 26.6
JCN M000
L DW#16#40000000
T PQD[AR1, P#12.0]
L B#16#0
T DBB 4
JU M001

Sorry to ask so many questions, but I am new to Siemens. AB is my background.
 
STL is hard to read, not good on that either. Maybe something like this

OPN #IN0 //OPEN Datablock DB100 (in0)
TAR1 DBD 0 //transfer AR1 to DB100.DBD0
L DBD 8 //Load db100.dbd8 to accu (pointer P#256)
LAR1 //load AR1 with pointer value (P#256)
L PID[AR1, P#8.0] load PID264 indirectly from I/O (counter I/O)
T DBD 38 //transfer value to db100.dbd38
A DBX 41.6 //And db100.dbx41.6 bit, If DBD38 have odd number and bit is "1" then...?
AN DBX 41.5 //NAND db100.dbx41.5 bit
= DBX 26.6 // set bit db100.dbx26.6

JCN M000 // jump to label M000 if RLO = 0 (result of logic operation)
L DW#16#40000000 // load value (31st bit ="1"
T PQD[AR1, P#12.0] // set Output Q indirectly (points to 256+12 =PQD258 + 31bit, maybe Q260.6 or Q261.6?) (=set Q if db100.dbx26.6 = "1"?

L B#16#0 //load 0
T DBB 4 //transfer to db100.dbb4
JU M001 //Jump unconditionally to label M001 (skipping part of program?)
 
Last edited:
If you search the manual for "FM_NEUST", it looks like the code handles the restart acknowledgement:
If bit 11.6 = TRUE (Restart request)
and bit 11.5 = FALSE (Restart acknowledgement done)
then output bit 12.5 = TRUE (Restart acknowledgement)

These addresses refers to the data structure of the counter, actual addresses based on HW configuration are 11.x => 267.x and 12.x => 268.x.
 
If you search the manual for "FM_NEUST", it looks like the code handles the restart acknowledgement:
If bit 11.6 = TRUE (Restart request)
and bit 11.5 = FALSE (Restart acknowledgement done)
then output bit 12.5 = TRUE (Restart acknowledgement)

These addresses refers to the data structure of the counter, actual addresses based on HW configuration are 11.x => 267.x and 12.x => 268.x.

Where did you get the 11.6, 11.5 and 12.5 bits from? I see those in the manual, but how did you come up with them from the STL code? I see the 256 and 8 added to it, so I am lost as to how you got the 11 and 12.

I got the attached image from Siemens Tech Support, from the program I sent them and they converted to TIA for me.

HW Configuration.jpg
 
STL is hard to read, not good on that either. Maybe something like this

OPN #IN0 //OPEN Datablock DB100 (in0)
TAR1 DBD 0 //transfer AR1 to DB100.DBD0
L DBD 8 //Load db100.dbd8 to accu (pointer P#256)
LAR1 //load AR1 with pointer value (P#256)
L PID[AR1, P#8.0] load PID264 indirectly from I/O (counter I/O)
T DBD 38 //transfer value to db100.dbd38
A DBX 41.6 //And db100.dbx41.6 bit, If DBD38 have odd number and bit is "1" then...?
AN DBX 41.5 //NAND db100.dbx41.5 bit
= DBX 26.6 // set bit db100.dbx26.6

JCN M000 // jump to label M000 if RLO = 0 (result of logic operation)
L DW#16#40000000 // load value (31st bit ="1"
T PQD[AR1, P#12.0] // set Output Q indirectly (points to 256+12 =PQD258 + 31bit, maybe Q260.6 or Q261.6?) (=set Q if db100.dbx26.6 = "1"?

L B#16#0 //load 0
T DBB 4 //transfer to db100.dbb4
JU M001 //Jump unconditionally to label M001 (skipping part of program?)

What do you mean by referencing the 31st bit? I think you meant 256 + 12 = PQD268 but why add the +31 bit?

Sorry but this has me so confused and this hard to follow STL code isn't helping. I did not include the rest of the STL code because it is a bunch of jumps and sets and resets.
 
L DW#16#40000000 // load value (31st bit ="1"
T PQD[AR1, P#12.0] //

First value 16#40000000 loaded and if you change it to binary, you get 1 and 30 zeros ("31" bit)
This is transferred to address PQD258.
PQD258 is maded of PQW258 and PQW 259
and if you change them bytes we get bytes QB258, QB259, QB260 and QB261
These are maded of bits Q258.0-Q261.7

For more mess, double, byte and Q addressing is not on same order than on some other PLCs. (Big endian and little endian difference). On another brand it would have been Q261.6. Sorry for misleading

Q bit which is setted is Q258.6 (Byte Q258 is Highest and Q261 lowest of QD258)


On attachment I used Qx addressing, because PQx didn't showed values for me. (this depends of hardware settings on PLC)

QD258_animation.jpg
 
Last edited:
Where did you get the 11.6, 11.5 and 12.5 bits from? I see those in the manual, but how did you come up with them from the STL code? I see the 256 and 8 added to it, so I am lost as to how you got the 11 and 12.

I got the attached image from Siemens Tech Support, from the program I sent them and they converted to TIA for me.

L DBD 8
LAR1
L PID[AR1, P#8.0]
T DBD 38

This moves 4 bytes of data from module addresses to datablock:
IB264 ( 8th byte on the module data) => DBB38
IB265 ( 9th byte on the module data) => DBB39
IB266 (10th byte on the module data) => DBB40
IB267 (11th byte on the module data) => DBB41

So when the code access DBX41.5, it comes from eleventh byte of the module data structure, which is explained in manual page 58.

Principle is the same for output (bit is actually 12.6), four bytes of data (16#40000000) is written to the module data structure starting from twelfth byte. As Lare demonstrated, the bit which gets set is in first byte (12.6).
 

Similar Topics

Hi All, In Siemens S7 Classic, if I want to find the location of a physical input corresponding to a peripheral address, (say PIW488), how would...
Replies
6
Views
2,267
I have a problem with peripheral in siemens s7 . In some projekts i have a problem that areas goes over 255 and i im using code to just move...
Replies
5
Views
2,218
Hi there.. I'm building a SCADA application with an old Siemens S5 928-135U plc.. i'm using an OPC Server from SoftwareToolBox.. The proplem is...
Replies
5
Views
7,255
HI everyone, i am new to Siemens plc programming and i am in need of some help. yesterday we had an S7-1200 CPU 1214C fail to turn on an output to...
Replies
7
Views
160
Hi PLC people, think about this scenario: The PLC is somehow connected to the same network with the facilities` network. Then someone connects to...
Replies
2
Views
84
Back
Top Bottom