+-10 volt spindle?
13 Sep 2013 23:01 #38774
by DaOne
Replied by DaOne on topic +-10 volt spindle?
No need to convert it. Just trying to wrap my brain around how it all works. So much to learn coming from Mach3 and never really even using Linux before this. I really appreciate the help guys. You wouldn't have any reading material on this subject do ya? I looked at the manual but it really does not go into detail on the spindle as far as I could tell. Maybe I am not looking in the right place? Thanks again. I will play with this example and see if I can get it going.
Please Log in or Create an account to join the conversation.
13 Sep 2013 23:46 #38776
by andypugh
Well, you sort-of want to look at
www.linuxcnc.org/docs/html/man/man9/motion.9.html
and
www.linuxcnc.org/docs/html/man/man1/halui.1.html
To get a feel for which HAL pins exist to do "things" with (and there are many more too, those are just two of the big sets).
However those pages won't make much sense without understanding HAL (The LinuxCNC Hardware Abstraction Layer) which is described here:
www.linuxcnc.org/docs/html/hal/basic_hal.html
What isn't made as clear as it perhaps could be is that Stepconf and PNCConf both do the same job of creating a HAL file which consists of the commands described in that manual page.
The HAL file is human-editable and for anything even slightly advanced or out of the normal you will have to edit the file. Each machine config mainly consists of an INI file and a HAL file. The HAL file normally reads info from the INI file, but is not the only thing to do so (nor does it have to, I tend to put most stuff directly in the HAL)
Replied by andypugh on topic +-10 volt spindle?
You wouldn't have any reading material on this subject do ya?
Well, you sort-of want to look at
www.linuxcnc.org/docs/html/man/man9/motion.9.html
and
www.linuxcnc.org/docs/html/man/man1/halui.1.html
To get a feel for which HAL pins exist to do "things" with (and there are many more too, those are just two of the big sets).
However those pages won't make much sense without understanding HAL (The LinuxCNC Hardware Abstraction Layer) which is described here:
www.linuxcnc.org/docs/html/hal/basic_hal.html
What isn't made as clear as it perhaps could be is that Stepconf and PNCConf both do the same job of creating a HAL file which consists of the commands described in that manual page.
The HAL file is human-editable and for anything even slightly advanced or out of the normal you will have to edit the file. Each machine config mainly consists of an INI file and a HAL file. The HAL file normally reads info from the INI file, but is not the only thing to do so (nor does it have to, I tend to put most stuff directly in the HAL)
Please Log in or Create an account to join the conversation.
14 Sep 2013 00:19 #38777
by JR1050
Replied by JR1050 on topic +-10 volt spindle?
I have a component written for just this application. Attached below.
put this in your halfile
################
# spindle
# ################
# axis enable chain
newsig emcmot.01.enable bit
sets emcmot.01.enable true
#net emcmot.01.enable => pid.1.enable
net emcmot.01.enable <= axis.1.amp-enable-out
# encoder feedback
setp hm2_5i25.0.encoder.01.counter-mode 0
setp hm2_5i25.0.encoder.01.filter 1
setp hm2_5i25.0.encoder.01.index-invert 1
setp hm2_5i25.0.encoder.01.index-mask 0
setp hm2_5i25.0.encoder.01.index-mask-invert 0
setp hm2_5i25.0.encoder.01.scale [SPINDLE_1]INPUT_SCALE
# set PID loop gains from inifile
setp pid.1.Pgain [SPINDLE_1]P
setp pid.1.Igain [SPINDLE_1]I
setp pid.1.Dgain [SPINDLE_1]D
setp pid.1.bias [SPINDLE_1]BIAS
setp pid.1.deadband [SPINDLE_1]DEADBAND
setp pid.1.maxoutput [SPINDLE_1]MAX_VELOCITY
# position command signals
setp hm2_5i25.0.7i77.0.1.analogout1-maxlim 5000 ## MUST BE MAX SPEED FOR PROPER SCALING ###
setp hm2_5i25.0.7i77.0.1.analogout1-minlim -5000
setp hm2_5i25.0.7i77.0.1.analogout1-scalemax 5000
##################enable m3 and m4#####################3
net spindle_on_for motion.spindle-forward = spindle.0.spindle-on-for
net spindle_on_rev motion.spindle-reverse = spindle.0.spindle-on-rev
net spl_run spindle.0.spl-run = pid.1.enable
net mot_spl_on motion.spindle-on = spindle.0.mot-spl-on
# Set up spindle speed
net spindle_rpm_cmd motion.spindle-speed-out => hm2_5i25.0.7i77.0.1.analogout1
# Attach the encoder to the motion and the scale
net spindle_rev_count motion.spindle-revs = hm2_5i25.0.encoder.01.position
net spindle_index_enable motion.spindle-index-enable = hm2_5i25.0.encoder.01.index-enable
net encoder_velocity motion.spindle-speed-in = hm2_5i25.0.encoder.01.velocity
##timer 2 for spindle wind down##
setp timedelay.2.on-delay 5
setp timedelay.2.off-delay 5 ## 3 second delay
net timer2_run spindle.0.timer2-run = timedelay.2.in
net timer2_off timedelay.2.out = spindle.0.timer2-off
net cl_spnl_perm spindle.0.cl-spnl-perm = hm2_5i25.0.7i77.0.0.output-11 #SPINDLE ENABLE RELAY 6
Then this in your ini
##spindle
[SPINDLE_1]
MAX_VELOCITY = .5
MAX_ACCELERATION = 20.0
BACKLASH = 0.000
INPUT_SCALE = 4096
OUTPUT_SCALE = 1.
OUTPUT_OFFSET = 0.0
MAX_OUTPUT = 1.0
# PID tuning params
DEADBAND = 0
P = 0
I = 0
D = 0
FF0 = 0
FF1 = 0
FF2 = 0
BIAS = 0
Then copy this to the modules directory with all the other components and compile using sudo comp. Make sure you add the timedelay component in your hal file and load the the now complied spindle comp.
Should work right off the bat....
put this in your halfile
################
# spindle
# ################
# axis enable chain
newsig emcmot.01.enable bit
sets emcmot.01.enable true
#net emcmot.01.enable => pid.1.enable
net emcmot.01.enable <= axis.1.amp-enable-out
# encoder feedback
setp hm2_5i25.0.encoder.01.counter-mode 0
setp hm2_5i25.0.encoder.01.filter 1
setp hm2_5i25.0.encoder.01.index-invert 1
setp hm2_5i25.0.encoder.01.index-mask 0
setp hm2_5i25.0.encoder.01.index-mask-invert 0
setp hm2_5i25.0.encoder.01.scale [SPINDLE_1]INPUT_SCALE
# set PID loop gains from inifile
setp pid.1.Pgain [SPINDLE_1]P
setp pid.1.Igain [SPINDLE_1]I
setp pid.1.Dgain [SPINDLE_1]D
setp pid.1.bias [SPINDLE_1]BIAS
setp pid.1.deadband [SPINDLE_1]DEADBAND
setp pid.1.maxoutput [SPINDLE_1]MAX_VELOCITY
# position command signals
setp hm2_5i25.0.7i77.0.1.analogout1-maxlim 5000 ## MUST BE MAX SPEED FOR PROPER SCALING ###
setp hm2_5i25.0.7i77.0.1.analogout1-minlim -5000
setp hm2_5i25.0.7i77.0.1.analogout1-scalemax 5000
##################enable m3 and m4#####################3
net spindle_on_for motion.spindle-forward = spindle.0.spindle-on-for
net spindle_on_rev motion.spindle-reverse = spindle.0.spindle-on-rev
net spl_run spindle.0.spl-run = pid.1.enable
net mot_spl_on motion.spindle-on = spindle.0.mot-spl-on
# Set up spindle speed
net spindle_rpm_cmd motion.spindle-speed-out => hm2_5i25.0.7i77.0.1.analogout1
# Attach the encoder to the motion and the scale
net spindle_rev_count motion.spindle-revs = hm2_5i25.0.encoder.01.position
net spindle_index_enable motion.spindle-index-enable = hm2_5i25.0.encoder.01.index-enable
net encoder_velocity motion.spindle-speed-in = hm2_5i25.0.encoder.01.velocity
##timer 2 for spindle wind down##
setp timedelay.2.on-delay 5
setp timedelay.2.off-delay 5 ## 3 second delay
net timer2_run spindle.0.timer2-run = timedelay.2.in
net timer2_off timedelay.2.out = spindle.0.timer2-off
net cl_spnl_perm spindle.0.cl-spnl-perm = hm2_5i25.0.7i77.0.0.output-11 #SPINDLE ENABLE RELAY 6
Then this in your ini
##spindle
[SPINDLE_1]
MAX_VELOCITY = .5
MAX_ACCELERATION = 20.0
BACKLASH = 0.000
INPUT_SCALE = 4096
OUTPUT_SCALE = 1.
OUTPUT_OFFSET = 0.0
MAX_OUTPUT = 1.0
# PID tuning params
DEADBAND = 0
P = 0
I = 0
D = 0
FF0 = 0
FF1 = 0
FF2 = 0
BIAS = 0
Then copy this to the modules directory with all the other components and compile using sudo comp. Make sure you add the timedelay component in your hal file and load the the now complied spindle comp.
Should work right off the bat....
The following user(s) said Thank You: DaOne
Please Log in or Create an account to join the conversation.
14 Sep 2013 01:06 #38780
by DaOne
Replied by DaOne on topic +-10 volt spindle?
This is great stuff JR1050. Question how do I install your comp file?
For the timer I just add this to the hal file right?
addf timedelay
loadrt timedelay
For the timer I just add this to the hal file right?
addf timedelay
loadrt timedelay
Please Log in or Create an account to join the conversation.
14 Sep 2013 02:28 #38782
by DaOne
Replied by DaOne on topic +-10 volt spindle?
Ok I think I figured out how to install the spindle.comp file. I hope I did it right...
Typed in...Got...
Now when I load it all up I am getting this error...
I apologize if my questions are stupid. This is very difficult for me to understand.
Typed in...
sudo comp --install spindle.comp
make KBUILD_EXTRA_SYMBOLS=/usr/realtime-2.6.32-122-rtai/modules/linuxcnc/Module.symvers -C /usr/src/linux-headers-2.6.32-122-rtai SUBDIRS=`pwd` CC=gcc V=0 modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-122-rtai'
CC [M] /tmp/tmpIhK_cC/spindle.o
Building modules, stage 2.
MODPOST 1 modules
CC /tmp/tmpIhK_cC/spindle.mod.o
LD [M] /tmp/tmpIhK_cC/spindle.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-122-rtai'
cp spindle.ko /usr/realtime-2.6.32-122-rtai/modules/linuxcnc/
cnc@cnc-desktop:~/linuxcnc-dev$
Now when I load it all up I am getting this error...
my_LinuxCNC_machine-7i77-in_lathe.hal:248: Pin 'spindle.0.spindle-on-for' does not exist
I apologize if my questions are stupid. This is very difficult for me to understand.
Please Log in or Create an account to join the conversation.
14 Sep 2013 02:35 #38783
by andypugh
It is a steep learning curve where you are, and JR's new bit of HAL code was a bit complicated.
I think he forgot to mention that your HAL file needs
Replied by andypugh on topic +-10 volt spindle?
You have to know what you are looking for, but that last line "cp…." means that it is copying the new file to the install directory and is a (too subtle) indication of success.
cp spindle.ko /usr/realtime-2.6.32-122-rtai/modules/linuxcnc/ cnc@cnc-desktop:~/linuxcnc-dev$
Now when I load it all up I am getting this error...
I apologize if my questions are stupid. This is very difficult for me to understand.my_LinuxCNC_machine-7i77-in_lathe.hal:248: Pin 'spindle.0.spindle-on-for' does not exist
It is a steep learning curve where you are, and JR's new bit of HAL code was a bit complicated.
I think he forgot to mention that your HAL file needs
loadrt spindle count=1
addf spindle.0 servo-thread
The following user(s) said Thank You: DaOne
Please Log in or Create an account to join the conversation.
14 Sep 2013 02:41 #38784
by DaOne
Replied by DaOne on topic +-10 volt spindle?
I think I may have got it except for loading the timer. Not sure what needs to be there? Can you maybe help me through that one too Andy?
I really appreciate this guys. Huge help!
![:) :)](/media/kunena/emoticons/smile.png)
Please Log in or Create an account to join the conversation.
14 Sep 2013 02:46 #38785
by DaOne
Replied by DaOne on topic +-10 volt spindle?
Based off this...
linuxcnc.org/docs/html/man/man9/timedelay.9.html
My guess is this?
loadrt timedelay count=1
linuxcnc.org/docs/html/man/man9/timedelay.9.html
My guess is this?
loadrt timedelay count=1
Please Log in or Create an account to join the conversation.
14 Sep 2013 02:49 #38786
by andypugh
I think you also need
But I am not sure if timedelay has a function-per instance or a shared one. So let us take it as a worked example.
The HAL components are all listed near the bottom of here:
www.linuxcnc.org/docs/html/
And timedelay is here:
www.linuxcnc.org/docs/html/man/man9/timedelay.9.html
Under "FUNCTIONS" it says: "timedelay.N (requires a floating-point thread)" which means that we need an addf for every individual timedelay (timedelay.0, timedelay.1 and so on, though we only have one here) and that it has to be in a thread that can handle more complex maths ("Floating point" means numbers where the decimal point can be anywhere, like 3.14159.) The base thread can only handle integers. (and then only up to about 4294967296 )
So, I was right, addf timedelay.0 servo-thread it is.
Replied by andypugh on topic +-10 volt spindle?
I think I may have got it except for loading the timer. Not sure what needs to be there? Can you maybe help me through that one too Andy?
I really appreciate this guys. Huge help!
I think you also need
loadrt timedelay count=1
addf timedelay.0 servo-thread
But I am not sure if timedelay has a function-per instance or a shared one. So let us take it as a worked example.
The HAL components are all listed near the bottom of here:
www.linuxcnc.org/docs/html/
And timedelay is here:
www.linuxcnc.org/docs/html/man/man9/timedelay.9.html
Under "FUNCTIONS" it says: "timedelay.N (requires a floating-point thread)" which means that we need an addf for every individual timedelay (timedelay.0, timedelay.1 and so on, though we only have one here) and that it has to be in a thread that can handle more complex maths ("Floating point" means numbers where the decimal point can be anywhere, like 3.14159.) The base thread can only handle integers. (and then only up to about 4294967296 )
So, I was right, addf timedelay.0 servo-thread it is.
Please Log in or Create an account to join the conversation.
14 Sep 2013 03:01 #38787
by DaOne
Replied by DaOne on topic +-10 volt spindle?
Andy that did not work. I get this error...
So I take it this means one needs to be created for bother the on delay and the off delay? Can you please show me what it should look like if that is so?
my_LinuxCNC_machine-7i77-in_lathe.hal:273: parameter or pin 'timedelay.2.on-delay' not found
So I take it this means one needs to be created for bother the on delay and the off delay? Can you please show me what it should look like if that is so?
Please Log in or Create an account to join the conversation.
Time to create page: 0.088 seconds