Urgent help required with EMC please

More
18 Aug 2016 16:00 #79014 by sxyuklad
Hi Todd,

Yes, that is another possibility to use index pulse as a reset, but it will reset to 0 (zero) but index means tool #1 so how will I handle that one extra pulse which after index makes it zero to one. Hmmm, but definitely a possibility but still because I have a few spare outputs on my breakout board and creating a logic within linux will be much simpler.

CNCBASHER, that is what I am saying what will be the code. Simply can you write the code that I will need to write in hal file to make a stepgen and just assingn any input pin to receive a number from the ATC comp I already have:

Something like this:

STEPGEN coding in hal
Out pin connection for parallel port pin (any number)
An input pin to receive the number from ATC comp and this number is given to the outpin above
And an outpin from comp to forward the same number to the input pin in hal as above

I not sure if I am making sense. Basically, stepgen makes number of pulses on a parallel port output based on a number which will be forwarded to it from the comp.

Another point which I want to make clear here. I do not want the pulses to go with each changing tool as the turret is rotating. What I want to do when I call an M6 command, I will reset the (external counter) pretty easy, at least I can do this on my own. Now I do not want the counter changing as the turret is rotating. By the end of tool change process, whatever tool number is, I will want to forward the same number of pulses by the end of process so the counter will jump from 0 to whatever tool was set. Hope I made my point clear enough.

Please Log in or Create an account to join the conversation.

More
18 Aug 2016 16:08 #79015 by sxyuklad
Yes another consideration that I need to take in mind is if the pulses are too fast the counter may miss them as it says 30p/s so I would assume that means 30 pulses per second? But that is pretty slow. So I need to make sure there is a little delay between each pulse so they are not more than 30p/s... so that is like 33.33 millisecond gap at the least between each pulse if my match was correct.

Please Log in or Create an account to join the conversation.

More
18 Aug 2016 20:04 #79021 by sxyuklad
OK, here is my simple question if anyone can answer and tell how to do it.

Can I execute a simple Gcode command from my ATC comp? For example, while toochanging process, at certain stage I want to tell X and Z axis to go to a certain location. For example "G01 X10.0 Z50.0 F100". How can I execute this or any Gcode statement from the comp? Anyone, any solution and what is the syntax for coding this line?

Please Log in or Create an account to join the conversation.

More
18 Aug 2016 21:21 #79023 by andypugh

Can I execute a simple Gcode command from my ATC comp?


Unfortunately not, due to the structure of LinuxCNC.

The G-code interpreter runs in "user space" and the HAL system runs in realtime in "kernel space".
The G-code interpreter passes data to the realtime motion system, but almost no data passes the other way. Which, as you have noticed, is unfortunate.

This is one place where the Mach macro system is better than LinuxCNC.

If you just need to move to a fixed position before doing the toolchange, then a couple of options are built-in.
linuxcnc.org/docs/2.7/html/config/ini-co....html#_emcio_section
See tool-change-position

To integrate axis movement into a tool change sequence you have to put the G-code in charge, and have the G-code trigger the comp at the right time.

You can "Remap" the M6 command (and many others) to call a G-code subroutine. There is an example of this that you can run by starting LinuxCNC in sim/axis/vismach/vmc_toolchanger from the config chooser in the samples.

The key to that is this g-code subroutine: github.com/LinuxCNC/linuxcnc/blob/master...hange/toolchange.ngc
Which gets called on M6 because the INI file contains the line:
REMAP= M6 modalgroup=6 prolog=change_prolog ngc=toolchange epilog=change_epilog

Please Log in or Create an account to join the conversation.

More
18 Aug 2016 22:42 #79027 by sxyuklad
Hmmm, interesting Andy. Well Mach certainly is taking more in this department because I am able to give any Gcode anywhere within an M6 macro and it will just run as normal Gcode even in middle of a toolchange process. I would seriously like to see this feature in linuxcnc I do know if that would even be possible in the future or not.

Anyway, I do not intend to set a toolchange position by a gcode. I wanted to do something else. As you may have gone through my previous posts, I am trying to find a way to send out counted number of pulse basically to any output pin on my parallel port. So I was not getting much help on that so I though why not just add Y axis through stepconf and asign two output pins to Y step and Y direction because in a lathe it is already not in use. So that way I can set a scale for example, I can have my setting that one rotation of Y axis motor travels 200mm so (200 steps per revolution) means each step is one mm. That way if I want to send out 4 pulses on my Y step pin, I would simply gcode in the toolchange procees "G01 Y4.0 F20" so this way 4mm = 4 steps of stepper = 4 pulses. So this way, I can also control the step gap between each pulse by stating feedrate with G01 command as stated above.

