Controlling lube pump & a second parallel post
- TarHeelTom
- Offline
- Premium Member
- Posts: 91
- Thank you received: 1
I've just noticed that I had to shut down EMC after fixing the M100 file or I kept getting the same error. Might not reload it or something every time.
John
I wasn't sure, so have been restarting it each time.
I've got to go try the eval statement...
Tom
Please Log in or Create an account to join the conversation.
- TarHeelTom
- Offline
- Premium Member
- Posts: 91
- Thank you received: 1
Just reconfirmed, doing it from the hal-show page still works, and actually makes the led on the bob go on and off.
Please Log in or Create an account to join the conversation.
#!/bin/sh
Maybe try #! /bin/bash ?
halcmd setp parport.1.pin-16-out False
Maybe try 0 and 1 rather than true and false?
Please Log in or Create an account to join the conversation.
- TarHeelTom
- Offline
- Premium Member
- Posts: 91
- Thank you received: 1
TarHeelTom wrote:
#!/bin/sh
Maybe try #! /bin/bash ?
halcmd setp parport.1.pin-16-out False
Maybe try 0 and 1 rather than true and false?
Switching 'bash' for 'sh' doesn't seem to help.
Looks, at least in the hal window, that 0 & 1 can be substituted for false & true without any ill effects.
Wrote a short gcode program involving a z movement, an x movement, turn on vacuum, return x to 0, then return z to 0, turn off vacuum.
The program runs, but hangs up on the M code every time, unless I comment out the Mcodes. So the M code files appear to be the problem.
Any other ideas?
Tom
Please Log in or Create an account to join the conversation.
- TarHeelTom
- Offline
- Premium Member
- Posts: 91
- Thank you received: 1
Finally got M100 and M101 work, both from the mdi line and internally in a program.
The fix was so simple that I only thought about it after doing something else for a couple of hours.
As the linux machine for the mill is not hooked to internet, I traipse back and forth around the house all day and all night with a pair of thumb drives in my pocket. For this reason, I have the editor on my linux/emc machine set to put the Windows line ending on each line of text, rather than the shorter linux version.
And I've finally stumbled across one place where that extra /r causes a problem, the M code interpreter.
Fired the machine up a few minutes ago, changed all the line endings, and it ran just fine.
So thanks to all the help from you guys on this one. Next need to convince the lube pump to run on its on, haven't started in on this one yet.
Thanks
Tom
Please Log in or Create an account to join the conversation.
Any other ideas?
I suspect your permissions are not right or something equally simple
Our posts crossed in the ether and you got in first, glad you found the problem
Attached is a file M111 which does what you want in a single file.
It is used by M111 P1 (or P0) to turn the vacuum on or off.
#!/bin/bash
if [ ! $# -ge 1 ]; then
echo "Usage: M111 n - where n 0=off or 1=on"
exit 1
fi
float=$1
int=${float/\.*}
halcmd setp parport.1.pin-16-out $int
exit 0
I set the permissions as root to 777 (open to everything and everyone)
You may want to try that, but you will probably stick with what you have now it works!!
regards
Please Log in or Create an account to join the conversation.
- TarHeelTom
- Offline
- Premium Member
- Posts: 91
- Thank you received: 1
Hi
Any other ideas?
I suspect your permissions are not right or something equally simple
Our posts crossed in the ether and you got in first, glad you found the problem
Attached is a file M111 which does what you want in a single file.
It is used by M111 P1 (or P0) to turn the vacuum on or off.
#!/bin/bash
if [ ! $# -ge 1 ]; then
echo "Usage: M111 n - where n 0=off or 1=on"
exit 1
fi
float=$1
int=${float/\.*}
halcmd setp parport.1.pin-16-out $int
exit 0
I set the permissions as root to 777 (open to everything and everyone)
You may want to try that, but you will probably stick with what you have now it works!!
regards
Thanks for the effort. I'll probably stick with what I have for now, but will also try changing the M101 code to turn off not only the vacuum, but the flood and mist at the same time. That way I can add a single command to a standard Gcode footer and do a bunch of cleanup at the same time.
But I already had in the back of my mind adding a comment to show the useage of the Mcodes, and you've shown me how to do that, so I don't have to look it up.
Now all that's left in this area is to convince the lube pump to run whenever there is motion. But that's a task for tomorrow. Time for some shuteye now.
Tom
Please Log in or Create an account to join the conversation.
- TarHeelTom
- Offline
- Premium Member
- Posts: 91
- Thank you received: 1
Got both parallel ports working. Good movement on X and Y, but none on Z. Finally discovered two wires solder bridged inside the Z axis stepper connector. My bad.
Fixed the connector, good movement on all three axes.
Starting hooking up limit switches. Z has three separate switches. Using one as upper limit and home switch, another as lower limit. Third switch is not used with EMC2.
Set the switches up in hal according to the stepconf wizzard, but they switches are not doing anything.
On the hal conf screen, I can see both switches activate at the appropriate times, but EMC2 is ignoring them.
What am I doing wrong?
Current hal and ini are attached.
Please Log in or Create an account to join the conversation.
What am I doing wrong?
Quite a bit I'm afraid
1) Your files were created with a word processor or windows editor, they have spurious ^M control characters all over them.
Use GEdit, windows uses different Carriage Return / Line Feed settings and word processors insert all sorts of formatting control charactors.
This is a problem waiting to happen but not your actual problem.
2) Your .ini file does not have any instructions as to how EMC is to home each axis, so it won't do it, even if it were possible (see 3)
Should have
HOME_LATCH_VEL
HOME_LATCH_DIRECTION (optional if different)
HOME_SEARCH_VEL
for each axis to be homed
Set the values very low to start and then tune them or you will crash into the home switches.
3) Your hal file has everything relating to limits commented out, except the last 2 lines, which create a signal which is not then connected to anything, so does nothing
#limit switches code by matt
#net lim1 axis.0.neg-lim-sw-in parport.1.pin-10-in
#net lim1 axis.0.pos-lim-sw-in parport.1.pin-10-in
#net lim1 axis.1.neg-lim-sw-in parport.1.pin-11-in
#net lim1 axis.1.pos-lim-sw-in parport.1.pin-11-in
#home & limit switches from stepconf
# net both-home-x <= parport.0.pin-11-in
# net both-home-y <= parport.0.pin-12-in
net min-z <= parport.1.pin-13-in
net max-home-z <= parport.1.pin-15-in
As an example, my mill has all the limits chained in series, but the procedure is the same.
Create the signals for limit and home switches in this case.
net all-limit <= parport.0.pin-13-in
net home-x <= parport.0.pin-10-in
net home-y <= parport.0.pin-11-in
net home-z <= parport.0.pin-12-in
Then for each axis attach the relevant hal pins to the signals you created
net all-limit => axis.0.neg-lim-sw-in
net all-limit => axis.0.pos-lim-sw-in
net home-x => axis.0.home-sw-in
4) I also note in your you have classic ladder loaded. I think stepconf is doing that automatically these days.
Unless you actually use it, comment out all references to it, just something else to load that you don't need.
Hopefully 2) and 3) will get you moving
regards
Please Log in or Create an account to join the conversation.
- TarHeelTom
- Offline
- Premium Member
- Posts: 91
- Thank you received: 1
Hi Tom
What am I doing wrong?
Quite a bit I'm afraid
1) Your files were created with a word processor or windows editor, they have spurious ^M control characters all over them.
Actually, the files were originally written by stepconf, then edited with GEdit on the linux machine. However, before transferring them to my Windows machine, which has internet access, I asked GEdit to add the M control characters, so that they would be readable on my Windows machine. And this was done only to the copy of the files on the thumb drive, not the copies in linux.
By the way, we did spend several days headscratching over the M100 file causing emc2 to hang. Turned out to be the extra control M characters. Now that control M is one of the first things i look for when trouble shooting.
The X and Y limit switches were commented out as those switches haven't been wired yet.
The rest of the information looks interesting, and will dive in as soon as I finsih work today.
Thanks
Tom
Please Log in or Create an account to join the conversation.