News:

  • August 28, 2026, 04:39:14 AM

Login with username, password and session length

Author Topic: GSEDRV with I/O master  (Read 9578 times)

mhw

  • Hero Member
  • *****
  • Posts: 250
GSEDRV with I/O master
« on: February 12, 2014, 02:44:31 PM »
I want to be able to check a GS drive to see if it is stopped using a Do-More with Ethernet I/O master enabled. This is a single bit in a word of the GS Drive structure. DMD will not allow me to cast this bit. The only way I see to do it is move $GS1_110.StatusMonitor2 to a different memory location and then cast that. Is there a more seamless way to do it?

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3843
    • Host Engineering
Re: GSEDRV with I/O master
« Reply #1 on: February 12, 2014, 02:56:05 PM »
It looks like you need to look at bit0 and bit1???  Use the bitwise-and operator inside MATH (single ampersand, "&").

MATH C100 "($GS1_110.StatusMonitor2 & 0x0003) == 0x0000"

This will look at the lower 2 bits to see if they are OFF.  If they are both OFF, C100 will be a 1.  Otherwise it will be a 0.


mhw

  • Hero Member
  • *****
  • Posts: 250
Re: GSEDRV with I/O master
« Reply #2 on: February 12, 2014, 03:18:10 PM »
Quote
It looks like you need to look at bit0 and bit1??? 
I really only need to look at bit0. If it is off then the drive is not outputting.
Thanks

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6174
  • Yes Pinky, Do-more will control the world!
Re: GSEDRV with I/O master
« Reply #3 on: February 12, 2014, 03:37:22 PM »
I want to be able to check a GS drive to see if it is stopped using a Do-More with Ethernet I/O master enabled. This is a single bit in a word of the GS Drive structure. DMD will not allow me to cast this bit. The only way I see to do it is move $GS1_110.StatusMonitor2 to a different memory location and then cast that. Is there a more seamless way to do it?

Unfortunately struct fields cannot have cast operators. It's a function of how parameters are described in DmD...in essence, struct fields are a type of a cast already.
"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