Mesa 5i25 7i77 0-10v spindle output Dual spindles

More
30 Aug 2014 06:44 #50498 by PCW
Actually rather than link and unlink pins shouldn't the spindle selection logic
be done with logic components (like AND OR etc)
The following user(s) said Thank You: jeeybee

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

More
30 Aug 2014 18:22 - 30 Aug 2014 18:23 #50515 by ArcEye

Actually rather than link and unlink pins shouldn't the spindle selection logic
be done with logic components (like AND OR etc)


Yes, except that they only deal with bit values, not floats, so cannot pass the actual value from motion.spindle.speed-out directly

I realised after I had shut the computer down, that in fact the OUT pin is motion.spindle.speed-out, so you can attach 2 IN pins to the linking signal anyway and feed both spindles from it.
No need to unlink and relink at all

net spindle-vel-cmd [second-spindle]-spinout <= motion.spindle-speed-out => hm2_5i25.0.7i77.0.0.spinout
Last edit: 30 Aug 2014 18:23 by ArcEye.
The following user(s) said Thank You: jeeybee

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

More
30 Aug 2014 21:20 #50519 by PCW
I was thinking of the enable logic to select which spindle is enabled

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

More
30 Aug 2014 21:30 #50522 by ArcEye
Yes you are right of course, I was purely thinking of the speed command :whistle:

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

More
01 Sep 2014 23:43 #50586 by andypugh

Yes, except that they only deal with bit values, not floats, so cannot pass the actual value from motion.spindle.speed-out directly


I would do this with a mux component. (well, actually, two of them acting as a demux)

In fact, the way to do it might be to set things up so that M3 works one spindle and M4 works the other. This will only work if there is no requirement to run the spindles in reverse, or both at the same time if using simple HAL logic to twiddle the connections.

Looking at www.linuxcnc.org/docs/html/remap/structu...p_remappable_codes_a

I think I would be tempted to remap M31, M32, M41, M42 to control the separate spindles.

I don't know if it is possible to require an "S" argument to the M31 command, but it is possible to remap S itself to do something cleverer, such as set the speed of the last-referenced spindle.
The following user(s) said Thank You: jeeybee

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

More
06 Sep 2014 18:25 #50846 by jeeybee
Had to take a break awhile with this but now Iḿ on it again.
As I said before, the analog out is not the issue anymore, I got it to do as I like and its not a problem that its on, on both analog outputs at the same time as this is not what starts the spindle.

To add some logic seem to be the best solution and as usual I got stuck on the basic things:

net spindle-cw => hm2_[HOSTMOT2](BOARD).0.7i77.0.0.output-02
net spindle-ccw => hm2_[HOSTMOT2](BOARD).0.7i77.0.0.output-03
newsig spindle2enable bit
sets spindle2enable 0
newsig spindle1enable bit
sets spindle1enable 1

loadrt and2 count=2
addf and2.0 servo-thread
addf and2.1 servo-thread
net and1in0 and2.0.in0 <= motion.spindle-forward
net and1in1 and2.0.in1 <= spindle1enable
net spindle-cw <= and2.0.out

This what I got so far but I get the error that spindle1enable does not exist although I can see it in halmeter?

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

More
07 Sep 2014 04:14 #50867 by andypugh

newsig spindle1enable bit
...
net and1in1 and2.0.in1 <= spindle1enable
This what I got so far but I get the error that spindle1enable does not exist although I can see it in halmeter?


You have defined spindle1enable as a signal, but then later you are trying to use it as a pin.
The format of the "net" command is

net signalname pinname1 pinnname2 … pinnnameN

If signalname doesn't exist then it is created.
pinnames all must already exist. And only one output pin can be connected to any one signalname.
(it is slightly confusing that physical output pins are input pins in HAL, because they accept, rather than output, a value)

I think you code needs to look something like
net spindle-cw => hm2_[HOSTMOT2](BOARD).0.7i77.0.0.output-02
net spindle-ccw => hm2_[HOSTMOT2](BOARD).0.7i77.0.0.output-03
loadrt and2 count=2
addf and2.0 servo-thread
addf and2.1 servo-thread

