Sign in to follow this  
Followers 0
Guest cmulder

Detecting Step 7 DB numbers in FBD

4 posts in this topic

Hi all, I am programming with Step 7, v 5.2, servicepack 1. I have created an FB, with (amongst others) a BLOCK_DB for an input. Within the created FB I want to detect the actual number of the DB. I know that when using SCL one can just call the function BLOCK_DB_TO_WORD. However, when programming in FBD this function is not available (or at least, I can not find it). How can I easily detect the number of a BLOCK_DB when programming in FBD? Thanks in advance, Caspar

Share this post


Link to post
Share on other sites
Here is a bit of code from an example Klaus gave me for a different project but it loads an input value an then finds & opens the DB. Input:  BoolIn (Bool) // Read In Pointer info     L     P##BoolIn              // Load BoolIn as a Pointer     LAR1                         // Into Address Register // Determine & Open Data Block     L     W [AR1,P#0.0]          // Loads the DB Number     T     #DB_Number             // Transfer Data Block Number To Temp Area     OPN   DB [#DB_Number]        // Opens the Data Block

Share this post


Link to post
Share on other sites
I couldn't find one either, so I made you one. Check it out. In FC1, I call FC112, which is the READ_DB function in FBD. If you're a good boy, for Christmas I will send you the source code. Read_db_.zip

Share this post


Link to post
Share on other sites
You must do it in STL or SCL - no other choice. In SCL you can use the code below and then call it in FBD. FUNCTION FC10: word // Block Parameters VAR_INPUT // Input Parameters in:block_db; END_VAR VAR_IN_OUT // I/O Parameters END_VAR VAR_OUTPUT // Output Parameters END_VAR VAR_TEMP // Temporary Variables END_VAR BEGIN // Code Section ; FC10:= block_db_to_word(in); END_FUNCTION

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0