Coping/storing the pointer-address of a DB into a variable

rick-brinkman

Member
Join Date
Dec 2012
Location
Overijssel
Posts
21
Hello all,

I need to store the pointer-address of a database in an “ANY” variable. How can I do this?

Example:
When a variable is equal to 11 the address should be P#DB111.DBX0.0 BYTE200
When a variable is equal to 12 the address should be P#DB112.DBX0.0 BYTE200
When a variable is equal to 13 the address should be P#DB113.DBX0.0 BYTE200
ETC…

So how can I store the pointer-address (which varies according to a value) into an “ANY” variable so I can use it at the input of a SFC68??

Thanks in advance!

~Working with Step7, Language STL~
 
Thanks for your quick response!

I tried the code that u suggested but my PLC jumps in the stop mode now.
“Area Error when writing” – Event ID 16#2525

Help on Event:
Cause:
You have used an illegal address range for area-crossing indirect addressing. The area ID of the access address (bits 24 to 31) is not permitted.

To correct or avoid errors:
Use a pointer with a correct area ID.
 
Well, I found this thread:
http://www.plctalk.com/qanda/showthread.php?t=60187

The conclusion that I drew from it was that the problem lies within the PLC and its firmware. The PLC I use is a CPU413-2DP (413-2XG02-0AB0). So I downloaded the program code that “L D..” suggested into a second PLC (CPU 314) and indeed, in this PLC the error doesn’t occur!

But this doesn’t solve my problem.. The program code has to work in the CPU 413.
So what must I do? Install new firmware ( I don’t know how)?


By the way.. when I look in the “General” tab of the “module information” I don’t see any firmware installed.. see picture
 
I tried the code that u suggested but my PLC jumps in the stop mode now.
“Area Error when writing” – Event ID 16#2525

Help on Event:
Cause:
You have used an illegal address range for area-crossing indirect addressing. The area ID of the access address (bits 24 to 31) is not permitted.

To correct or avoid errors:
Use a pointer with a correct area ID.

Which instruction caused the error? - from the diagnostic buffer you should be able to open the block online and the cursor will point to the instruction.
I'm guessing that you will have to replace the T W[AR1 instructions with T LW[AR1
(and of course the T D[AR1 with T LD[AR1....) in network 2 from my example.
 
The error was caused by either one of all transfer line. So indeed you were right again! I changed all the "T W[AR1,P#x.y]." lines into
"T LW[AR1,P#x,y]" which solved the cause of the error.

Hoping the "ANY" pointer would finally work.. but unfortunately it still didn't. because my SFC68 block jumps into error 8092h which is caused by an illegal length for SD or SD=NIL.

When I hold my mouse on the "ANY" pointer (at input VAR_ADDR) it says "Access width 2 bytes" So somehow it still doesn’t work!

See the attachment for my code
(at input "SD" of the SFC block I have: P#DB110.DBX 0.0 BYTE 200)
 

Similar Topics

Hello All, need one help , looking for a example which can help me to write following code in Studio 5000 ladder logic. I have 2 String...
Replies
14
Views
10,517
Hello I am looking for some assistance in moving input data into a data block using Siemens TIA Portal V13. I have a device connected via...
Replies
2
Views
5,978
I'm wanting to copy the input value of several thermocouple NT8 modules into a floating or interger file to save having to move each input value...
Replies
4
Views
1,957
HI all, I have a backup from a Series 7000 Cognex camera. I am trying to restore and see the vision tools used in the job. Can I restore those...
Replies
0
Views
72
Hello, I have an int variable that updates the value every second. I want to store the 100 values in an array. Array should keep storing the...
Replies
7
Views
1,005
Back
Top Bottom