Limit switch script for the Mesa 7i92

More
25 Aug 2017 16:24 #98003 by tmi
Hi I am new to setting up a machine to run with Linux. As I have found out I picked one on the hardest cards (7i92H) to start messing with Linux. I was able to get all the motor outputs to work on the 7i92 but I am having problem learning the how to write the script for the I/O's.

I just want to be able to set up I/O for the limit switches and add maybe a probe and coolant outputs. I want to say that the .hal file that I have will already support the spindle output. Any help would be great!
Attachments:

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

More
30 Aug 2017 14:26 #98213 by andypugh
Not having used a 7i92 I don't know what the input pins are called. Are you using any expansion boards?
What would a typical input pin name be in HAL with your hardware?

Do you have separate home and limit switches, or are they shared?

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

More
30 Aug 2017 19:51 #98230 by tmi
Thanks for getting back to me on this post.. I have (2) C10 breakout boards. They are booth DB25 boards with 17 usable I/O's. I have the one board controlling my step and direction. I use Teknic servo motors so all I need is the step and direction (pin 2-9) 1 & 17 are normally out puts and 14 &16 are the PWM. So that leave me with 10-13 &15 for inputs. I can configure the second board to be any kind of I/O.

So what I am looking for is just the simple code to add to the HAL and INI files that will allow me to control limit switches and even a probe. Just sample code that I can try to get my head wrapped around how to create code for any kind of input or out put that I may need. Again thanks for getting back and look forward to responses.

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

More
30 Aug 2017 20:52 - 30 Aug 2017 22:49 #98234 by PCW
BOB1 (7I92 P2) pin                             HAL pin     

10                        hm2_7i92.0.gpio.013.in  or  hm2_7i92.0.gpio.013.in_not
11                        hm2_7i92.0.gpio.014.in  or  hm2_7i92.0.gpio.014.in_not 
12                        hm2_7i92.0.gpio.015.in  or  hm2_7i92.0.gpio.015.in_not 
13                        hm2_7i92.0.gpio.016.in  or  hm2_7i92.0.gpio.016.in_not 
15                        hm2_7i92.0.gpio.003.in  or  hm2_7i92.0.gpio.003.in_not 

BOB2 (7I92 P1) pin                             HAL pin     

10                        hm2_7i92.0.gpio.030.in  or  hm2_7i92.0.gpio.030.in_not
11                        hm2_7i92.0.gpio.031.in  or  hm2_7i92.0.gpio.031.in_not 
12                        hm2_7i92.0.gpio.032.in  or  hm2_7i92.0.gpio.032.in_not 
13                        hm2_7i92.0.gpio.033.in  or  hm2_7i92.0.gpio.033.in_not 
15                        hm2_7i92.0.gpio.020.in  or  hm2_7i92.0.gpio.020.in_not 

 And if your BOB2 allows changing pins 2..9 to inputs:

2                        hm2_7i92.0.gpio.019.in  or  hm2_7i92.0.gpio.019.in_not 
3                        hm2_7i92.0.gpio.021.in  or  hm2_7i92.0.gpio.021.in_not 
4                        hm2_7i92.0.gpio.023.in  or  hm2_7i92.0.gpio.023.in_not 
5                        hm2_7i92.0.gpio.025.in  or  hm2_7i92.0.gpio.025.in_not 
6                        hm2_7i92.0.gpio.026.in  or  hm2_7i92.0.gpio.026.in_not 
7                        hm2_7i92.0.gpio.027.in  or  hm2_7i92.0.gpio.027.in_not 
8                        hm2_7i92.0.gpio.028.in  or  hm2_7i92.0.gpio.028.in_not 
9                        hm2_7i92.0.gpio.029.in  or  hm2_7i92.0.gpio.029.in_not 

So for example to wire BOB1 pin 10 to X axis negative limit, you would
do something like:

net xlimit-minus hm2_7i92.0.gpio.013.in => axis.0.neg-lim-sw-in

Note that xlimit-minus is an arbitrary name and that you might have to use the inverted input signal instead:

net xlimit-minus hm2_7i92.0.gpio.013.in_not => axis.0.neg-lim-sw-in
Last edit: 30 Aug 2017 22:49 by PCW.

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

More
30 Aug 2017 22:28 #98237 by andypugh

net xlimit-minus hm2_7i92.0.gpio.013.in => axis.0.neg-lim-sw-in


And, if you want to use one pin for both limits and the home:

net xlimit-both-home hm2_7i92.0.gpio.013.in => axis.0.neg-lim-sw-in axis.0.pos-lim-sw-in axis.0.home-sw-in

All the pins (for motion) are listed here:
linuxcnc.org/docs/2.7/html/man/man9/motion.9.html

Where you will also see motion.probe-input which would be connected in much the same way.

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

More
30 Aug 2017 23:14 #98244 by tmi
WOW guys thanks! You gave me some stuff that I can work on. If I sound excited I am. I have had the 7i92H for almost a year now not knowing how to set it up.. Once I got the motors to work I wanted to get the I/O's to work too. Is there any thing that I need to change in the INI file to get the HAL file to communicate? Again I am still wet behind the ears but am a fast learner.

Also say I wanted to set up a limit switch in the watch window to see how everything works or even a relay to test the outputs.. Any ideas? Again I am still wet behind the ears but am a fast learner.

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

More
30 Aug 2017 23:33 #98247 by andypugh
If you are using the Axis interface then you might find Machine->Halmeter to be useful.

Alternatively, from the command line, you can work on HAL "live"

halcmd -kf (if LinuxCNC is running)
loadusr halmeter
show pin
setp hm2_7i92.0.output.00 1

etc. That's not a real HAL pin name, I suspect, but "show" (accepts wildcards) will give you them, and the halcmd interface gives you command history and tab-competion just like the terminal.

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

More
31 Aug 2017 01:42 #98250 by tmi
Thanks- I am using Axis. it seems to be a good entry level GUI. I think I did see the Halmeter. I will work on trying to get that working..

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

More
31 Aug 2017 09:47 #98272 by andypugh
Also look at "Machine->Show HAL Config". That lets you see all the "pins" (inputs and outputs of the various modules) and the "parameters" (individual settings for each module) n your HAL. You can set up lists of pins to monitor in the "Watch" tab.

The GUI this brings up is called "Halshow" and you can also launch it from the command-line HAL interface with "loadusr halshow".

Then, you can look here in the sections:
+Commands and userspace components
+Realtime components and kernel modules
To see all the optional HAL components you can load and use, and all their pins.

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

Time to create page: 0.128 seconds
Powered by Kunena Forum