For those who are interested btw, https://stackoverflow.com/questions/70694759/converting-lreal-to-binary-and-interpreting-it-as-base-10-lint/70696435#70696435 has a far more elegant solution
For those who are interested btw, https://stackoverflow.com/questions/70694759/converting-lreal-to-binary-and-interpreting-it-as-base-10-lint/70696435#70696435 has a far more elegant solution
Hey @i-campbell, thanks for taking a look I think you're right in that I am actually implementing Float.floatToRawIntBits(f) as seen in https://github.com/openjdk/jdk/blob/739769c8fc4b496f08a92225a12d07414537b6c0/src/java.base/share/classes/java/lang/Float.java#L782 What I actually did was actually get some inputs and outputs e.g. - Float.floatToRawIntBits(1.5f) should return - 4609434218613702656 for double precision float or - 1069547520 for single precision float - Float.floatToRawIntBits(20.12f)...
Hello, running "CODESYS V3.5 SP16" here, I am trying to implement the hashcode algorithm mentioned in https://stackoverflow.com/questions/113511/best-implementation-for-hashcode-method-for-a-collection/113600#113600 and had to built my own solution to replicate Java's Float.floatToIntBits(f) which resulted in the following function FUNCTION F_lrealToLintBits : LINT VAR_INPUT lrVal : LREAL; END_VAR VAR arrBytes : ARRAY[0..7] OF BYTE; // LREAL contains 64 bits and each byte contains 8 bits pVal : POINTER...
Running "CODESYS V3.5 SP16", is what is mentioned in the title by design? PROGRAM PLC_PRG {IF defined (TEST)} {info 'TEST defined'} {ELSE} {info 'TEST not defined'} {END_IF} Compiling the above with yields [INFORMATION] TestProject: PLC_PRG [Device: PLC Logic: Application](Line 4, Column 1 (Impl)): TEST not defined whereas compiling the above with yields [INFORMATION] TestProject: PLC_PRG [Device: PLC Logic: Application](Line 2, Column 1 (Impl)): TEST defined Asking because documentation at https://help.codesys.com/webapp/_cds_dlg_properties_build;product=codesys;version=3.5.17.0...
Running "CODESYS V3.5 SP16", is what is mentioned in the title by design? PROGRAM PLC_PRG {IF defined (TEST)} {info 'TEST defined'} {ELSE} {info 'TEST not defined'} {END_IF} Compiling the above with yields [INFORMATION] TestProject: PLC_PRG [Device: PLC Logic: Application](Line 4, Column 1 (Impl)): TEST not defined whereas compiling the above with yields [INFORMATION] TestProject: PLC_PRG [Device: PLC Logic: Application](Line 2, Column 1 (Impl)): TEST defined Asking because documentation at https://help.codesys.com/webapp/_cds_dlg_properties_build;product=codesys;version=3.5.17.0...
Yeah it also took me awhile to get it correct, the profile argument is very sensitive and has to get the correct string (quotes and all) otherwise it will just open the GUI This is what I used to use to run CODESYS python scripts from PowerShell 7.2 function _start_codesys_process { [cmdletbinding()] param( [validatenotnullorempty()] [parameter(mandatory=$true, helpmessage='Path to CODESYS.exe')] [string]${codesys_bin_path}, [validatenotnullorempty()] [parameter(mandatory=$true, helpmessage='Profile...
Hi, running "CODESYS V3.5 SP16" here, does anyone have the same problem with the method in the title? PROGRAM PLC_PRG VAR itfAxisRef : SM3_Basic.IAxisRef; pAxisRefSm3 : POINTER TO SM3_Basic.AXIS_REF_SM3; END_VAR pAxisRefSm3 := itfAxisRef.GetAxisRefPointer; Trying to compile the above throws the following error C0032: Cannot convert type 'GETAXISREFPOINTER(sm3_basic, 4.10.0.0 (3s - smart software solutions gmbh))' to type 'POINTER TO SM3_Basic.AXIS_REF_SM3' which has me really confused because I've...
Hi, running "CODESYS V3.5 SP16" here, does anyone have the same problem with the method in the title? PROGRAM PLC_PRG VAR itfAxisRef : SM3_Basic.IAxisRef; pAxisRefSm3 : POINTER TO SM3_Basic.AXIS_REF_SM3; END_VAR pAxisRefSm3 := itfAxisRef.GetAxisRefPointer; Trying to compile the above throws the following error C0032: Cannot convert type 'GETAXISREFPOINTER(sm3_basic, 4.10.0.0 (3s - smart software solutions gmbh))' to type 'POINTER TO SM3_Basic.AXIS_REF_SM3' which has me really confused because I've...
Hi, running "CODESYS V3.5 SP16" here, does anyone have a problem with the method in the title? PROGRAM PLC_PRG VAR itfAxisRef : SM3_Basic.IAxisRef; pAxisRefSm3 : POINTER TO SM3_Basic.AXIS_REF_SM3; END_VAR pAxisRefSm3 := itfAxisRef.GetAxisRefPointer; Trying to compile the above throws the following error C0032: Cannot convert type 'GETAXISREFPOINTER(sm3_basic, 4.10.0.0 (3s - smart software solutions gmbh))' to type 'POINTER TO SM3_Basic.AXIS_REF_SM3' which has me really confused because I've never...
Hi, running "CODESYS V3.5 SP16" here, does anyone have a problem with the method in the title? PROGRAM PLC_PRG VAR itfAxisRef : SM3_Basic.IAxisRef; pAxisRefSm3 : POINTER TO SM3_Basic.AXIS_REF_SM3; END_VAR pAxisRefSm3 := itfAxisRef.GetAxisRefPointer; Trying to compile the above throws the following error C0032: Cannot convert type 'GETAXISREFPOINTER(sm3_basic, 4.10.0.0 (3s - smart software solutions gmbh))' to type 'POINTER TO SM3_Basic.AXIS_REF_SM3' which has me really confused because I've never...
Cool that seems similar to the comments I got from https://stackoverflow.com/questions/70333886/about-pouname-behavior
Is most of your project in structured text? If it is, you could get some diff output by saving it as PLCopenXML and pushing it to git But if it's mostly the visual diagrams, lists and charts then I guess you will need CODESYS git or a paid service like https://www.copia.io/
Yeah it also took me awhile to get it correct, the profile argument is very sensitive and has to get the correct string (quotes and all) otherwise it will just open the GUI This is what I used to use to run CODESYS python scripts from PowerShell 7.2 function _start_codesys_process { [cmdletbinding()] param( [validatenotnullorempty()] [parameter(mandatory=$true, helpmessage='Path to CODESYS.exe')] [string]${codesys_bin_path}, [validatenotnullorempty()] [parameter(mandatory=$true, helpmessage='Profile...
Hello, I have written a custom logger and wanted to add the name of POUs as the pszComponent for easier debugging. I wrote a custom FB_init which accepts as input the name of the POU as a string and encountered puzzling behavior (to me at least). Could someone explain to me why the following compiles VAR name : STRING := __POUNAME(); test : FB_logAdd(sCmpName:=name); END_VAR but the following VAR test : FB_logAdd(sCmpName:=__POUNAME()); END_VAR throws the following compiler error? [ERROR] Internal...
Hello, I have written a custom logger and wanted to add the name of POUs as the pszComponent for easier debugging. I wrote a custom FB_init which accepts as input the name of the POU as a string and encountered puzzling behavior (to me at least). Could someone explain to me why the following compiles VAR name : STRING := __POUNAME(); test : FB_logAdd(sCmpName:=name); END_VAR but the following VAR test : FB_logAdd(sCmpName:=__POUNAME()); END_VAR throws the following compiler error? [ERROR] Internal...
Hello, I have written a custom logger and wanted to add the name of POUs as the pszComponent for easier debugging. I wrote a custom FB_init which accepts as input the name of the POU as a string and encountered puzzling behavior (to me at least). Could someone explain to me why the following compiles VAR name : STRING := __POUNAME(); test : FB_logAdd(sCmpName:=name); END_VAR but the following VAR test : FB_logAdd(sCmpName:=__POUNAME()); END_VAR throws the following compiler error? [ERROR] Internal...
Hello, I'm a beginner to codesys and I have been trying to gain access to the AXIS_REF_SM3 i.e. Axis of SM3_Basic.MC_MoveAbsolute in order to return the wDriveId of the axis. Since Axis is declared as a VAR_IN_OUT variable, I am unable to access it outside of the FB using the .Axis syntax since it will cause the compiler to throw a C0178: No external access to VAR_IN_OUT parameter 'Axis' of 'MC_MOVEABSOLUTE'." error which makes sense since VAR_IN_OUT variables are not supposed to be remotely accessible....