3/7/2020 12:21 AM | |
Joined: 6/6/2017 Last visit: 7/20/2024 Posts: 44 Rating: (0) |
Hi, experts I have similar problem. I need to open a DB to use different datas in the same FC. I often use CPU 300 that supports STL, but now i'm using CPU 1200. OPN #Motor_DB // Motor_DB is a input of the FC block that corresponds of one of many motors T DBW 24 // Example of information that I need to read from DB T #T_TempValue // Internal temp value that will be used in FC I don't know a way to do it in ladder and I don't know how to program in SCL. Please, any information will help me a lot. Thanks
------------------------------------------------------------------------------------------ |
Last edited by: Jen_Moderator at: 03/09/2020 06:05:02New subject after splitting |
|
3/16/2020 6:14 PM | |
Joined: 6/25/2018 Last visit: 7/19/2024 Posts: 60 Rating: (1) |
I've never used STL and I'm not sure i understand the problem, but accessing variables in a DB is just a matter of doing it...? Either create tag in your FC that you connect the db_motor.temp to, or use it directly. edit If you have a big Db for a lot of motors and 1 FC for each motor, i would create a data type that contains all the motor varables, and in the Db create a variable that is an array of that data type. Create a variable in the FC of that data type. and connect Db.motordata[motornr] to the input. Frank |
Last edited by: Frank_Aa at: 03/16/2020 21:03:32 |
|
3/16/2020 9:16 PM | |
Joined: 7/24/2014 Last visit: 12/4/2023 Posts: 392 Rating: (66) |
Hi Letedesque try the following HOW TO OPEN DB IN SCL
|
Thanks and Regards |
|
3/17/2020 9:00 AM | |
Joined: 9/23/2005 Last visit: 8/7/2024 Posts: 4660 Rating: (718) |
I can't understand why so many stick to DBs and absolute addressing. It's high time you learnt new tricks. Create an UDT (PLC data type), then in a DB create array of the UDT. You can use global constants to give indices meaningful names. Then pass selected UDT to na FC as IN/OUT and you are done. Here is some explanation and examples, chapter 3.6.2. If it's not enough just ask. I know it needs extra work. But since the original code is in STL and target is S7-1200 it has to be done anyway. And once done it will make your further life easier.
|
Regards, |
|
3/18/2020 3:21 PM | |
Joined: 7/7/2010 Last visit: 8/7/2024 Posts: 15064 Rating: (2404)
|
I agree with prior posting about suggesting a different way of thinking with TIA Portal and S7-1200/1500 PLCs where the old S7-300/400 mindset is not _required_ to make a project successful and easy to program, troubleshoot, document, and explain to others - especially anyone who shunned assembly language or even the idea of it.. SCL programming and using parameters passed into the FC - or creating an FB so each instance of FB usage creates its own little bit memory dedicated to that instance, like MotorControl_FB with instances or calls to control motor #1, motor #2, motor #3, and so on where the #'s can have human readable names by creating user constants and defining InfeedConv = 1, OutfeedConv = 2, HoldingTableConv = 3, RejectConv = 4, and so on. Trying to squeeze old ways of thinking - forced upon users because of the hardware architecture - is really going to help in the log run. Unless you are retiring this year or early next year, it is probably worth time investing in the suggestions made in the prior posts and drop STL from your vocabulary except when working on older s7-300 / 400 systems, and then only with a look of "oh, I'm so sick of STL..."
|
science guy |
|
This contribution was helpful to1 thankful Users |
Follow us on