Hi there,
This may be a more general Mach3 question, so if it's not under the remit of MSM support / relevance, let me know and I'll ask elsewhere.
I have 3 input signals configured and working in Mach3 which I'd like to somehow assign messages which display in the status message section (such as where all the other messages go... "Homing X" for example)
The three signals from various sensors are:
"Lube Level Low", "Air Pressure Low" and "Guard Open"
Ideally is there somewhere I can write [IF Input'n' == 1, then MSG "Air Pressure Low"] or similar...
I'd like these messages to clear / not display when they are at opposite logic levels.
Can you point me on the right way to integrate these into my MSM setup?
Hi,
If I were looking to do this, here are my initial thoughts....
It's doable. In fact, this is easier to do with MSM than with stock Mach (as MSM has some support tools built in for this kind of thing). You will need to have some script programming skills to pull it off.
1) What you want is a script that runs periodically. It will look at some inputs and display some messages depending on the input states.
The old way to do that was with a "macro pump" - but you can only have one of those in Mach.
That's why during MSM development the "RunPeriodicScript" call was added to mach. You can read about it (and assocated calls, like the one to stop a running periodic script) in the Mach programmers manual (open via button on the MSM reference page). MSM essentially does this to update the LEDs that display the Parallel port pins. MSM starts a Periodic Script which runs asynchronously to handle looking at the pins and setting the corresponding leds. Of you need to sync the script actions to other things happening in mach, then life gets more complicated (not impossible, just harder).
2) Then you need a way to get the new PeriodicScript started - Look in the MSM manual and read about ScreenSetLoad - you can use that hook to start the periodic script each time MSM is loaded. You may also want to use ScreenSetUnload to stop the script when MSM is unloaded - depends on what you have the script doing. Remember that when mach loads a wizard it unloads the main screen (MSM) and reloads it when the wizard exits. So would you want the periodic script running at the same time as **any** wizard?
Hopefully, this give you some initial ideas of what to look up to get started.
Thanks Dave,
That's really useful and has pointed me in the right direction.
One further question: How do I write to the ticker and status windows?
I've got it working by popping up a MSG box, but this is a bit too annoying. I only want to display them as courtesy messages.
'Macro "CheckAuxSensors.m1s"
If Not IsActive(OEMTrig1) then 'If air pressure low
Message ("Air pressure low... check compressor!")
End If
If IsActive(OEMTrig2) then 'If lube level is low
Message ("Lube Level Low... please top up! [ISO 68 Oil]")
End If
If IsActive(OEMTrig4) then 'Guard open
Message ("Guard open!")
End If
End
All works a treat; thanks again for your help. Top quality service.
Glad it works for you.
One thought - you may want to put in some "if the periodic script is not yet running, start it up" logic.
Each time a wizard is run and exits, MSM gets reloaded and MSM will then call UserSSL which will start another copy of the periodic script.
So start 5 wizards and you'll have 5 running copies of the script.
' entry point into the script
If IsPeriodicScriptRunning("ScreenSetMacros\MachStdMill.set\Custom\CheckAuxSensors") then
' do nothing as alread running.
Else
Call StartPeriodicScript("ScreenSetMacros\MachStdMill.set\Custom\CheckAuxSensors", 1)
End If
exit sub