Trying to share pin for 2 axis home and limit using debounce

More
17 Jul 2023 17:14 #275664 by reBrick
I have not had much luck finding examples of sharing input pins, there is one example that is not really explained on the wiki:

# connect pin 13 to all three max limits
net XYZ-max-lim parport.0.pin-13-in-not => axis.0.pos-lim-sw-in
axis.1.pos-lim-sw-in axis.2.pos-lim-sw-in

I am converting a knee mill and using knee as U and quill as Z with a parallel port bob and need to use a tool setter (probe and estop) so I have run out of pins. I am trying to share pin 11 for Z and U home and limit using debounce and I get joint 2 (z) limit error when homing U trips limit switch. I appreciate any pointers.

Attached are my hal and ini files...

File Attachment:

File Name: knee-mill.hal
File Size:6 KB

File Attachment:

File Name: knee-mill.ini
File Size:3 KB
Attachments:

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

More
17 Jul 2023 19:54 #275675 by rodw
try:
net XYZ-max-lim <= parport.0.pin-13-in-not
net XYZ-max-lim => axis.0.pos-lim-sw-in
net XYZ-max-lim => axis.1.pos-lim-sw-in
net XYZ-max-lim => axis.2.pos-lim-sw-in

This is why I always like to use 2 lines in my hal assignments, you just never know when you want to use a pin more than once! 

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

More
17 Jul 2023 20:12 #275678 by reBrick
That seems similar to the wiki, I am trying to understand how to apply this to my use case with debounce. Everything I have tried complains about pins already being assigned

I don't understand the hal syntax with multiple components on one side of an optional direction indication. This is from my hal file to combine z and u on one pin.

net debounce-home-zu debounce.0.3.in <= parport.0.pin-11-in
net min-home-z debounce.0.3.out

#net debounce-home-u debounce.0.4.in <= parport.0.pin-11-in
#net min-home-u debounce.0.4.out

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

More
18 Jul 2023 20:07 #275763 by reBrick
Rod, thanks for the response. I didn't mean to sound unappreciative. I used your suggestion to split up the assignments and have the pins assigned the way I think they should be. When homing Z or U I get a joint error on the other joint sharing the switch.

net debounce-home-zu <= parport.0.pin-11-in
net debounce-home-zu => debounce.0.3.in
net home-zu <= debounce.0.3.out

net home-zu => joint.2.home-sw-in
net home-zu => joint.2.neg-lim-sw-in

net home-zu => joint.3.home-sw-in
net home-zu => joint.3.neg-lim-sw-in

I am using this on joints 2 and 3...
HOME_IGNORE_LIMITS = YES
HOME_IS_SHARED = 1

File Attachment:

File Name: knee-mill_...7-18.hal
File Size:5 KB
 

File Attachment:

File Name: knee-mill_...18-2.ini
File Size:3 KB

 
Attachments:

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

More
19 Jul 2023 02:02 #275780 by rodw
This is what happens when you try to be sneaky 

For each joint, there is a pin joint.N.homing OUT BIT  TRUE if the joint is currently homing.
ref: linuxcnc.org/docs/2.9/html/man/man9/motion.9.html#JOINT%20PINS 
So what you could try is to AND2 your home switch with this pin and use the output as your home switch input
So the home switch input will only be seen if the particular joint is homing. Thats now super sneaky  and It should work!
The following user(s) said Thank You: reBrick

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

More
19 Jul 2023 03:11 - 19 Jul 2023 16:27 #275785 by reBrick
I remembered this statement "block the limit signals of the joints not homing in HAL and home one joint at a time" and found this thread...

forum.linuxcnc.org/38-general-linuxcnc-q...ther-joints-blocking

Using Stepconf and selecting "all limits and homes" for an input generates a working example using lut5 
I was getting an error initially on homing U, but it kind of went away on its own, at least temporarily ("Home switch inactive before start of latch move").

I can now home all four axis and use my tool setter!

loadrt lut5

addf lut5.0 servo-thread

net debounce-home-zu <= parport.0.pin-11-in
net debounce-home-zu => debounce.0.3.in
net home-zu <= debounce.0.3.out

setp lut5.0.function 0x10000
net home-zu => lut5.0.in-2
net limit-zu <= lut5.0.out
net homing-z <= joint.2.homing => lut5.0.in-0
net homing-u <= joint.3.homing => lut5.0.in-1

net home-zu => joint.2.home-sw-in
net limit-zu => joint.2.neg-lim-sw-in
net limit-zu => joint.2.pos-lim-sw-in

net home-zu => joint.3.home-sw-in
net limit-zu => joint.3.neg-lim-sw-in
net limit-zu => joint.3.pos-lim-sw-in

File Attachment:

File Name: knee-mill_...18-2.hal
File Size:6 KB

File Attachment:

File Name: knee-mill_...7-18.ini
File Size:3 KB
Attachments:
Last edit: 19 Jul 2023 16:27 by reBrick. Reason: Adding samplecode

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

More
19 Jul 2023 07:52 #275797 by rodw
Good find. Interesting that Andy suggested AND2 initially.

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

Time to create page: 0.075 seconds
Powered by Kunena Forum