I have a library which contains a function block with some math formulas in it. I still get division by 0 exceptions, even though I have the "CheckDivReal" implicit check function installed. CheckDivReal is called if I divide two numbers in a normal POU, but if it's within a function block from the library, it is not called. I guess that makes sense because the library can't see the functions in my project, but it doesn't seem to be possible to install the implicit check function blocks in a library. Is there a way to do this?
thanks
Tim
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
you could only check libs in library format/source available **not **compiled libs.
To do this you need to set the compiler define: checks_in_libs
in your application.
BR
Edwin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'd like to use CheckBounds for improving reliability of my library.
I'm using Codesys V3.5SP10 Patch3
I have inserted the compiler define checks_in_libs in my main application.
The program aCheck of the attached library is supposed to cause the call to checkBounds function.
I have set some breakpoints at line 3 & 5 of the generated CheckBounds function.
When I run my application, the PLC does not call the checkBounds function.
I don't understand what I'm doing wrong.
Although this is a very basic use case, I cannot attach library and project code because of limited file size. Herewith the code:
Checks.library
PROGRAMaChecksVAR  iIndex    :  INT;  astInst   :  ARRAY[1..5]OFINT:=[5(101)];END_VARFORiIndex:=0TO5DO  astInst[iIndex]:=234;END_FOR
untitled1.project
PROGRAMPLC_PRGVAR  xActivate  :  BOOL;  totot:INT;END_VAR{definechecks_in_libs}{IFdefined(checks_in_libs)}totot:=55;{ELSE}totot:=77;{END_IF}IFxActivateTHEN  xActivate:=FALSE;  AAA.aChecks();END_IFFUNCTIONCheckBounds:DINTVAR_INPUT  index,lower,upper:DINT;END_VAR//Implicitlygeneratedcode:OnlyanImplementationsuggestionIF index<lowerTHEN  CheckBounds:=lower;    //line3ELSIF index>upperTHEN  CheckBounds:=upper;    //line5ELSE   CheckBounds:=index;END_IF
Any help will be appreciated.
I.kurvanov
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a library which contains a function block with some math formulas in it. I still get division by 0 exceptions, even though I have the "CheckDivReal" implicit check function installed. CheckDivReal is called if I divide two numbers in a normal POU, but if it's within a function block from the library, it is not called. I guess that makes sense because the library can't see the functions in my project, but it doesn't seem to be possible to install the implicit check function blocks in a library. Is there a way to do this?
thanks
Tim
Hi,
you could only check libs in library format/source available **not **compiled libs.
To do this you need to set the compiler define:
checks_in_libs
in your application.
BR
Edwin
Good morning,
I'd like to use CheckBounds for improving reliability of my library.
I'm using Codesys V3.5SP10 Patch3
I have inserted the compiler define checks_in_libs in my main application.
The program aCheck of the attached library is supposed to cause the call to checkBounds function.
I have set some breakpoints at line 3 & 5 of the generated CheckBounds function.
When I run my application, the PLC does not call the checkBounds function.
I don't understand what I'm doing wrong.
Although this is a very basic use case, I cannot attach library and project code because of limited file size. Herewith the code:
Checks.library
untitled1.project
Any help will be appreciated.
I.kurvanov