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.000166667

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
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to