net spindle1enable => and2.0.in0
net spindle2enable => and2.1.in0
net all-spindles-on and2.0.in1 and2.1.in1

net spindle1out and2.0.out => hm2_[HOSTMOT2](BOARD).0.7i77.0.0.output-02
net spindle2out and2.1.out => hm2_[HOSTMOT2](BOARD).0.7i77.0.0.output-03

sets spindle1enable 1
sets spindle2enable 0

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

More
14 Sep 2014 19:42 - 14 Sep 2014 19:43 #51155 by jeeybee
Thanks, now its working as I want it to :)

Here are the final code if someone else want to do the same thing:

#Settings in INI:
[SPINDLE]

MIN_LIMIT = 0.0
MAX_LIMIT = 3000
SCALE_MAX = 3000

[SPINDLE_2]

MIN_LIMIT = 0.0
MAX_LIMIT = 24000
SCALE_MAX = 24000

#HAL:
#Spindle 0-10v
setp hm2_[HOSTMOT2](BOARD).0.7i77.0.1.analogout4-scalemax [SPINDLE]SCALE_MAX
setp hm2_[HOSTMOT2](BOARD).0.7i77.0.1.analogout4-minlim [SPINDLE]MIN_LIMIT
setp hm2_[HOSTMOT2](BOARD).0.7i77.0.1.analogout4-maxlim [SPINDLE]MAX_LIMIT
loadrt abs count=2 #2 behövs endast om 2st spindlar
addf abs.0 servo-thread
net spindle-speed-scale motion.spindle-speed-out => abs.0.in
net positive-only-spindle-speed-cmd abs.0.out => hm2_[HOSTMOT2](BOARD).0.7i77.0.1.analogout4

#Spindle2 0-10v
setp hm2_[HOSTMOT2](BOARD).0.7i77.0.1.analogout5-scalemax [SPINDLE_2]SCALE_MAX
setp hm2_[HOSTMOT2](BOARD).0.7i77.0.1.analogout5-minlim [SPINDLE_2]MIN_LIMIT
setp hm2_[HOSTMOT2](BOARD).0.7i77.0.1.analogout5-maxlim [SPINDLE_2]MAX_LIMIT
net positive-only-spindle-speed-cmd => hm2_[HOSTMOT2](BOARD).0.7i77.0.1.analogout5

#Dual spindle on/off CW/CCW
#and2.0 = Spindle 1 CW
#and2.1 = Spindle 2 CW
#and2.2 = Spindle 1 CCW
#and2.3 = Spindle 2 CCW

loadrt and2 count=4
addf and2.0 servo-thread
addf and2.1 servo-thread
net spindle-cw <= motion.spindle-forward
net spindle-cw => and2.0.in0 and2.1.in0
net spindle1enable => and2.0.in1 and2.2.in1
net spindle2enable => and2.1.in1 and2.3.in1

addf and2.2 servo-thread
addf and2.3 servo-thread
net spindle-ccw <= motion.spindle-reverse
net spindle-ccw => and2.2.in0 and2.3.in0

net spindle1outCW and2.0.out => hm2_[HOSTMOT2](BOARD).0.7i77.0.0.output-02
net spindle2outCW and2.1.out => hm2_[HOSTMOT2](BOARD).0.7i77.0.0.output-04
net spindle1outCCW and2.2.out => hm2_[HOSTMOT2](BOARD).0.7i77.0.0.output-03
net spindle2outCCW and2.3.out => hm2_[HOSTMOT2](BOARD).0.7i77.0.0.output-05

sets spindle1enable 1
sets spindle2enable 0



#M101 Enable spindel 1
#!/bin/bash
halcmd sets spindle1enable 1
halcmd sets spindle2enable 0
#Analogout5 disable
halcmd setp hm2_5i25.0.7i77.0.1.spinena False
exit 0

#M102 Enable spindel 2
#!/bin/bash
halcmd sets spindle1enable 0
halcmd sets spindle2enable 1
#Analogout5 enable
halcmd setp hm2_5i25.0.7i77.0.1.spinena True
exit 0
Last edit: 14 Sep 2014 19:43 by jeeybee.

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

Time to create page: 0.071 seconds
Powered by Kunena Forum