I am trying to create a M100 to turn an output on in a program. What is the descripter for M100 to be used in HAL. When I create a Gcode program and open it it causes and error because M100 is not defined.
Jamy
I am trying to create a M100 to turn an output on in a program. What is the descripter for M100 to be used in HAL. When I create a Gcode program and open it it causes and error because M100 is not defined.
Jamy
Did you look in the integrators manual under M100? Did you follow those instructions? We need more info.
Cheers Chris
This is whats in the manual.
12.12 M100 to M199 User Defined Commands
To invoke a user-defined command, program M- P- Q- where P- and Q- are both optional. The
external program “Mnnn” in the directory [DISPLAY]PROGRAM_PREFIX is executed with the P and Q
values as its two arguments. Execution of the RS274NGC file pauses until the invoked program
exits.
It is an error if
• The specified User Defined Command does not exist
I dont what they mean by M- P- Q-. Also the external program "Mnnn" in the directroy [Display]Program_PREFIX is executed with P and Q values as its two arguments. They also talk about the RS274NGC file. I dont know what that is and where to find the file.
Just to confirm- you want to use M100 to run a 'seperate program' to turn an output on or do you just want a M code to turn a output on?
For M100 the m- is just the m number you used 100-199, p- and q- are variables that are passed to the seperate program like on the command line. A RS274NGC file is the original G code file. I think the seperate program needs to be named the same as the M number eg. M100 the program is called m100. The program prefix is probably where EMC is supposed to look for the seperate program. I will try to find out.
If you just want an output turned on and off you want to use M62-65
I asked on the EMC maillist here is what I got:
>
> Does this mean the external program must be named M100-199?
Yes
> What is meant by PROGRAM_PREFIX ? pathway?
>From my lathe .ini file:
...
# Sections for display options
------------------------------------------------
[DISPLAY]
DISPLAY = axis
LATHE = 1
PYVCP = spindle.xml
# DISPLAY = usrmot
# DISPLAY = tkemc
CYCLE_TIME = 0.100
HELP_FILE = doc/help.txt
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
MAX_FEED_OVERRIDE = 1.2
PROGRAM_PREFIX = ../../nc_files/
...
you can see that the M1xx files will need to be two directories up from
the current directory and in nc_files. I believe that makes
it /home/user_name/emc2/nc_files. You can change PROGRAM_PREFIX if you
want.
> I assume the external program can be in any supported language or are
> we talking G code?
My guess is that you can not execute G-code, but bash, python, C or any
non-real-time executable would work. I use a bash script to create
missing g-codes for my lathe, such as M102 Collet Open:
file = /home/kwallace/emc2/nc_files/M102
-----------------
#!/bin/sh
# Custom - Only intended for Kirk Wallace's HNC lathe, KW 20070823
# M102 - Opens Collet Closer
halcmd setp parport.0.pin-07-out False
halcmd setp parport.0.pin-06-out True
exit 0
-----------------
I use M102 in my G-code files for opening the collet closer.
hope that helps
Jamy,
In response to your question that chester88 posted on the users list and to Kirk's answer I have updated the manual. See if it makes more sense...
http://www.linuxcnc.org/docview/html...:M100-to-M199:
Thanks for asking the question.
John
How do I go about doing the M64 and M65 turning on the Digital output. I know in the program I just type M64. But in the HAL file?
This page on M66 should help you understand...
http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?Mword
and here...
http://www.linuxcnc.org/docview/html...ec:M62-to-M65:
and watch it all with HAL show...
http://www.linuxcnc.org/docview/html//hal_halshow.html
John
How do I create an input to start a program in EMC2. Also the same input to run the program after a M0 stop command. I was able to do start the program and when it got to M0 it stopped but when I pressed the input it started the program from the beginning. It seems like I need to do some sort of IF statement. If program.run and mode.auto is true then input only is used to program.run. Is there anyone that can help me?
Yes I know the S will work and also clicking on the resume button on the screen. What I am refering to is a button used by a operator to start a program. I would like to use the same button to resume the program when the program is paused (M0). The only input the operator can toggle is this button. The button is setup like this remote-start halui.program.run halui.mode.auto = parport 15
What Im going to try next is to create a manual and auto button on the screen. By selecting auto the switch can be configured as remote start halui.program. run halui.program.resume=parport 15. I have a feeling that it probaly will just start the program over with having Halui.program.run.
Any other suggestions?
If you use halui you can take advantage of the pins halui.program.is-paused, is-idle, resume, run to restart/start based on the current status. For this you use a logic operator to do the right thing.
In your hal file you want to do the following pseudo code
JohnCode:If paused then resume My button pressed | If idle then start
Is that exactly how I would type it into Hal? Im trying to find a good resourse on hal and halui online where I can learn the proper way on doing things like this.
No, that is pseudo code.
All the online docs are here:
http://www.linuxcnc.org/content/view/5/5/lang,en/
The basic HAL page is here:
http://www.linuxcnc.org/docview/html...basic_hal.html
The halui page is here:
http://www.linuxcnc.org/docview/html//gui_halui.html
This should get you started... once you chew on that a bit and after you get halui added open up the Show HAL Configuration and look at the pins for halui.
Hint you want to 'and2' two inputs and have the output of the 'and2' do the proper thing.
John
As of now there is only one input. That input is used to start a program. When a M0 is called in a program it pauses the program. I want the same input switch to resume the program.
Exactly why you need the and2 component. What your wanting to do is:
If the program is paused and the button is pressed then resume.
If the program is not running and the button is pressed the start the program.
So the button goes to both and2 components and is paused goes to one and2 and is idle goes to the second and2 component. The output of the one and2 component is resume and the output of the second and2 is start.
Does this make sense now?
John
Or jump on the IRC from this page and we can chat...
http://www.linuxcnc.org/content/view/4/8/lang,en/
John
I sort of understand.
So if I put this in the hal file it should work?
net RemoteStart and 2.0.in.0 <= paraport0.pin-15-in
net OktoRun and2.0.in.1 <= halui.program.idle
net Run halui.program.run <= and2.0.out
net RemoteStart and 2.1.in.0 <= paraport0.pin-15-in
net OktoResume and2.1.in.1 <= halui.program.paused
net Resume halui.program.run <= and2.1.out
That's pretty close. You will need to load the two and2 and add them as shown in the link. Also you will get an error trying to create the same signal twice I believe. I think your starting to understand nowPay attention to which hal file you add the above to.
Start by loading the and2's then start EMC if you get an error look at the bottom of the list for a hint.
Have Fun
John
ok, I entered the script and corrected the errors. But it does not and the two signals. I checked the hal meter for the two inputs and they are true but the output is not. Here is the script. Do I need to add something else?
loadrt and2 count=2
addf and2.0 servo-thread
net RemoteStart and2.0.in0 <= parport.0.pin-15-in-not
net OktoRun and2.0.in1 <= halui.program.is-idle
net Run halui.program.run <= and2.0.out
net RemoteStart and2.1.in0 <= parport.0.pin-15-in-not
net OktoResume and2.1.in1 <= halui.program.is-paused
net Resume halui.program.resume <= and2.1.out