Saving static var into db with array's

henkkas

Member
Join Date
Mar 2006
Location
Achel
Posts
4
I am trying to store the static var within an FB, wich is in the form of a udt, to a db with array's with a fixed number of bytes.
I use SFC20 wich should be able to tranfser data from diff. types, I thought, but a get an error at the end of SFC20 call, telling me "Invalid or missing function type". Can anyone tell me why??

It looks something like this:

FUNCTION_BLOCK BackupRestore
TITLE =
//Transfer bytes of data between local var and data blocks using SFC20
//
VAR
LocalData : UDT_x; // Max. size of local data must be 100 byte !!!
END_VAR

VAR
tIntResult : INT;
END_VAR

BEGIN

// Restore data
BLKMOV( SrcBlk := LocalData,
Ret_Val := t_IntResult,
DstBlk := "DB_BackupRestore".Data[1] // .Data[x] = 100 bytes
);

//
//
//
//
//
//
//
//
//
//
//
//




// Backup data
BLKMOV( SrcBlk := "DB_BackupRestore".Data[1],
Ret_Val := t_IntResult,
DstBlk := LocalData
);


END_FUNCTION_BLOCK
 
As you can see, the STL looks very similar, I just had to add the word call to make it compile in STL

Code:
FUNCTION_BLOCK fb99
TITLE =
//Transfer bytes of data between local var and data blocks using SFC20
//
VAR
tIntResult : INT;
END_VAR


VAR_TEMP
LocalData : UDT1; // Max. size of local data must be 100 byte !!!
END_VAR


BEGIN

// Restore data
call SFC20( SrcBlk := LocalData,
Ret_Val := tIntResult,
DstBlk := "DB_BackupRestore".Data[1] // .Data[x] = 100 bytes
);

// Backup data
call SFC20( SrcBlk := "DB_BackupRestore".Data[1],
Ret_Val := tIntResult,
DstBlk := Localdata
);


END_FUNCTION_BLOCK
 
As you can see, the STL looks very similar, I just had to add the word call to make it compile in STL

Code:
FUNCTION_BLOCK fb99
TITLE =
//Transfer bytes of data between local var and data blocks using SFC20
//
VAR
tIntResult : INT;
END_VAR


VAR_TEMP
LocalData : UDT1; // Max. size of local data must be 100 byte !!!
END_VAR


BEGIN

// Restore data
call SFC20( SrcBlk := LocalData,
Ret_Val := tIntResult,
DstBlk := "DB_BackupRestore".Data[1] // .Data[x] = 100 bytes
);

// Backup data
call SFC20( SrcBlk := "DB_BackupRestore".Data[1],
Ret_Val := tIntResult,
DstBlk := Localdata
);


END_FUNCTION_BLOCK


Yes, I know< I tried that too
But as you can see, it's slightly different in SCL.

Thanks anyway for your help
 

Similar Topics

Hi everyone, i have an issue with saving a changed value in an AOI, I am using L84E, Everytime i try to save my work to SD card, the program lost...
Replies
1
Views
111
Hi all, I have installed a SICK AFM60A-S4IB018x12 encoder to Allen-Bradley CompactLogix PLC and configured its parameters via AOI provided by...
Replies
0
Views
112
Hello, i have a problem, i was trying to fix a trend that wasn't registering the tags, i got that fix by setting the path, but now i can get it to...
Replies
2
Views
867
I'm struggling with this...Times and Dates are always a mental-block for me. See picture. When I press SAVE, I want to take the current...
Replies
14
Views
1,747
I am new to Mitsubishi GX2 and GX3 software here at work. It is common practice to use an "M" memory bit as a temporary bypass. This is done by...
Replies
3
Views
731
Back
Top Bottom