News:

  • August 15, 2026, 04:24:15 AM

Login with username, password and session length

Author Topic: Finding Memory Block Size  (Read 7693 times)

Bolt

  • Hero Member
  • *****
  • Posts: 598
Finding Memory Block Size
« on: September 18, 2019, 03:15:51 PM »
Is there a way in ladder logic to determine the size of a memory block?  Say I want to know what the block size is on a string memory.  SS.Max or something like that.

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3843
    • Host Engineering
Re: Finding Memory Block Size
« Reply #1 on: September 18, 2019, 03:24:12 PM »
DATAINFO instruction.  You can query the number of elements, the size in bytes of the block, the data type, et. al.

Bolt

  • Hero Member
  • *****
  • Posts: 598
Re: Finding Memory Block Size
« Reply #2 on: September 18, 2019, 03:30:49 PM »
Thanks!  You guys thought of everything!

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3843
    • Host Engineering
Re: Finding Memory Block Size
« Reply #3 on: September 18, 2019, 03:36:41 PM »
Thanks!  You guys thought of everything!

I try to utilize that in some of my FOR/NEXT code-blocks, whenever I know there's a good chance I will be tweaking the block size.  I don't want to have to remember to change CODE if I change the size of a data block from 100 elements to 200 elements.
« Last Edit: September 18, 2019, 04:32:08 PM by franji1 »

Bolt

  • Hero Member
  • *****
  • Posts: 598
Re: Finding Memory Block Size
« Reply #4 on: September 18, 2019, 03:39:58 PM »
Exactly what I'm trying to do, anticipating a future memory block size adjustment, and building a queue system that will "never" get full.