Personal Data

Username:
fajean
Joined:
2022-01-08 21:32:08+00:00

Projects

  • No projects to display.

Skills

  • No skills entered.

User Activity

  • Posted a comment on discussion Engineering πŸ‡¬πŸ‡§ on CODESYS Forge

    I think writing to inputs to give them an initial value from a FB_Init is fine in all cases. Of course, thereafter, if the inputs are cyclically fed with values and the inputs are also written to from code, there is going to be a problem. I use structured text as a "normal" programming language. I have implemented my own cyclical execution framework (my function blocks have no body, and that empty body is never called). My function blocks cannot be used in a ladder diagram, which is not a tradeoff...

  • Posted a comment on discussion Engineering πŸ‡¬πŸ‡§ on CODESYS Forge

    Expanding on h-hermsen's final tip, consider this idea: The main program : // Main program PROGRAM MAIN VAR {attribute 'init_on_onlchange' } C_init: MVB_Set_Parameters(TRUE, 16, 3); END_VAR The helper function block : FUNCTION_BLOCK MVB_Set_Parameters VAR_INPUT Condition:BOOL; X:INT; Y:INT; END_VAR VAR_OUTPUT xError:INT; END_VAR The helper function block's FB_Init : METHOD FB_Init: BOOL VAR_INPUT bInitRetains: BOOL; bInCopyCode: BOOL; Condition:BOOL; X:INT; Y:INT; END_VAR THIS^.Condition:= Condition;...

  • Posted a comment on discussion Engineering πŸ‡¬πŸ‡§ on CODESYS Forge

    You write : FBInit can not initialize FUNCTIONBLOCK inputs since they are INPUTS and thus they are read only and BY VALUE from point of view of method FBInit Method. Do you mean this as a recommendation, or as a statement of limitations of the compiler? I do not think the compiler enforces VAR_INPUT to be read-only from within the function block or its FB_Init. VAR_INPUT variable can also be of the "REFERENCE TO" or "POINTER TO" kinds, so inputs are not necessarily BY VALUE. Having FB_Init write...

  • Modified a comment on discussion Engineering πŸ‡¬πŸ‡§ on CODESYS Forge

    I do not know whether the OP meant "3rd byte" as "last of 4" or "third of 4", but in the latter case, I think the mask should be "16#FF00FFFF" and the shift should be "2*8". I would probably use "OR" rather than "+", but I think in this case they are interchangeable.

  • Modified a comment on discussion Engineering πŸ‡¬πŸ‡§ on CODESYS Forge

    I do not know whether the OP meant "3rd byte" as "last of 4" or "third of 4", but in the latter case, I think the mask should be "16#FF00FFFF" and the shift should be 2*8). I would probably use "OR" rather than "+", but I think in this case they are interchangeable.

  • Posted a comment on discussion Engineering πŸ‡¬πŸ‡§ on CODESYS Forge

    I do not know whether the OP meant "3rd byte" as "last of 4" or "third of 4", but in the latter case, I think the mask should be "16#00FFFFFF" and the shift should be 2*8). I would probably use "OR" rather than "+", but I think in this case they are interchangeable.

  • Posted a comment on discussion Engineering πŸ‡¬πŸ‡§ on CODESYS Forge

    I would like to understand what you mean by "that would cost processor time loading it into memory". Outside of arguments passed by value and assignments (which require the array to be copied, but probably are an atypical way to use an array), do you know of cases where a large array size causes sustained CPU load issues by itself, not related to explicit processing such as iterating over the array?

  • Posted a comment on discussion Engineering πŸ‡¬πŸ‡§ on CODESYS Forge

    I develop everything in structured text, with no desire to make my function blocks amenable to use in the visual languages. Maybe someone working in ladder all the time has a use for passing FBs by value that I do now know of, but I could really not tell. The way I develop, I would rather have function blocks passed by reference by default. I do not remember ever passing a FB by value, or using the assignment operator on a FB (instead of REF= which I use very, very heavily). In fact, I default to...

View All