Basically I am trying to hook up an external counter, which shows the number it receives the number of pulses, so what I want to do is at the end of the tool change process, if tool is set to 4, I want to send 4 pulses so my counter reads 4 too. Do you have any idea how to do this or how can I set this with stepgen thing. Can you give me hal code, I looked through the documentation of stepgen but could not understabd how that works. I will appreciate any help in this matter. Thank you.

Please Log in or Create an account to join the conversation.

More
19 Aug 2016 10:29 #79043 by andypugh

Anyway, I do not intend to set a toolchange position by a gcode. I wanted to do something else. As you may have gone through my previous posts, I am trying to find a way to send out counted number of pulse basically to any output pin on my parallel port. So I was not getting much help on that so I though why not just add Y axis through stepconf and asign two output pins to Y step and Y direction because in a lathe it is already not in use. So that way I can set a scale for example, I can have my setting that one rotation of Y axis motor travels 200mm so (200 steps per revolution) means each step is one mm. That way if I want to send out 4 pulses on my Y step pin, I would simply gcode in the toolchange procees "G01 Y4.0 F20" so this way 4mm = 4 steps of stepper = 4 pulses.


OK, that makes sense. I can even see how that might look like an easy way to do what you want. But knowing the internals of LinuxCNC as I do its about the craziest way to try to do it imaginable, it would be an incredibly complicated choreography of different layers of LinuxCNC.

You don't need G-code to drive a stepgen component. Does your digital indicator respond to step-dir commands, or just count in one direction?

All you probably need is this in HAL
#add an extra stepgen by editing the existing loadrt stepgen line
#I assume it ends up being stepgen.4
loadrt stepgen step_type=0,0,0,0,0
...
setp stepgen.4.position-scale 1
...
net toolnum iocontrol.0.tool-number  stepgen.4.position-cmd

In practice that won't work as-is because the iocontrol.0.tool-number pin is already linked to a different signal, you need to use that signal name rather than my "toolnum". You might prefer to add an output pin to your custom .comp to drive the display stepgen.

(In fact you can probably miss out the stepgen and add a pin that pulses the correct number of times to your custom comp)

Please Log in or Create an account to join the conversation.

More
19 Aug 2016 16:08 #79078 by sxyuklad
Thank you Andy. You certainly explained how it could be done but I being newbie still cannot get it.

As you asked, my counter is basically only receives pulses. The number of pulses it will receive, it will show the same number. And there is a reset pin but that is not hard to drive. I can assign any output to that and when the tool is 6 (max tool numbet) I can set that pin high or low to reset it to zero. I shared images of my counter in one of previous posts. You can have a look at the connections available too.

Will be possible if I sent you my hal file and comp file, you can add a stepgen to send pulses to my parallel port pin # 14? I think that wilm be the best way, since you can will have good idea looking at my hal and component what need to be added and what not?

Can you please do me this favor? I will attach my files once I receive your positive reply. Thank you.

Please Log in or Create an account to join the conversation.

More
19 Aug 2016 16:22 #79080 by sxyuklad
On the other hand, I tried to change GUI but no success. It gives me a bunch of errors, please see attached file for error log. Can please someone point me out what I am doing wrong?

I did change my settings in my INI file as described in the following documentation link under display section:
linuxcnc.org/docs/html/gui/gmoccapy.html

And the settings I set:

[DISPLAY]
DISPLAY = gmoccapy
PREFERENCE_FILE_PATH = gmoccapy_preferences
DEFAULT_LINEAR_VELOCITY = 166.666
MAX_LINEAR_VELOCITY = 166.666
MAX_FEED_OVERRIDE = 1.5
MAX_SPINDLE_OVERRIDE = 1.2
MIN_SPINDLE_OVERRIDE = 0.5
LATHE = 1
BACK_TOOL_LATHE = 1
PROGRAM_PREFIX = ../../nc_files/

But that is the only thing I changed believing settings only will do the whole job, no file copying, no installation or anything else. Am I doing it correct or I need to copy past some file in my config/turn folder or need to install anything extra?

Please help me out looking at the error log.
Attachments:

Please Log in or Create an account to join the conversation.

More
21 Aug 2016 23:39 #79223 by andypugh
You might need to ask that in the Gmoccpy section

Please Log in or Create an account to join the conversation.

Time to create page: 0.170 seconds
Powered by Kunena Forum