S7 - Get DB symbol as string via instruction

Cowmanator

Member
Join Date
Sep 2015
Location
Birmingham
Posts
21
Hi Chaps

I am wondering if there is an instruction that will allow me to get the symbolic name of a db if I know the number ?? It would help me so much

Thanks for any replys
 
I dont't think this is possible. The symbols exist only in your offline project, not in the PLC, so this info can't be accessed at runtime.
What are you trying to achieve anyway?
 
My company have a plc code standard (not easily changed), the standard is for a conveyor system. lots of conveyor beds each using a set udt/db which is heavily integrated into a concept and not easily changed (this does not contain the conveyor bed number). I want to get error and availability data for each bed on systems that we have already implemented. so I have written a nice little bit of code that will get this information for me from the said DB's (using for loops to make it faster). the problem is linking the datablock to the conveyor bed position. I am currently handballing the db number in and associating it with the position, then running the loops. I would like to try and use the symbolic info to get the position number that is associated with the db. Hope that this makes sense
 
I will note that what wimpiesplc said is true for S7-300/400 PLCs, but not necesarily for the newer 1200/1500 systems. The newer PLCs do store the symbol names, and this information can be accessed by instructions such as "GetSymbolPath".
 
I do think you can get DB number, might that work for you?
 
You could set up another DB that contains the DB numbers and the associated symbol names as strings. Your code would have to search for a matching DB number and copy the string for you to use in your program. You would have to populate the DB manually of course.
 
I will note that what wimpiesplc said is true for S7-300/400 PLCs, but not necesarily for the newer 1200/1500 systems. The newer PLCs do store the symbol names, and this information can be accessed by instructions such as "GetSymbolPath".

I knew it stored the symbols, and the project, but was under the impression you couldn't access them. But learned a new thing about GetSymbolPath, thanks. It appears it doesn't work on a 1200 though.
I can get a string like 'DB_name.indexed[4]' So I guess you can extract this '4' from it and use it further
 

Similar Topics

Hello everyone, Recently, my Archestra IDE shut down while I was editing. After restarting the IDE, I noticed warning symbols under my opened...
Replies
1
Views
94
I was looking for this function, so that i doesn´t need to do it in the PLC. If there are an alarm in the alarm list, i want to flash the...
Replies
2
Views
488
Hello, fairly new to plcs I’m tasked with installing a PE to a micrologix1200, in the attached picture I/14 is the PE I’m installing it’s going to...
Replies
6
Views
936
Hello Thank you all for your support. I am actually experience same issues with TIA portal V17 update5 as well as V18. The problem is with the...
Replies
0
Views
794
Hi all, I've inherited someone else's program and can't for the life of me figure out his use of the # symbol in one of his structured text...
Replies
5
Views
1,909
Back
Top Bottom