I made my first m101 program for my lathe today. I wrote a g-code file
to test the turret setup:

%
m64p1    (turn turret rotate solenoid on)
g4p.2    (wait 200ms)
m64p2    (turn turret stop solenoid on)
g4p.2    (wait 200ms for turret to slow to stop)
m65p1    (turn turret rotate solenoid off)
g4p.2    (wait 200ms for turret to descend and lock)
m65p2    (turn turret solenoid off)
%

This worked very well to rotate one tool position. The next step was to
move this to m101. So I created an m101.ngc file containing:

#!/bin/sh
halcmd sets TurretRotate True
sleep .2
halcmd sets TurretStop True
sleep .2
halcmd sets TurretRotate False
sleep .2
halcmd sets TurretRotate False
exit 0

Then I removed the motion.digital-out-01,02 links from the io.hal file. 

This script also worked well, but I am concerned about the "sleep"
function. It is a user space function and is susceptible to delays,
which would not be good. Can anyone can suggest a realtime version of
sleep?

Next, I'll add the tool position feedback. I guess I will assemble the
four input bits in the shell script to make a nibble. Then compare it to
the requested position. Start the turret rotation and monitor the
position feedback. When the turret position matches, I'll invoke the
stop sequence, check the turret locked status bit and either exit or
error.

Is it typical to have a XZ position feature for the turret change, or is
it assumed that the operator has insured that the turret will clear any
obstruction?

It seems that python would be good for this script. I started studying
this link:
http://docs.python.org/tut/tut.html

I don't know nearly enough to use it for this script,but maybe the next
one.

Kirk Wallace


-------------------------------------------------------------------------
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
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to