开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

Controlling relays via Custom Mcode


 

I wish to control via relays,
Using Mach3, VB and MK4-ET V1.5 XHC Motion card., Omron 24VDC relays.
The "ON" code is M704, and content is ActivateSignal(Output4) : This works
The "OFF" code is M724 and content is DeActivateSignal(Output4) Does not work.!!!!!

When I trip Emg Stop outputs cease, so electrically the outputs work.
I have M3/M5 set to output 3 and this works.

Impression is that there is an error in the syntax, or something.?????

I would appreciate any learned comment on what I am doing incorrect.

Many Thanks
Graham


 

开云体育

Graham:

?Most likely would be another output set to the same pin. Cant think of anything else that may do it..

Art


On 1/23/2021 7:02 PM, Graham wrote:
I wish to control via relays,
Using Mach3, VB and MK4-ET V1.5 XHC Motion card., Omron 24VDC relays.
The "ON" code is M704, and content is ActivateSignal(Output4) : This works
The "OFF" code is M724 and content is DeActivateSignal(Output4) Does not work.!!!!!

When I trip Emg Stop outputs cease, so electrically the outputs work.
I have M3/M5 set to output 3 and this works.

Impression is that there is an error in the syntax, or something.?????

I would appreciate any learned comment on what I am doing incorrect.

Many Thanks
Graham

-- 
Thanks
Art 


 

not sure if this will work the way you want, but you can turn on and off outputs with something like this

DoOEMButton(233) 'output4 on
DoOEMButton(234) 'output4 off
DoOEMButton(235) 'output5 on
DoOEMButton(236) 'output5 off

Gary


 

Hi Gary
Thanks for your ideas. I had opportunity to day to spend time.
Using O/Ps 3,4,5 & 6. Allocating these to M3 all switch using M3/M5.? so it can all work
I tried the ?turn on using (DoOEMButton(233) , this works, as did 235 etc
However the turnof DoOEMButton(234)?Does not turn off., nor did 236.

Totally confused.
All other I/O was disabled and unplugged to elimate confusion.
Is their more commands to go with the enabling DoOEM etc?
I am writing his code as an Mcode using the VB editor
Any ideas

Regards

Graham

?


 

开云体育

The problem may be with the plugin for your board.


On 1/31/2021 3:05 AM, Graham wrote:

Hi Gary
Thanks for your ideas. I had opportunity to day to spend time.
Using O/Ps 3,4,5 & 6. Allocating these to M3 all switch using M3/M5.? so it can all work
I tried the ?turn on using (DoOEMButton(233) , this works, as did 235 etc
However the turnof DoOEMButton(234)?Does not turn off., nor did 236.

Totally confused.
All other I/O was disabled and unplugged to elimate confusion.
Is their more commands to go with the enabling DoOEM etc?
I am writing his code as an Mcode using the VB editor
Any ideas

Regards

Graham

?


 

开云体育

I haven’t tried in in real control, at least that I remember, I tested it and watched the diao screen output leds for the outputs4 and 5 ?they did go on and off in mach3’s screen so I assumed they were working..

?

I will check further and see how I have mine setup, I run? 6 relays for the spindle 2 for forward 2 for reverse 1 for power on to the spindle controller and 1 for flood

All are SSD relays, also have 2 more for switching from computer control to manual control spindle

3 relays turn on with m3 and then off with m5, and same with m4..

I have to check the computer in shop, so will get back to you as soon as I can..

?

Sent from for Windows 10

?

From: Graham
Sent: Sunday, January 31, 2021 3:05 AM
To: [email protected]
Subject: Re: [MachCNC] Controlling relays via Custom Mcode

?

Hi Gary
Thanks for your ideas. I had opportunity to day to spend time.
Using O/Ps 3,4,5 & 6. Allocating these to M3 all switch using M3/M5.? so it can all work
I tried the ?turn on using (DoOEMButton(233) , this works, as did 235 etc
However the turnof DoOEMButton(234)?Does not turn off., nor did 236.

Totally confused.
All other I/O was disabled and unplugged to elimate confusion.
Is their more commands to go with the enabling DoOEM etc?
I am writing his code as an Mcode using the VB editor
Any ideas

Regards

Graham

?

?


 

Hello Graham,
I have attached a pdf of all the macros I use with Mach 3. There is quite a variety however on page 3, M911 and M910 turn on and off the first of 8 outputs I use to control solenoid valves. I am using Mach3 with a Warp9 Ethernet Smoothstepper.

Cheers,
Ross


 

Hi Ross,
Thanks for reply and attachment. Will be later today befor I can get out to workshop.
Immediate difference I note is you are using M1000 series, I am using M700, will try this also.

Regards

Graham


 

Hi Gary,
Thanks for reply.
I cannot open the attachment, it tries to open a hyperlink, comes up with a black screen.
I am totally confused with the behaviour of the O/Ps 3 to 8 that I am using.
If I allocate M3 to any of these the M3/M5 work correctly.
The VB code in Mcode looks correct. The On command workd using Activate or OemActivate. But will not turn off on command.

Really fustrating as I have litle model aircraft parts I am ready to machine and very limited time at moment as I am loking after m wife who is on a chemo round.

Anyway we keep trying?? eh.
Regards

Graham


 

here is my m3 m4 m5 macro they work for me but I'm not a programmer.
but have a look maybe you can get something out of it...

Hopefully the attachment will work.

Gary


 

I made a mistake

In spindle its not the pin numbers is the output numbers
and I have set the pins numbers in the outputs, oops!
I am using the ESS Smoothstepper .

Gary