Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: widpyro on December 10, 2011, 06:01:51 PM
-
I am going to use a brain to activate a switch. How do I specify an output switch call in the program? Please show me a sample of code that calls for an output switch that I will then link to a brain?
Thanks,
-jim
-
What are you meaning by a switch? Switches are normally pressed and thus would be an input.
Hood
-
OK Hood, Let me rephrase this.
I am going to use the mist command (m7) to control a switch. I need to have this happen while the motors are turning so it was recommended to use a brain. So I would like the mist command to activate an output (4) to control my switch. The question is do I check compare immediately, or no action to get output 4 to trigger from the mist command using a brain? How exactly should I use a brain to achieve this?
Thanks,
-jim
-
Still not sure how you control a switch from an output, I presume you are meaning a relay will be controlled?
Anyway no brain needed, just set output number you wish to use (4 you said) in Config, Ports and Pins, Spindle Control against the M7 setting
Hood
-
Like this, ignore the 3 I have in Flood as you may already be using something there, if not set 4 if you want for it also.
Hood
-
The problem is, to operate the mist control, you must stop the axis, which i do not want to do. This is why i must use brain, so that the command can happen without stopping the motors. If I want to control the output with the mist LED, what do I use: "no operation" or "compare immediately" with what value?
-jim
-
How are you going to operate the mist output? Thought you were going to use code?
Hood
-
If using M7 in code to switch on you would just have it on the same line as some motion code, dont actually have to stop motion to switch coolant on.
If you will be using some other means to switch on the mist let me know and I will maybe see what you are trying to achieve and be able to advise more.
Hood
-
What I want to do is use the m7 command to turn a switch on for the first second or so of a motor command that lasts for about 20-30 seconds. I do not want the motor to stop or pause when the M9 command is given.
-jim
-
Still not clear what you are wanting to do I am afraid, the " turn a switch on" is the first thing that has me confused, how can you turn a switch on? Are you meaning a relay? Next thing that has me a bit puzzled is do you wish the signal to be turned off halfway through a move or when? Is the On state to be for a predefined length of time or is it just when you command it to be off? If the latter how are you going to command this off?
I can tell you that it would just be a do nothing pass signal but that may not be the case as it all depends on what you are wanting to achieve and afraid I am no closer to understanding that :(
Hood
-
Yes, I want the signal to be turned off during a move. The length of time varies but would generally between 2-4 seconds. I managed to achieve what I want to do by using a brain triggered by the DRO of an un-used axis -just like the example Art gives in the "introduction to brains" tutorial. But I would like to not have to tie up an axis for this purpose in case I want to use it later. That is why I asked about using another command. It could be any other command that works.
-jim
-
IF I read you correctly use the brain this way . When you turn on the mist with the M7 then 10 sec later the mist will turn off.
Miston(led) --------- No OP------------ Timer for 10 sec ------------- Button(mistoff)
BUT also as Hood said it is just as good to use the M7 in the Gcode to turn it on then use the M9 to turn it off where ever you want. It has NO effect on the motion.
(;-) TP
-
Thanks Brian,
You are telling my how to program the brain correct? What do you mean by button?
thanks,
-jim
-
THe brain terminates with a buttoncall. That is what turns OFF the Mist/on.
I would suggest studying up on the brains a little more, (;-) TP