Hello Guest it is November 26, 2022, 11:25:49 AM

Author Topic: ModBus populated mc.ISIG_INPUT50 doesn't work with mc.mcSignalWait(...)  (Read 801 times)

0 Members and 1 Guest are viewing this topic.

Hello, scripting/ModBus question;

I have set up ModBus and I can see the values being written out in the diagnostics window. I have made the connection between the discrete input to an input signal in Mach4. Now, when I go to "signal wait" on the input it never seems to be available to the mc.mcSignalWait(...) call.

If I do this I can manually pause on the signal but its ugly...

Code: [Select]
local isig = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT50)
local state = mc.mcSignalGetState(isig)

while mc.mcSignalGetState(isig) > 0.0
do
-- snore
end

So why doesn't this work?

Code: [Select]
rc = mc.mcSignalWait(inst, mc.ISIG_INPUT50, 0, 30) -- Wait 30 seconds for input 50 to go low

And, yes, I do put a wx.wxMilliSleep(25) to force Mach4 to see the next read from ModBus (which is disappointing but not unexpected) and it still doesn't seem to get the value.

And yes, I tried all this in reverse, waiting for it to go high.

Thanks for the help!