S7 313C function block in STL

dahnuguy

Member
Join Date
Mar 2007
Location
SC
Posts
720
I have a FB already written in a sample project.

FB7 and FB8 and FB80.

FB7 and FB8 are called by FB80.

I would like to change the names on FB7 and 8 to FB77 and FB78 to eliminate a conflict in my other program and also so I can easily tell which FB7 and FB8 are which.

Siemens has more than one FB7 that does the same thing, but only one works. So I would like to rename the one that works so I can easily tell which is which.

The tricky bit is the fact that FB80 calls FB7 and FB8 and uses an instance DB for all 3 FBs.

And the FBs are all in STL. WHich I am not expert in, but I can follow along.

I added the new blocks to the stat area of FB80 the same way the others were.

I changed the names and updated the calls and went through the FB80 code and used find and replace to update all the FB7 and FB8 references to FB77 and FB78 respectively.

Everything looks great except for one variable near the bottom of FB80.

The line of code refers to a bool in the stat area of FB8 named "null".

But there is no such variable inthe actual FB!

It appers to be a reset of some sort in the code.

I made a copy of the original FB8 and just renamed it FB78 so anything in the old one should be in the new one.

Another odd thing is the syntax which I thought was consistant in STL.

The old FB has a line like this "AN #fb8_DONE"

But when I change the block number in the reference it will not compile unless I change the syntax to this "AN #fb_78.DONE"

Original: "AN #fb8_DONE"

New edit: "AN #fb78_DONE"
does not work even though the new block is named the same as the old block with only the addition of the "7"

Works :#fb_78.DONE"
Got this syntax by copying the variable from the interface area and pasting it in the STL code.

That part is odd and I would love to hear why the two are different.

But the real problem is this line:
JC s8f
A #fb8_null
R #fb8_null
S #fb_78.REQ
JC stat


There is no fb8 null shown in the stat area! What does this reference point to?


I seem to remember running into something similar when I changed a FB before. Like if I removed some variable and left a reference to it, it would compile and just ignore the reference. But it would not allow a new use of the reference. This is a vague memory.

Here are my 2 questions:

1) What does "#fb8_null" refer to in this FB?

2) Why must I use a different syntax to make the same command work?

See attachment for the interface area of the FB and the code reference.
Notice all those " #fb_78.****" references in there? Those used to reference fb8.

fb8 null.jpg
 
I did not fully follow how did you change block nums, did you also update block instance declarations to point to fb77 and fb78?

Does that #fb8_null come in red? if not it should be somewhere in variable declarations, look for temp area also.

Do you have link for that sample project, someone will look for correct procedure to change block nums im sure.
 
Last edited:
here is FB80 with my edits the null in question is at the end

I did not fully follow how did you change block nums, did you also update block instance declarations to point to fb77 and fb78?

Does that #fb8_null come in red? if not it should be somewhere in variable declarations, look for temp area also.

Do you have link for that sample project, someone will look for correct procedure to change block nums im sure.

did you also update block instance declarations to point to fb77 and fb78? yes

Does that #fb8_null come in red? no it is original code and points to the FB8 area which I did not delete.

if not it should be somewhere in variable declarations, look for temp area also.
Yeah , that's my question, "it should" be there but it is not. Looked through every part of the original FB including the temp.

The sample project is on the modbus slave CD, but the blocks you find online could be the ones that do not work.

I include the block source as a text file.
 
Last edited:
rewire? should work, didn't

Well after looking at all the stats used that I will have to rename I decided to just rename my blocks instead.

I thought rewire would fix the original problem in the first post, but after using rewire to change FB7 to FB77, I opened FB80 and the calls for FB7 and FB8 were still there along with the other refrences.

So what exactly does rewire do then?

Help file isn't very deep on this one, it assumes everything works as usual.

Help desk advised me to use rewire also.
 

Similar Topics

hi... i have an issue in s7 300 plc, while we run the machine(in idle there is no fault) , plc cpu goes in SF mode, after restart the power cycle...
Replies
2
Views
117
Dear experts, I have the following setup: CPU-313C (6ES7313-5BF03-0AB0 V2.6) + CP343-1 (6GK7343-1EX30-0XE0 V2.0) communicating with Siemens PC...
Replies
7
Views
2,690
Hello Every one I am trying to connect the encoder with siemen's 300 plc but dont know how to do it... Could some one send me the connection of...
Replies
4
Views
2,200
hello Friend There is one old system with S7 300 CPU which is password protected and I dont know the password. Now I want to remove the password...
Replies
6
Views
5,917
Hi guys, I have CPU S7-300-313C ( Cat No - 6ES7-313-5BE00-0AB0) DI24/DO16 and AI5/AO2. when I am trying to configure and use the AO channel PQW...
Replies
4
Views
2,560
Back
Top Bottom