installing MPG2 handwheel on 3-axis mill
- southbayguy
- Offline
- Senior Member
-
Less
More
- Posts: 63
- Thank you received: 1
03 Jul 2016 21:57 #76948
by southbayguy
installing MPG2 handwheel on 3-axis mill was created by southbayguy
Hi -
Using LinuxCNC (2.5.4) with a Motenc-Lite PCI interface card on K2CNC "iron" I have been having good luck running long surfacing programs. Thanks to the LinuxCNC community for helping me get this far.
Now I'm trying to make setup a little easier by installing a handwheel.
For that purpose, I bought an MPG2 pendant and C22 interface card from CNC4PC. The hardware is installed, on the existing parallel port on my controller PC.
I started with the sample jog.hal file from Linux CNC linuxcnc.org/docs/2.5/html/examples/mpg.html and edited it to change all the parport.1.xxx's to parport.0.xxx because I'm figuring I can use the existing parallel port on the PC instead of a second one. The scenario envisioned for the jog.hal file is that a PCI card for a second parallel port will be used. In my case it's not necessary.
I added the edited jog.hal file to motenc.ini.
Fire 'er up and get alotta errors:
Can not find -sec MOT -var MOT -num 1
Can not find -sec IO -var IO -num 1
Can not find -sec LINUXCNC var NML_FILE -num 1
Can not find -sec EMC -var NML_FILE -num 1
jog.hal:35 'parport.0.pin-09-in' does not exist.
Any guidance is appreciated.
-Southbayguy
Using LinuxCNC (2.5.4) with a Motenc-Lite PCI interface card on K2CNC "iron" I have been having good luck running long surfacing programs. Thanks to the LinuxCNC community for helping me get this far.
Now I'm trying to make setup a little easier by installing a handwheel.
For that purpose, I bought an MPG2 pendant and C22 interface card from CNC4PC. The hardware is installed, on the existing parallel port on my controller PC.
I started with the sample jog.hal file from Linux CNC linuxcnc.org/docs/2.5/html/examples/mpg.html and edited it to change all the parport.1.xxx's to parport.0.xxx because I'm figuring I can use the existing parallel port on the PC instead of a second one. The scenario envisioned for the jog.hal file is that a PCI card for a second parallel port will be used. In my case it's not necessary.
I added the edited jog.hal file to motenc.ini.
Fire 'er up and get alotta errors:
Can not find -sec MOT -var MOT -num 1
Can not find -sec IO -var IO -num 1
Can not find -sec LINUXCNC var NML_FILE -num 1
Can not find -sec EMC -var NML_FILE -num 1
jog.hal:35 'parport.0.pin-09-in' does not exist.
Any guidance is appreciated.
-Southbayguy
Please Log in or Create an account to join the conversation.
- tommylight
-
- Away
- Moderator
-
Less
More
- Posts: 18565
- Thank you received: 6223
03 Jul 2016 23:43 #76952
by tommylight
Replied by tommylight on topic installing MPG2 handwheel on 3-axis mill
As far as i can figure out, there is no loadrt for parport, so it will not work without it.
Below is a sample for loading what is needed for a port to work, but do double check if you have that already in other hal files for the config you are using.
# first load the parport driver
loadrt hal_parport cfg="cc00"
#
# next connect the parport functions to threads
# read inputs first
addf parport.0.read base-thread 1
# write outputs last
addf parport.0.write base-thread -1
Regards,
Tom
Below is a sample for loading what is needed for a port to work, but do double check if you have that already in other hal files for the config you are using.
# first load the parport driver
loadrt hal_parport cfg="cc00"
#
# next connect the parport functions to threads
# read inputs first
addf parport.0.read base-thread 1
# write outputs last
addf parport.0.write base-thread -1
Regards,
Tom
The following user(s) said Thank You: southbayguy
Please Log in or Create an account to join the conversation.
04 Jul 2016 15:46 #76969
by andypugh
It is also possible that the config (using motenc-lite) might not have a base thread. The servo thread might be OK, you just lose counts if you move the MPG more than 2.5 turns per second. This isn't likely to be a problem as you are running closed-loop optical feedback (ie, watching what you are doing).
However, the Motenc card might well have a spare encoder counter that can be used with the MPG, have you checked that possibility?
Replied by andypugh on topic installing MPG2 handwheel on 3-axis mill
As far as i can figure out, there is no loadrt for parport, so it will not work without it.
It is also possible that the config (using motenc-lite) might not have a base thread. The servo thread might be OK, you just lose counts if you move the MPG more than 2.5 turns per second. This isn't likely to be a problem as you are running closed-loop optical feedback (ie, watching what you are doing).
However, the Motenc card might well have a spare encoder counter that can be used with the MPG, have you checked that possibility?
The following user(s) said Thank You: tommylight, southbayguy
Please Log in or Create an account to join the conversation.
- southbayguy
- Offline
- Senior Member
-
Less
More
- Posts: 63
- Thank you received: 1
04 Jul 2016 22:14 #76995
by southbayguy
Replied by southbayguy on topic installing MPG2 handwheel on 3-axis mill
Hi -
I should have thought of this sooner ... I'm trying the incremental approach. I shortened my jog.hal file to two lines
loadrt hal_parport cfg="cc00"
addf parport.0.read servo-thread 1
... and that doesn't bomb! !! Wonderful! My feeling is: if you can get one thing to work, you can get other things to work.
Now I'm iterating through, adding a block of lines from the full-length jog.hal file that doesn't work to the shortened file that does not bomb.
I was getting so many errors in the beginning it didn't occur to me that the incremental approach might work. I thought I was doing something completely off the wall wrong.
Also, in the Utility HAL Meter, I'm seeing parport inputs ... so that's a good sign.
Thnx.
-southbayguy
I should have thought of this sooner ... I'm trying the incremental approach. I shortened my jog.hal file to two lines
loadrt hal_parport cfg="cc00"
addf parport.0.read servo-thread 1
... and that doesn't bomb! !! Wonderful! My feeling is: if you can get one thing to work, you can get other things to work.
Now I'm iterating through, adding a block of lines from the full-length jog.hal file that doesn't work to the shortened file that does not bomb.
I was getting so many errors in the beginning it didn't occur to me that the incremental approach might work. I thought I was doing something completely off the wall wrong.
Also, in the Utility HAL Meter, I'm seeing parport inputs ... so that's a good sign.
Thnx.
-southbayguy
Please Log in or Create an account to join the conversation.
- southbayguy
- Offline
- Senior Member
-
Less
More
- Posts: 63
- Thank you received: 1
04 Jul 2016 22:34 #76996
by southbayguy
Replied by southbayguy on topic installing MPG2 handwheel on 3-axis mill
Using the incremental approach, I have found that LinuxCNC bombs (won't start; puts up error window) at this line:
net mpg-a encoder.0.phase-A <= parport.0.pin-02-in
... amongst other things, it says parport.0.pin-02-in does not exist. It does NOT say no parport input pins exist, because it accepts the line
net scale2 mux4.0.sel1 <= parport.0.pin-10-in
... just thinking out loud here. Do I remember that parallel ports -at least some of the pins- are bidirectional? Is there maybe a configuration setting other than "cc00" I should be using?
Thnx.
-southbayguy
net mpg-a encoder.0.phase-A <= parport.0.pin-02-in
... amongst other things, it says parport.0.pin-02-in does not exist. It does NOT say no parport input pins exist, because it accepts the line
net scale2 mux4.0.sel1 <= parport.0.pin-10-in
... just thinking out loud here. Do I remember that parallel ports -at least some of the pins- are bidirectional? Is there maybe a configuration setting other than "cc00" I should be using?
Thnx.
-southbayguy
Please Log in or Create an account to join the conversation.
- tommylight
-
- Away
- Moderator
-
Less
More
- Posts: 18565
- Thank you received: 6223
04 Jul 2016 22:36 #76997
by tommylight
Replied by tommylight on topic installing MPG2 handwheel on 3-axis mill
Nice !
One more thing before you move on:
loadrt hal_parport cfg="cc00"
should actually be
loadrt hal_parport cfg="0x378 in"
in your case, assuming you are using the built in paraport.
Regards
One more thing before you move on:
loadrt hal_parport cfg="cc00"
should actually be
loadrt hal_parport cfg="0x378 in"
in your case, assuming you are using the built in paraport.
Regards
The following user(s) said Thank You: southbayguy
Please Log in or Create an account to join the conversation.
- southbayguy
- Offline
- Senior Member
-
Less
More
- Posts: 63
- Thank you received: 1
04 Jul 2016 22:45 #76998
by southbayguy
Replied by southbayguy on topic installing MPG2 handwheel on 3-axis mill
Hi -
Maybe this sample jog.hal file is giving me grief because I'm using the built-in parallel port on the computer ... maybe the built-in parallel port is being configured somewhere else in the O.S. and LinuxCNC is having trouble applying its own configuration ...
... still thinking out loud
-southbayguy
Maybe this sample jog.hal file is giving me grief because I'm using the built-in parallel port on the computer ... maybe the built-in parallel port is being configured somewhere else in the O.S. and LinuxCNC is having trouble applying its own configuration ...
... still thinking out loud
-southbayguy
Please Log in or Create an account to join the conversation.
04 Jul 2016 22:52 #76999
by andypugh
Replied by andypugh on topic installing MPG2 handwheel on 3-axis mill
You can get a list of all the pins that belong to your parport:
Load your last working hal file. Then open a terminal window and type
halcmd show pin.
Load your last working hal file. Then open a terminal window and type
halcmd show pin.
The following user(s) said Thank You: southbayguy
Please Log in or Create an account to join the conversation.
- southbayguy
- Offline
- Senior Member
-
Less
More
- Posts: 63
- Thank you received: 1
05 Jul 2016 00:49 #77007
by southbayguy
Replied by southbayguy on topic installing MPG2 handwheel on 3-axis mill
With the change to cfg="0x378 in" LinuxCNC starts with the jog.hal file entire --pretty much the same as the sample file-- in place. There are no errors. On the other hand, the handwheel doesn't work at all. I'm beginning to suspect I missed something in the hardware install. At the bottom of the CNC4PC C22 interface card there are (5) terminal blocks, two for power and ground and (3) others for an estop circuit. Does anyone know if the estop terminals needs to be jumpered for the card to work?
Thanks.
-southbayguy
When I power up the computer (or when I plug in the 5V and ground to the card), I hear a click from the relay on the card. I'm assuming the click is the relay pulling in (enabling) and that the card is set up to be enabled by default ... but I don't know. I couldn't figure out the C22 manual.
Thanks.
-southbayguy
When I power up the computer (or when I plug in the 5V and ground to the card), I hear a click from the relay on the card. I'm assuming the click is the relay pulling in (enabling) and that the card is set up to be enabled by default ... but I don't know. I couldn't figure out the C22 manual.
Please Log in or Create an account to join the conversation.
05 Jul 2016 08:55 #77015
by andypugh
There isn't much to miss.
Can you see the pins that the MPG is connected to changing state in HAL when you turn the wheel? (might need Halscope to see it).
Is the encoder counter working?
Does the encoder counter output go somewhere?
Replied by andypugh on topic installing MPG2 handwheel on 3-axis mill
With the change to cfg="0x378 in" LinuxCNC starts with the jog.hal file entire --pretty much the same as the sample file-- in place. There are no errors. On the other hand, the handwheel doesn't work at all
There isn't much to miss.
Can you see the pins that the MPG is connected to changing state in HAL when you turn the wheel? (might need Halscope to see it).
Is the encoder counter working?
Does the encoder counter output go somewhere?
The following user(s) said Thank You: southbayguy
Please Log in or Create an account to join the conversation.
Time to create page: 0.088 seconds