Second spindle- HAL configuration

More
24 Aug 2023 14:02 - 24 Aug 2023 14:13 #278861 by RobotMatic
I am trying to configure a second spindle to control by pwm an inductor by control of 0-10volt
I have created a second HAL PWM component perfectly to assign to the second spindle. Until here everything perfect.
I understand that spindle.0 is created by Motion
I need to declare spindle.1 and I do not realize how to do it and I do not know if you can perform loadrt spindle?

How can I declare a second spindle ?

thank you very much
Last edit: 24 Aug 2023 14:13 by RobotMatic.

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

More
24 Aug 2023 14:32 #278863 by billykid
in the ini file you set the number of spindles... if you now have [SPINDLE_0] add  [SPINDLE_1]and do two separate configurations.
linuxcnc.org/docs/devel/html/examples/spindle.html
The following user(s) said Thank You: RobotMatic

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

More
24 Aug 2023 14:55 #278866 by andypugh

How can I declare a second spindle ?

In the INI, and possibly the HAL. 

[TRAJ] NUM_SPINDLES
linuxcnc.org/docs/stable/html/config/ini...g.html#_traj_section

And also in the HAL (though this may be linked to the INI)
linuxcnc.org/docs/stable/html/man/man9/motion.9.html

ie, in the HAL you will have either

loadrt motmod num_joints=3..... num_spindles=1...

Or, possibly

loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS num_spindles=[TRAJ]SPINDLES

In the latter case it is all automatic, and only needs to be altered in the INI file, as the HAL values are read-in from the INI.
​​​​​​​
The following user(s) said Thank You: RobotMatic

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

More
24 Aug 2023 15:09 #278868 by RobotMatic
THANK!!!!!!

SPINDLES =2 in the .INI file and in the .HAL file :

  Motion 

loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS num_spindles=[TRAJ]SPINDLES
addf motion-command-handler servo-thread
addf motion-controller servo-thread

#

#
  pwngen

loadrt pwmgen output_type=1,1            
addf pwmgen.make-pulses base-thread
addf pwmgen.update servo-thread


#
Spindle-0 pwm
setp pwmgen.0.pwm-freq 100.0
setp pwmgen.0.scale 1166.66666667
setp pwmgen.0.offset 0.114285714286
setp pwmgen.0.dither-pwm true


#
Spindle-1 pwm
setp pwmgen.1.pwm-freq 100.0
setp pwmgen.1.scale 1166.66666667
setp pwmgen.1.offset 0.114285714286
setp pwmgen.1.dither-pwm true
#



#
spindle 0  

net spindle-0-cmd-rpm         => pwmgen.0.value
net spindle-0-on              <= spindle.0.on => pwmgen.0.enable
net spindle-0-pwm             <= pwmgen.0.pwm
net spindle-0-cmd-rpm         <= spindle.0.speed-out
net spindle-0-cmd-rpm-abs     <= spindle.0.speed-out-abs
net spindle-0-cmd-rps         <= spindle.0.speed-out-rps
net spindle-0-cmd-rps-abs     <= spindle.0.speed-out-rps-abs
net spindle-at-speed          => spindle.0.at-speed
net spindle-0-cw              <= spindle.0.forward
#



#
spindle 1

net spindle-1-cmd-rpm         => pwmgen.1.value
net spindle-1-on              <= spindle.1.on => pwmgen.1.enable
net spindle-1-pwm             <= pwmgen.1.pwm
net spindle-1-cmd-rpm         <= spindle.1.speed-out
net spindle-1-cmd-rpm-abs     <= spindle.1.speed-out-abs
net spindle-1-cmd-rps         <= spindle.1.speed-out-rps
net spindle-1-cmd-rps-abs     <= spindle.1.speed-out-rps-abs
#net spindle-at-speed          => spindle.1.at-speed
net spindle-1-cw              <= spindle.1.forward
#




 
The following user(s) said Thank You: tommylight

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

More
24 Aug 2023 15:39 #278872 by billykid
I also have two spindles, a 24000 rpm vfd and a maximum 5000 rpm pwm for milling but I preferred to keep 2 separate configurations and start the one I need because you have to use different commands for the two spindles. M3 for the first M3 $2 for the second etc
so out of laziness I didn't touch anything

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

Time to create page: 0.287 seconds
Powered by Kunena Forum