Host Engineering Forum
General Category => Do-more CPUs and Do-more Designer Software => Topic started by: mhw 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?
-
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.
-
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
-
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.