Create own library in STEP7

darko79

Member
Join Date
Feb 2006
Location
Serbia
Posts
10
HI,
I need to create my library in STEP 7, where I integrate some routine in FB.But I need to have one dedicated DB with this FB. But when I instance FB in my project OB I cant see this DB.Whats problem?
Thanks
 
Hi darko79.

When you insert your homemade FB in a new rung in OB1, you have to specify an instance DB. STEP7 will automatically ask to create the DB when you specify a new DB address, so be sure to accept this.
When done, go to the blocks window in the manager, and you can see that your new DB has been added.
 
Thanks,but

Hi, but I need one more DB where I store my mesurements with name of measurements value, not only instance DB.
Thakns
 
SimonGoldsworthy said:
Why not store the measurements in the instance DB as well ?

Ok you can do this. But what if the number of measurements is variable? Can this also be done with an instance DB?
 
Again

I have 12 measurements and 18 parameters. I want to store them in separate DB, with values, comment for each variable.And I dont know how to realize it.
Thanks
 
Hi Darko.

There are several ways to what you want to do.
The memorised data could be kept within the instance DB, but it could also be stored in another shared DB.
In the latter case, you pass the address of the shared DB to the FB as a pointer via an IN pin on the FB. Inside the FB you can then access the shared DB via the pointer.
If you havent worked with pointers before then I recommend the Hans Berger book "automating with STEP7 in STL and SCL". There is a CD with program examples with the book.
If working with pointers is a too big step, then simply keeping everything within the same instance DB could be the solution for you.
 
Thanks, Jasper

And you said if I use pointer, when I insert for exaple my FB12 from my library Darko, I will have in project FB12 and DB12 and DB 13 for examle.Thanks
 
Hi again Darko.

Just to remind you of a possible simple solution to your problem (it was not clear enough in my previous post):
There is nothing wrong with calling your FB several times, and then each time assign it a new instance DB.
 
again

Hi,Jasper
Tell me, why when I create FB in library and use DB in it, and then use its FB in project link DB and include them in project automatic.Can you explain me better how to use pointer in my case, simple code for example. Thanks
 
darko79 said:
Tell me, why when I create FB in library and use DB in it, and then use its FB in project link DB and include them in project automatic.
Thats how FBs + instance DBs work.
You define the FB, including its variable declaration.
Then, when you insert the FB in the project, an instance DB that fits the variable declaration must be assigned.
That the creation of the instance DB is more or less automatic is just a help for you.

darko79 said:
Can you explain me better how to use pointer in my case, simple code for example.
I was afraid that you would ask that. Thats why I suggested the Hans Berger book. There are so many possibilities with pointers, that I would first have to know exactly what you want to do, and then make an example.
The following is guessing what you want to do:
If you want to store measurements variables consequtively in the shared DB, then there is an example with a FOR-NEXT loop in the Hans Berger book. I could try to look it up for you, but you will have to wait until I have more time then. Or get the book yourself. It is worth the money.
 
Again x

Hi,Jasper
I attached my libs. If you can help me see it.FB is a toplevel FB.From FB10 I call others FB and FC and store measurements result in DB11,DB12,DB13. I need to use it as library.Only to insert FB10 in some project in one network and watch DB11, DB12, DB13 in debug mode. Thanks,a lot
 
Last edited:
Hi Darko.

Have you attached the right project ?
In FB10 you only call the standard functions TONR, P_SEND and P_RECV.
You do not call any other blocks.

But it is definitely possible to create a library as you suggest.
You download the necessary blocks, and then you just call FB10 once to make it work.

A comment:
Your FB10 could just as well have been an FC. You do not declare any STAT variables.
If you change FB10 to an FC you do not have to assign an instance DB to your library block.
 
Again

Hi,Jasper
I forgot.I need to call FB117 and FB118 from FB10.Its to prepare what to send, and after that analyse receive message.And what I need to do, when I insert FB10 in project to have all FBs,FCs and DBs which is in Carbo100 libs. I need to give it to someone to use it simple, just to call FB10 and to watch DB11,DB12 and DB13 in yours project.Thanks a lot.
 
As Jesper pointed out you don't need a FB, a FC will do fine. You need to create a send and receive DB where all the info in and out is stored and then a couple of networks to move data that you need.

There's not so much data so it would be easier to load and transfer what you need.

A little trick to speed things up is also to open one of the blocks as an instance DB (it doesn't need to be an IDB).

For example, you want to mive data from DB20 to DB11, neither are an instance DB associated with a FB.

OPN DB20 //Opens DB20 as normal
OPN DI11 //Opens Db11 as an instance DB, you now have two DB's open at the same time.

L DBD 2 // Load bytes 2,3,4 and 5 into accu
T DID 2 // Transfer into instance data from byte 2.

Of course if you did this within an FB you would have to read the altready open DI first and open it again once your finished transferring, best to do only in FC's.

L DINO // reads the current instance DB thats open.

saving that in a word and using it later recovers your proper DI, a crash is likely if you didn't.

i.e.

L DINO
T TEMP_WORD

Transfer code..............
............ End

OPN DI[TEMP_WORD]
 
Last edited:

Similar Topics

Would like to ask .. if anyone here know about creating own library or function block on ProWORX NxT ? I have a backup of ProWORX NxT project...
Replies
3
Views
1,041
So I have ACM and I was wanting to use it to manage reusable portions of my programs, but unless I am missing something libraries have to be in...
Replies
0
Views
1,429
Anyone have some advice? I build the project and have no errors. I can login and logout, but never have the ability to create a boot project or...
Replies
3
Views
1,982
Does anyone create their own asset tags for Equipment. I.E. the Stainless with the black etched letters? I am considering doing this for a job...
Replies
5
Views
1,606
Howdy Folks Anyone out there experienced with AdvanceHMI and creating one's own components in Visual Basic? I've downloaded a few trial HMI...
Replies
2
Views
2,181
Back
Top Bottom