[Emc-users] Analog spindle control HM2

2010-03-05 Thread Lars Levin

Hello group!

I have set up a retrofit 3 axis milling machine with mesa 5i20+7i33+2x7i37
The 3 axes are configured, tuned and works great.
Now I want to use the fourth channel on the 7i33 to drive my freq inv. spindle
I need a spindle enable signal and a 0-10v signal.
In the wiki I found Analog spindle speed control using Mesa 5i20, but this is 
old stuff
not using HM2 driver, and it looks like this:

# Set up spindle speed
net SpindleOn motion.spindle-on
net spindle-rpm-cmd motion.spindle-speed-out
setp m5i20.0.dac-03-gain [SPINDLE]DAC_SCALE
linksp SpindleOn = m5i20.0.dac-03-enable
linksp spindle-rpm-cmd = m5i20.0.dac-03-value
setp m5i20.0.dac-03-offset 80

Can somebody help me to put together the right hal code to work with HM2?
I have searched the wiki and forums, but cant find it anywhere.

Best Regards!
Lars Levin

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Analog spindle control HM2

2010-03-05 Thread robert
On 05/03/2010 19:08, Lars Levin wrote:
 # Set up spindle speed
 net SpindleOn motion.spindle-on
 net spindle-rpm-cmd motion.spindle-speed-out
 setp m5i20.0.dac-03-gain [SPINDLE]DAC_SCALE
 linksp SpindleOn =  m5i20.0.dac-03-enable
 linksp spindle-rpm-cmd =  m5i20.0.dac-03-value
 setp m5i20.0.dac-03-offset 80

 Can somebody help me to put together the right hal code to work with HM2?
 I have searched the wiki and forums, but cant find it anywhere.

 Best Regards!
 Lars Levin


you will need to run the spindle command out through an ABS to make it 
always be a posative value (emc outputs a - speed value for m03)

then you will have a 0-10v signal for the dac out
u may have to reverse the output on the card chanel if its 0- -10v

here is my code for my spindle
#invert voltage out
setp hm2_[HOSTMOT2](BOARD).0.gpio.XXX.invert_output true
setp hm2_[HOSTMOT2](BOARD).0.pwmgen.XX.output-type 3

#make spindle pos
loadrt abs count=0
#scale spindle speed to volts
loadrt scale count=0

addf abs.0 servo-thread
addf scale.0 servo-thread

#spindle speed gain
#hm2 1=10v out
#pwm/speed=1/6000rpm=0.0001667
#6k
setp scale.0.gain 0.00017

net spindle-abs abs.0.in = motion.spindle-speed-out
net spindle-abs-out abs.0.out = scale.0.in
net spindle-out scale.0.out = hm2_[HOSTMOT2](BOARD).0.pwmgen.03.value


then just link spindle forward, spindle reverse to the IOs you need.
this should work i just typed it up quickly for you.

rob

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Analog spindle control HM2

2010-03-05 Thread Sebastian Kuzminsky
robert wrote:
 here is my code for my spindle
 #invert voltage out
 setp hm2_[HOSTMOT2](BOARD).0.gpio.XXX.invert_output true
 setp hm2_[HOSTMOT2](BOARD).0.pwmgen.XX.output-type 3

 #make spindle pos
 loadrt abs count=0
 #scale spindle speed to volts
 loadrt scale count=0

 addf abs.0 servo-thread
 addf scale.0 servo-thread

 #spindle speed gain
 #hm2 1=10v out
 #pwm/speed=1/6000rpm=0.0001667
 #6k
 setp scale.0.gain 0.00017

 net spindle-abs abs.0.in = motion.spindle-speed-out
 net spindle-abs-out abs.0.out = scale.0.in
 net spindle-out scale.0.out = hm2_[HOSTMOT2](BOARD).0.pwmgen.03.value
   

The hm2 pwmgen has its own .scale parameter, so you could get rid of the 
stand-alone scale component and just apply the scale.gain to hm2's 
pwmgen.scale.

http://linuxcnc.org/docs/devel/html/drivers_hostmot2.html#r1_14_2


-- 
Sebastian Kuzminsky


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users