S7 Pointers - Why doesnt this work?

STL???

Member
Join Date
Sep 2005
Location
UK
Posts
879
Hi Folks,
I have wrote a FC which returns Dint Data based on a Station number (Byte)

ie
St1 DBD0
St2 DBD4
etc
St14 DBD52

First i wrote the following which doesn't work:

L #ByStationNo
+ -1
L 4
*D
SLD 3
T #tDwOffset

LAR1 P##tDwOffset

OPN #DbTargets
L DBD [AR1,P#0.0]
T #DiTarget




Ar1 value was L0.0 so i changed approach to this:

L #ByStationNo
+ -1
L 4
*D
SLD 3
LAR1

OPN #DbTargets
L DBD [AR1,P#0.0]
T #DiTarget



Which works fine - Could someone enlighten me to the problem with the first program?
 
Last edited:
I should have added the following:
IN
ByStationNo - Byte
DbTargets - Block_DB

OUT
DiTarget - Dint

TEMP
tDwOffset - Dword
 
Hi Folks,
I have wrote a FC which returns Dint Data based on a Station number (Byte)

ie
St1 DBD0
St2 DBD4
etc
St14 DBD52

First i wrote the following which doesn't work:

L #ByStationNo
+ -1
L 4
*D
SLD 3
T #tDwOffset

LAR1 P##tDwOffset
Here you load the pointer to your calculations address instead for the calculation itself. If you skip P# it should be OK.
You can activate monitoring of AR1 and see the actual adresses.

OPN #DbTargets
L DBD [AR1,P#0.0]
T #DiTarget




Ar1 value was L0.0 so i changed approach to this:

L #ByStationNo
+ -1
L 4
*D
SLD 3
LAR1

OPN #DbTargets
L DBD [AR1,P#0.0]
T #DiTarget



Which works fine - Could someone enlighten me to the problem with the first program?

Kalle
 

Similar Topics

Hello, I've just came out of a call where a program that was modified two weeks ago threw the processor into fault. The program has been done...
Replies
9
Views
3,475
I'm trying to get a 5069-L306er to talk to a Automation Direct ProSence Controller by using RA's AOI for modbus client but its stuck not getting a...
Replies
9
Views
1,901
The last time I did anything with Wonderware was just after the dot com bust. Boy, I feel old. Anyway, it looks like I will get the chance to...
Replies
3
Views
1,536
Hi guys, Some pointers needed: Having PC with WIN7 pro X64 and Amsamotion clone of 6ES7 972-0CB20-0XA0 cable and need to backup VIPA cpu...
Replies
14
Views
3,143
Is there any form of Reference Type or Pointer Type like Codesys has? I am aware that you can nut a tag in the index of an array reference. but...
Replies
7
Views
1,916
Back
Top Bottom