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

Assigning array of byte

krymzy
2015-11-13
2015-11-26
  • krymzy - 2015-11-13

    Yet another silly question here

    I need to send ascii characters over FMS. My sae1939 lib data input is ARRAY 0..1600 of byte

    Mostly using FBD-s to program, i got a block to convert ascii text to ARRAY 0..100 of byte

    How do i assign the array of 0...100 to 1500...1600

    Getting "Cannot convert array 0...100 of byte to array of 0..1600 of byte"

    or if i try to define [1500..1600] then i get error "Expecting "," or " before """

    so how to assign arrays of different size and how to point the locations (with single byte locations defining like [2] etc seems to work fine)

     

    Related

    Talk.ru: 2

  • Anonymous - 2015-11-17

    Originally created by: scott_cunningham

    Short of copying the bytes directly, maybe you can use use POINTER TO BYTE as an in-between. For example, define pData : POINTER TO BYTE. Then pData := ADR(Array[1500]). Now you have the address of the data at position 1500 in the array. Now maybe you can do you work based on pData instead of your array[0..100].

     
  • krymzy - 2015-11-19

    Thank you!

     
  • shooter - 2015-11-26

    a string has a limited length so direct will not work, as scott says use for this a pointer
    and have a look at how oscat is solving strings.

     

Log in to post a comment.