Hi,

In EMC2 M1XX codes are simply "programs". Executable programs. So, they could be bash scripts, compiled C programs, a Python scripts...whatever can be executed.

When the interpreter finds a M1XX in the part-program, it simply executes the program/script with that name, after that, it continues to read and execute the g-code commands.

Example:

Imagine you have a relais in your CNC system and you want to activate it using a new M-code, say for example M101. And turning it off using another code, for example M102.
Consider you have this relais commanded by PIN 8 of the parallel port.
So, we are going to create two scripts, one named "M101" and other named "M102". You MUST place those scripts in the directory indicated in your .ini file as PROGRAM_PREFIX (in the [DISPLAY] section), those scripts MUST be executable, so don't forget to add the permission.

The first script (M101) will be like that:

#! /bin/bash
halcmd setp parport.0.pin-08-out 1

And the second (M102) will be like that:

#! /bin/bash
halcmd setp parport.0.pin-08-out 2

Save and try (make sure you don't have any signal hooked to pin 08). Looking with halmeter at pin 08 you will see it change from TRUE to FALSE using M101 or M102 in the MDI command line.

This is the simplest use you can imagine, but you can do very complex thing. First you can execute an entire and complex HAL file instead of a single command always using a simple bash script and you can easily interact with a PLC if that is what you need. Second, you can make a complex program also in C or in any programming language you want, and EMC2 will run that program when the interpreter encounter the code, the G-code placed after that will be executed only when the program is terminated.

I hope this helps. I've tested it and works, so I'm sure it can be done. If you have still difficults, please feel free to contact me again.

Regards,

Manfredi


My websites: www.m24-pro.com
                     www.emc2cnc.altervista.org





From: "Jaime Pozo" <[EMAIL PROTECTED]>
Reply-To: "Enhanced Machine Controller (EMC)" <[email protected]>
To: [email protected]
Subject: [Emc-users] M1xx code and PLC
Date: Mon, 23 Jul 2007 11:25:54 -0400

Hello,

I need to implement some M1xx codes, in order to handle
some jobs programmed in a PLC,
but i don“t find more information about how it works (M1xx).

Can somebody help me?


Many thanks,

JJ


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/


_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to