S7 STL Help Please

mrmss

Lifetime Supporting Member
Join Date
Aug 2005
Location
Midlands - England
Posts
101
Hi,

I have never done any STL thus far but I now need to do some inderect addressing. I'm trying to write to a DB register by having a drop-down list in a HMI as the index and then some STL to use that as a pointer. The objective is to put a value from a textbox into the right register.

I started out with a FC to read from the DB and display on HMI and then a seperate FC to write to the DB from the HMI. I decided this wasnt very efficient so I've been trying to get it into just a single FC.

I have a problem with the writing bit. It just doesnt do anything! The value never gets written to the DB and the HMI flag never gets reset.

Can anyone de-bug this for me please?

Code:
  A     "dbHMItoPLC".blParamWrite// user confirms
      FP    "Tag_131"
      JNB   Label_1
      L     "almLimHiHMIindx"    // read in pointer
      SLD   5                    // Offset for real
      LAR1
      OPN   "dbAlarmLimits"
      L     "dbPLCHMI".prmAlmLmHi
      T DBD [ AR1 , P#0.0 ]      // SEND COPY OUT
Label_1 : A BR
      R     "dbHMItoPLC".blParamWrite//reset user confirm
 
Try this - Dont have S7 to test but should be ok



A "dbHMItoPLC".blParamWrite// user confirms
FP "Tag_131"
JNB Label_1
L "almLimHiHMIindx" // read in pointer
SLD 5 // Offset for real
T #TempDw // Temp Dword storage
LAR1 #TempDw
OPN "dbAlarmLimits"
L "dbPLCHMI".prmAlmLmHi
T DBD [ AR1 , P#0.0 ] // SEND COPY OUT
CLR
="dbHMItoPLC".blParamWrite//reset user confirm
Label_1 : nop 0

 
Last edited:
Just noticed you open "dbAlarmLimits" then load "dbPLCHMI" changing your DB register.

try
LAR1 #TempDw          
L "dbPLCHMI".prmAlmLmHi
OPN "dbAlarmLimits
T DBD [ AR1 , P#0.0 ] // SEND COPY OUT

 
Every load/transfer like this:

L "dbPLCHMI".prmAlmLmHi

is the same as

OPN "dbPLCHMI"
L prmAlmLmHi


 
Hi,

...

Code:
  A     "dbHMItoPLC".blParamWrite// user confirms
      FP    "Tag_131"
      JNB   Label_1
      L     "almLimHiHMIindx"    // read in pointer
      SLD   5                    // Offset for real
      LAR1
      OPN   "dbAlarmLimits"
      [B]L     "dbPLCHMI".prmAlmLmHi[/B]
      T DBD [ AR1 , P#0.0 ]      // SEND COPY OUT
Label_1 : A BR
      R     "dbHMItoPLC".blParamWrite//reset user confirm

This one modifies currently open DB.
 

Similar Topics

Hi I wondered if anyone could help translate the following two networks into Lad as they don't directly translate. I've had a go myself but need...
Replies
20
Views
7,636
Hi all I am new here and this is my first post. If I am honest, necessity drove me to find this site, however I have to say that after having...
Replies
19
Views
10,467
Hello nice to meet you, im new in here, I'm currently trying to convert code written in STL for a S7-400 to SCL for an S7-1500, because when i run...
Replies
5
Views
320
Hi! I am working on a project were we will be replacing an 300 CPU with a 1500 CPU and we are working on migrating / converting code. There is a...
Replies
9
Views
1,079
Hello everyone, friends. I asked a similar question before, and you helped, but I'm very weak in STL and I'm having trouble learning it. What I...
Replies
2
Views
741
Back
Top Bottom