News:

  • April 17, 2025, 09:17:58 PM

Login with username, password and session length

Author Topic: Determine Discrete Output Existance  (Read 977 times)

Bolt

  • Hero Member
  • *****
  • Posts: 574
Determine Discrete Output Existance
« on: May 14, 2024, 10:46:09 AM »
Is there a way to programmatically determine how many discrete outputs exist?
If no expansion modules, Y0-Y3. If only an 8 pt expansion module add Y8-15. If 16 pt expansion module instead then Y8-23 also exist.
Not the same as DATAINFO for block size, but actual initialized quantity is what I'm after.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6077
  • Yes Pinky, Do-more will control the world!
Re: Determine Discrete Output Existance
« Reply #1 on: May 14, 2024, 10:51:07 AM »
Is there a way to programmatically determine how many discrete outputs exist?
If no expansion modules, Y0-Y3. If only an 8 pt expansion module add Y8-15. If 16 pt expansion module instead then Y8-23 also exist.
Not the same as DATAINFO for block size, but actual initialized quantity is what I'm after.

Not at present. The closest you could get is using HWINFO to determine what hardware is present and do the math.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Bolt

  • Hero Member
  • *****
  • Posts: 574
Re: Determine Discrete Output Existance
« Reply #2 on: May 14, 2024, 11:19:14 AM »
Not a bad solution at all, thanks!

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3742
    • Host Engineering
Re: Determine Discrete Output Existance
« Reply #3 on: May 14, 2024, 12:38:03 PM »
If you are wanting to map it to the Y IDs, realize that if the count does not cause bits to be BYTE aligned, they are PADDED to the nearest WHOLE BYTE.  So the Slot 0 Y count is 4, but that doesn't mean that the first module's ID starts at Y4 (where onboard's 4 Y's are Y0 thru Y3).  That module actually starts at Y8 because the onboard eats up 8 (or 16 or 24 or 32) regardless of the physical count (HWINFO reports ACTUAL screw-head Y counts).  Hence, you have to do some MATH.  You have to adjust the counts as you go, (adjusted slot 0 + adjusted slot 1 + adjusted slot 2), not at the end (can't just adjust (slot 0 + slot 1 + slot 2).

Another caveat if you are looking for ID calculations is if you use Manual Mapping - you could have an expansion module start at Y400!  That info is not available.