2/7/2025 12:03 PM | |
Joined: 5/22/2023 Last visit: 9/8/2025 Posts: 3 Rating:
|
Hi all. After finding so much knowledge here over the years, I'm now at a complete loss and hope someone can help me out as well! This is a long post as I have tried to include all pertinent information... (and I am a wordy person I have a FB written in SCL which loops through an array of structs. Each element in the struct holds information such as if a data source is remote/local, active/inactive and the communication ID# in case it is a remote source. It will also specify a bit-offset from dbx0.0 in the source DB, as some sources can have one, two or three bytes in their DB (individual, not array of bytes). Definition and assignment of the one I'm working with:
I have used the information In this post (and others) to work with any-pointers so that I can make up the source pointer for each active source on the fly. The source DB is always DB400, and the data starts at address 0 in the DB. The destination DB is always DB402 in the local PLC and it holds one byte. (I will only ever read one byte at a time, even from the sources with more bytes in their DB400) I tried it first with local data. The source and destination pointers are made up the same for local and remote data. If the data is local I use the source and destination ANY-pointers in SFC20 (BLKMOV), and this worked perfectly. The bit-offsets also worked.
Now I am starting to try with the remote data, using SFB14 (GET), and this is where the fun ended. This is how I make up the ANY-pointers:
If I call it in my FB using an instance, defined as such:
and the call looks like this:
( The routine is called every scan, and the REQ-variable controls if it is active or not. Here, for testing, I entered the ID explicitly, rather than using the data in my control array. It made no difference.) The issue? I get no data, but instead I get an error flag and status 4, something wrong with the DB address or data types not matching. Next I try to add an instance of SFB14 to the project, called it FB15 and added an instance DB, DB15, and called that from my SCL source, like so:
With this I still get an error flag, but instead I get status 1. Third try... I disable these calls and instead add FB15 to OB1 and populate it with the following parameters:
And this works perfectly! There is clearly something here that I am missing, but I can't for the life of me figure out what... Three ways of calling with three different results, and SFC20 does not complain with the same address parameters... Any help would be greatly appreciated! Cheers, Mattias [Attached ]is the whole SCL code, it might help to paste in an editor to get highlighting Attachment07.02.AutoGen_5052637.txt (213 Downloads) |
Last edited by: AutoGen_5052637 at: 02/07/2025 12:05:08Last edited by: Moderator_Lan at: 02/07/2025 12:19:58Code attached |
|
This contribution was helpful to
1 thankful Users |
2/7/2025 5:02 PM | |
Joined: 7/7/2010 Last visit: 9/12/2025 Posts: 16094 Rating:
|
S7-300/400 or S7-1500? What is SFB14? Does it have a name that describes its function? |
science guy |
|
Follow us on