Hello Guest it is December 05, 2023, 10:54:38 AM

Author Topic: Question on digital outputs in Mach3  (Read 3507 times)

0 Members and 1 Guest are viewing this topic.

Question on digital outputs in Mach3
« on: June 08, 2012, 02:48:25 AM »
Hey all; apologies in advance if this is a silly question.  I'm working on my senior engineering project, which is a cnc controlled painting table.  Besides the 3 normal axes of motion, we have a solenoid that grips the paint brush.  Now, after we create the g-code for a specific drawing, we run the code through a processor that inserts extra g-code lines for the brush changes (in between layers we travel to the brush rack, drop a brush off, then move to the next brush and grip it).  In these g-code lines that we insert, a command for the turning on and off of the solenoid needs to be included; after hunting around, it seems like the easiest thing to do is use M commands and treat the solenoid as if it were the spindle or the coolant system (as these actions are already tied to a specific g-code command).  Will that be the cleanest way to do it?  I've hunted around on the forums regarding using the digital output pins and people are talking about writing in visual basic and doing this and that and truth be told, it's all way over my head; if I can link the gripping mechanism to the program with a known g-code command control, that would be ideal.  Thanks in advance to everybody, and like I said, my apologies if this post is amateur.


Offline Hood

  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: Question on digital outputs in Mach3
« Reply #1 on: June 08, 2012, 03:14:41 AM »
If its just an on/off output you are needing then likely using the M8/M9 for coolant on/off would work well. Just need to enable the opyion and tell Mach what output you want to use and then set that output up with the port and pin number you are using. All of that is done from config menu then Ports and Pins. The output is from Outputs page and the enable the coolant relay option is found on spindle setup page.
You will just need a M8 to activate the output and then a M9 will deactivate it.
Re: Question on digital outputs in Mach3
« Reply #2 on: June 08, 2012, 02:13:30 PM »
Another option would be to set up a non-existent C axis and use the C direction pin to trigger your solenoid.  A C minus value would turn on the solenoid and a C plus value would turn it off.  It all depends on which way is easier for you and your gcode generator/processor.
John Champlain