Help for explain of S7-300 Program example

tulip

Member
Join Date
Oct 2005
Location
ist
Posts
236
OPN DB 36
L #IN0 // Constant number of drive
L 12
*I
+ 8
SLD 3
LAR1
L DBW [AR1,P#10.0]
T #TEMP2 // profibus address of drive
L DBW [AR1,P#6.0]
+ 26
T MW 210
LAR1 P##TEMP1
L W#16#1002
T LW [AR1,P#0.0]
L 12
T LW [AR1,P#2.0]
L 37
T LW [AR1,P#4.0]
L MW 210
SLD 3
L DW#16#84000000
OD
T LD [AR1,P#6.0]
CALL "DPWR_DAT" //SFC15 write consistent data to a DP standard slave)
LADDR :=#TEMP2
RECORD :=#TEMP1
RET_VAL:=#TEMP3
BE
This program controlling a drive on DP but I could not understand how is working?Because drive (siemens masterdrive)are ready for operate and setpoint giving but it is not operating.Thanks in advance.
 
OPN DB 36
L #IN0 // Constant number of drive
L 12
*I
+ 8
SLD 3
LAR1


This loads the start address of the data for a drive into AR1. Each Drive has a 12 byte data area in DB36.

INO Start Address
0 8
1 20
2 32... etc


L DBW [AR1,P#10.0]
T #TEMP2 // profibus address of drive


The 10th and 11th bytes form a word which contains the profibus address. (eg INO=1, address of word = DB36.DBW30)

L DBW [AR1,P#6.0]
+ 26
T MW 210


26 is added to contents of word address off set by 6 bytes (eg INO=1, address of word = DB36.DBW26) and stored in MW210.

LAR1 P##TEMP1
L W#16#1002 // S7 Format type BYTE
T LW [AR1,P#0.0]
L 12 // Length = 12
T LW [AR1,P#2.0]
L 37 // DB = 37
T LW [AR1,P#4.0]
L MW 210 // Contents of MW210 = word address
SLD 3
L DW#16#84000000 // Make DB Type
OD
T LD [AR1,P#6.0]


Loads a pointer to TEMP1 (a TEMP in ANY format) and an address is set up. (P#DB37.DBX[MW210].0 byte 12)

CALL "DPWR_DAT" //SFC15 write consistent data to a DP standard slave)
LADDR :=#TEMP2
RECORD :=#TEMP1
RET_VAL:=#TEMP3
BE

Then calls the DP write SFC
 
Peter thanks.I understand what you say except one of them.
If DB36.DBW26=60 (INT),then
L DBW [AR1,P#6.0]
+ 26
T MW 210

MW210 Then will be 60 or 86?
The other question in SFC15,RECORD :=#TEMP1 line
Can you explain this line clearly.
 
Peter thanks.I understand what you say except one of them.
If DB36.DBW26=60 (INT),then
L DBW [AR1,P#6.0]
+ 26
T MW 210

MW210 Then will be 60 or 86?
The other question in SFC15,RECORD :=#TEMP1 line
Can you explain this line clearly.


First part, 86.

Second Part, RECORD is an ANY pointer to the data to be sent across Profibus.

From F1 help on SFC15

'Source area for the user data to be
written. This must be exactly as long as
you configured for the selected module
with STEP 7. Only the BYTE
data type is permitted.'

It looks like its expecting 12 bytes as that is the length hard coded.

It could be written directly, such as P#DB37.DBX86.0 BYTE 12, but as the destination is changing the ANY pointer is built for the destination.

Therefore a TEMP ANY variable which the programmer has called TEMP1 has been created and the programmer builds the source address into that ANY variable.
 

Similar Topics

Hi, I am new to PLC's and I have a program that I need a little help with an explanation of how it runs line by line. I understand the overview...
Replies
30
Views
6,957
Could anyone explain the code for me please, Step by step Thank you , ----------------------------- FUNCTION FC 3 : VOID TITLE = VERSION ...
Replies
0
Views
1,537
I understand this instruction a little bit , but could someone explain it a little more. It is a compare instruction in a AB ControlLogix. I will...
Replies
4
Views
2,756
Hi, I have old panelview 1200 the programme was writen using PDS . I need explaination on how to download programme into this panelview...
Replies
0
Views
3,944
Hi Everyone, i was hoping for a little help with this module. i have data that needs to be read from a different plc through the Modbus plus...
Replies
9
Views
110
Back
Top Bottom