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

Pointer to Byte

pascaljt
2023-08-07
2023-08-10
  • pascaljt - 2023-08-07

    Hello,
    I use a function block with a variable Pointer to Byte (I don't the choice).
    I must have an array of 18 words to write in this pointer variable. I don't know how to do. I would like to write the values in one time.

    Someone can help me please ?

    Thanks in advance.
    Pascal.

     
  • TimvH

    TimvH - 2023-08-09

    Maybe you could use the "CAA Memory" library for this. This library contains a function MemMove.
    Here you can specify the pointer to memory of your source and target and set the number of bytes to "move".

    To get the pointer to your array of 18 Words, use ADR(nameOfYourArray) to get the pointer to it's memory location.

     
  • pascaljt - 2023-08-10

    Hello TimvH,

    Thanks for your answer.
    I don't find this library. I had search on the net but I don't find the file.
    I found informations about that but not the library to import on Codesys.

    Can you help me ?
    Thanks for your help.
    Pascal.

     
  • TimvH

    TimvH - 2023-08-10

    go to the library manager of your project
    click on Add Library (top left corner)
    type in CAA Memory
    - you will see it in the list. If not, and you don't have the latest version, maybe you have to select Advanced first.
    then double click it to add it to the library manager of your project.

    Then you can use the functions from it in your project.

     
  • pascaljt - 2023-08-10

    Hello TimvH,

    That's works, it's perfect !

    Many thanks.
    Pascal.

     

Log in to post a comment.