Siemens S7 300 CREA_DBL and READ_DBL and WRIT_DBL any pointer problem

Szabycsek

Member
Join Date
Nov 2016
Location
Jászjákóhalma
Posts
7
Hy Experts,

I have some problem with this intsructions:

- CREA_DBL

- READ_DBL

- WRIT_DBL

I want to create a recipie management in 314 CPU via TIA Portal V13 SP1 based on MMC card with STL language. I can write the user program by manuals. Only have one same problem for three instruction. Program is working when I write direct andress (not any pointer) to the source or destinatination area like this %DB500 or anything else.
But... I must need the any pointer beacuse the source and the destionation are variables in HMI.
Anybody can help me how to create the any pointer for three instructions?

The working method:

DB 500 is an actual recipie on PLC CPU (working memory).

DB501...DB600 are stored recipies on MMC card (load memory).

User can select for example DB555 recipe and load it. If DB555 not exist CREA_DBL creat it and after READ_DBL read it to DB500. If exist only READ_DBL read it to DB500.

Save method is the same... DB500 save to DB555 for example. If DB555 not exist CREA_DBL create it and after WRIT_DBL write DB500 to DB555. If exist only WRIT_DBL write DB500 to DB555.

The DB exist scan i used TEST_DB instruction and it"s working fine. Only the any pointers not working...


Thanks for a help :)

Here is a section of code with WRIT_DBL instruction:
Code:
//Create source any pointer
LAR1  P##FOR_ANY

L     B#16#10
T LB [ AR1 , P#0.0 ]

L     B#16#19
T LB [ AR1 , P#1.0 ]

L     1
T LW [ AR1 , P#2.0 ]

L     0
T LW [ AR1 , P#4.0 ]

L     W#16#1900
T LW [ AR1 , P#6.0 ]
L     #DB_FOR
T LW [ AR1 , P#8.0 ]


//Destination any pointer
LAR1  P##CEL_ANY

L     B#16#10
T LB [ AR1 , P#0.0 ]

L     B#16#19
T LB [ AR1 , P#1.0 ]

L     1
T LW [ AR1 , P#2.0 ]

L     0
T LW [ AR1 , P#4.0 ]

L     W#16#1900
T LW [ AR1 , P#6.0 ]

L     #DB_CEL_W
T LW [ AR1 , P#8.0 ]

CALL  WRIT_DBL
src_type:=Any
REQ     :=#REQ
SRCBLK  :=#FOR_ANY
RET_VAL :=#DB_STATUS
BUSY    :=#DB_BUSY
DSTBLK  :=#CEL_ANY
 
You have the format for the any pointer wrong
Any.jpg

This will create a pointer to db500 dbx0.0 total length of db

Code:
L     P##FOR_ANY
      LAR1  

      OPN   DB   500
      L     DBLG
      T     #tDBLength
      L     DBNO
      T     #tDBNumber

// S7 and type
      L     W#16#1002                   // Type BYTE
      T     W [AR1,P#0.0]

// Repetion factor
      L     #tDBLength
      T     W [AR1,P#2.0]

// DBNumber
      L     #tDBNumber
      T     W [AR1,P#4.0]

// Pointer starting at byte 0
      L     P#DBX 0.0
      T     D [AR1,P#6.0]
 
Last edited:

Similar Topics

Hello all. I have an ESA HMI that is connected to a Simatic S7-300 (CPU312). I have uploaded the program from the PLC which is written with Step7...
Replies
6
Views
1,424
Hello. There is a problem with Siemens S7 300. We got a replacement PLC but it does not run the program from the MMC. The new PLC is dated 2011...
Replies
3
Views
672
Hi to all, Our company does not usually use Siemens PLCs, but have a press with one in it. We are trying to change the IP address in our Simatic...
Replies
2
Views
1,061
G'day guys, I am setting up a s7-300 as a test rig for the workshop and when I downloaded the PLC is not going into run mode, I keep getting a...
Replies
35
Views
5,164
I am trying to write just MSEC to S7 300 Controller date/time using OI.SIDIRECT Aveva communication driver? The old HMI (WINCC) tag is assigned...
Replies
1
Views
1,052
Back
Top Bottom