Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

void pointer

sarathbabu
2014-08-17
2014-08-25
  • sarathbabu - 2014-08-17

    Hi all

    Is there any way to create void pointers in codesys?

    and need info about writing code in visual c++ & converting it to codesys library.

    Thanks
    sarath

     
  • sarathbabu - 2014-08-20

    Pointer to any DATA type this is what is required.Is it possible in codesys?

    Thanks

     
  • Strucc - 2014-08-20

    Regularly and traditionally it's POINTER TO BYTE, it can be interchanged without conversion to POINTER TO *.
    However, in some cases this might lead to memory alignment problems... for example, ODD pointer to byte should not be used as pointer to word.
    As for CODESYS V3 , POINTER TO ANY seems to work.

     
  • sarathbabu - 2014-08-21

    Hi Strucc

    Thanks for your info.

    type st_recipe
    test:bool;
    test1:lreal;
    end_type
    function_block tester
    var
    pt:pointer to array [1..250] of dword;
    xmlvalue:string;
    end_var
    pt:=adr(st_recipe);
    pt^[i]:=string_to_dword(xmlvalue);
    

    Is it possible to have a pointer like this inspite of any data type

    Thanks

     
  • shooter - 2014-08-22

    yes that is possible, however why should you use pointers, as everything can be programmed in 61131 standard language.
    when using pointers it is same as use peek and poke, very machine dependent.
    whenever possible try to avoid it.

     
  • sarathbabu - 2014-08-25

    Strucc hat geschrieben:
    Regularly and traditionally it's POINTER TO BYTE, it can be interchanged without conversion to POINTER TO *.
    However, in some cases this might lead to memory alignment problems... for example, ODD pointer to byte should not be used as pointer to word.
    As for CODESYS V3 , POINTER TO ANY seems to work.

    Thanks Strucc

    Used your idea

    Sarath

     

Log in to post a comment.