PDA

View Full Version : S7: SFC36 "MASK FLT" Help!!


STL???
April 11th, 2006, 02:18 AM
Hi,
I've not come across this SFC before and the S7 Help file has left me confused also, In the code snippet below SFC36,37,38 are called every scan and i was wondering how it is applied, ie does it mask the value in the accumulator, DB??

I've attached the network in question below, a OPN DB statement is on the network before this.




AN "TRANS-BEGINN"
S "TRANS-BEGINN"
A "TRANS-ENDE"
R "TRANS-ENDE"
AN #Stat_Approval
JC M004
L "SBNR"
T DBW 24
T #TEMP36
CALL "MSK_FLT"
PRGFLT_SET_MASK:=DW#16#10000000
ACCFLT_SET_MASK:=DW#16#0
RET_VAL :=#TEMP37
PRGFLT_MASKED :=#TEMP38
ACCFLT_MASKED :=#TEMP39


UC FC [#TEMP36] // 101 or 102
CALL "READ_ERR"
PRGFLT_QUERY:=DW#16#10000000
ACCFLT_QUERY:=DW#16#0
RET_VAL :=#TEMP43
PRGFLT_CLR :=#TEMP44
ACCFLT_CLR :=#TEMP45
L #TEMP44
L DW#16#10000000
==D
S #IO32
CALL "DMSK_FLT"
PRGFLT_RESET_MASK:=DW#16#10000000
ACCFLT_RESET_MASK:=DW#16#0
RET_VAL :=#TEMP40
PRGFLT_MASKED :=#TEMP41
ACCFLT_MASKED :=#TEMP42
M004: NOP 0
AN #IO32
A #Stat_Approval
= #OUT24
A "TRANS-ENDE"
CC "SEQ STEP GENERATION"
NOP 0



The DB referenced is 1136 bytes long offline could this be the cause of this work around?

Any advice on this would greatly be appreiciated

Thanks
STL

SimonGoldsworthy
April 11th, 2006, 06:27 AM
This code is masking the "Called function (FC) does not exist" error (Bit 28 in the error mask). The "SBNR" variable selects which FC will be called, and, as the "Called FC does not not exist" error has been masked it will not stop the PLC or cause the error OB to be run if "SBNR" contains a non valid FC number. Hope this helps.

STL???
April 11th, 2006, 07:14 AM
Thanks yet again Simon!


"Called FC does not not exist" error has been masked it will not stop the PLC or cause the error OB to be run if "SBNR" contains a non valid FC number.


This makes perfect sense as the Station number (1-4) is passed via HMI, then 100 is added to call either FC101/102. If 3 or 4 is selected IO32 is set which is a station Error message.

This code is masking the "Called function (FC) does not exist" error (Bit 28 in the error mask)
Just one more question well two, where did you find that bit related info?
and in theory if i disable selection, via the hmi - which never changes anyway, i can bin all of this?

Once again Simon - Thanks

SimonGoldsworthy
April 11th, 2006, 07:40 AM
I did an F1 when the cursor was on the call to the SFC, then I took a green hyperlink to "Masking Synchronous Errors" which shows you the bit layout. It is also in Berger's book.

Yes you could disable it and replace it with calls to FC101 and FC102 which are enabled with a simple compare. (FC101 and FC102 will now appear in the xref as well)

STL???
April 11th, 2006, 07:44 AM
OK Managed to get my STL berger book back at last! and it has the following:

BIT 28 B#16#3C - called function (FC) doesn't exist

But the PRGFLT_SET_MASK in SFC36 is DW#16#10000000, isnt that 40hex?

SimonGoldsworthy
April 11th, 2006, 07:53 AM
Amazing, I made the same mistake and thought the mask was binary until I noticed it is DW#16#10000000

STL???
April 11th, 2006, 08:09 AM
:shoot: Whooops,I mean 80hex - Can't seem to find anything relevant to this value?

I'm not at work until later, so ill remove the code and see what the diagnostic buffer brings up if anything!

Regards

SimonGoldsworthy
April 11th, 2006, 08:20 AM
DW#16#10000000 is 10000000 Hex

STL???
April 11th, 2006, 08:27 AM
:embar: Thanks for clearing that up ! Hopefully i will have answers to this tomorrow.

Regards

STL???
April 12th, 2006, 12:55 AM
Hi Simon,
i removed the SFC logic from the code and entered a value out of range to cause an Error. Sure enough the PLC went into stop and was asking for OB121,the Diagnostic buffer revealed the cause of the stop was a FC not loaded as you suggested, strange one though with the Mask value?

Scrapped the code now and replaced with a Integer compare!

Anyway thanks again for your Help

krk
April 12th, 2006, 02:09 AM
strange one though with the Mask value?

Nope... as Simon stated:

DW#16#10000000 (HEX) = 2#0001_0000_0000_0000_0000_0000_0000_0000 (BIN)

...which is bit 28 set.

The B#16#3C in the Berger book to the right of bit 28 is the error code returned for this fault.

STL???
April 12th, 2006, 02:30 AM
Hi KRK,
Thanks for the clear explanation, For beginners such as myself silly little things like this are invaluable!

Regards
STL