Hello Guest it is April 29, 2024, 02:40:50 AM

Author Topic: Output configuration check  (Read 565 times)

0 Members and 1 Guest are viewing this topic.

Output configuration check
« on: January 11, 2022, 03:57:11 PM »
Hi. I want to connect an external relay module to the output port/pin. How is possible to check that my output configuration is ok? What commands or macros can be used for enabling and disabling connected pinout?
Thanks.
Re: Output configuration check
« Reply #1 on: January 11, 2022, 08:06:44 PM »
Hi,
what motion controller are you using?

If you are using an ESS as I do, then:
1)Go to the Pins Config tab of the ESS plugin
2) Assign one of the spare output pins, and give it an alias, say MyOutputPin
3) Go to the Output Signals tab of the ESS plugin and enable OSIG_OUTPUT1, and choose the exictation, namely ESS/MyOutputPin
4) Close the ESS plugin
5) Open the Control plugin and open the Output Signals tab. Confirm that the ESS plugin has correctly populated the OSIG_OUTPUT1 entry. Note this is just a check to confirm the ESS
plugin has done its job. You should NOT make ANY assignments in this tab....the ESS plugin SHOULD, if all is well, do it for you.

What you need now is some way for Mach to turn the Output#1 on and off. Try installing this in the macros folder of your profile:
Code: [Select]
function m150()
local inst=mc.mcGetInstance()
local hreg=mc.mcSignalGetHandle(inst,mc.OSIG_OUTPUT1)
local MyOutputState=mc.mcSignalGetState(hreg)
if(MyOutputState==0)then
mc.mcSignalSetState(hreg,1)
else
mc.mcSignalSetState(hreg,0)
end

end
if(mc.mcInEditor()==1)then
m150()
end

Thus each time you run this macro ( m150 ) Output#1 should change state. This can be viewed on the diagnostic page, the Output#1 LED should alternately light then un-light.
Machs output signal should be reflected by the state of the ESS output pin you selected, which can in turn drive a relay or whatever.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Output configuration check
« Reply #2 on: January 12, 2022, 07:29:20 AM »
Hi Craig. Thanks for your help.
Does this mean that I need to call this function or this macro? How can I do this from a diagnostic window or G code? For example, if I will save this code, named m150 (what is a file extension?)
Re: Output configuration check
« Reply #3 on: January 12, 2022, 12:10:14 PM »
Hi,
you can run the function either in Gcode just by writing the line:
m150
and the same in the MDI panel. If you save it in the macros folder it will save by default as a .mcs, ie a Lua source file.

Craig

'I enjoy sex at 73.....I live at 71 so its not too far to walk.'