FB - instance data, write to static data??

Kasperv79

Member
Join Date
Mar 2012
Location
Copenhagen
Posts
48
Hi Guys.

I got an FB1 with some different functions. one of them is to write a string to an Out.

FB1 is called multiple times in FB2.


In FB1 i do move the internal string to the output string like this:

CALL "BLKMOV"
SRCBLK :=#StrTimeTmp
RET_VAL:=#retval
DSTBLK :=#StringTime

A string is as you proberly know build up with n Chars + 2 bytes. 1 byte is lenght of string and byte 2 is actual size/chars in string.

in my example the string is always formated to 11 chars. the problem is that byte 2 is not being updated with the number 11)

When my Scada system (iFix 5.8 + kepserver is driver) reads a string value it reads an empty string, unless i do update my byte 2 with the actual number of chars in my string.

my #StrTimeTmp is located in STAT area starting at 28.0

So i Thought i could du this:

L 11
L DBB 29 (Byte 2)?

also tryid with DIB 29.

My problem is that its only working with the first instance in FB2??
 
One method would be to declare your strings initial value to 11 spaces, thus making it 11 chars long.

str1.jpg
 
..or you can indirect addressing to modify the string length for each instance. See example program attached.
 
Fix the problem at the source instead of patching the error at another location.
You would ask, "why isnt the input string formatted correctly ?".
Where does the variable that is connected to the input pin #StrTimeTmp originate from ?
 

Similar Topics

Hello all, Newbie in Siemens, I want to ask if there will be any issue when I download the instance datablock of a certain Function block? Also...
Replies
6
Views
4,415
Can someone please confirm how Generic Ethernet Module 'Configuration Instance' data in an AB Logix processor is used? More specifically...I have...
Replies
4
Views
5,674
Hi, I want to know how to read a WORD from the STAT of an multi instance FB and move it to a WORD defined in OUT or IN_OUT. If I don't use multi...
Replies
13
Views
4,833
Hello, i have an issue in opening the instance datablock in siemens step7. all the FB,FC and other normal DB were opening. but none of the...
Replies
2
Views
2,275
I have declared an array of bool in my STAT Instead of using Logic OR to chech if any of the bits in the array are true. I Would simply like to...
Replies
3
Views
1,628
Back
Top Bottom