Ian, I guess this must be one of the first tests and like John says, not the ideal way of doing things.
I'm using a C11 board from CNC4PC and finnaly used a stepgen component to generate the pulses for the frequency to analog voltage converter. The basic changes to the hal file below. For this board in combination with the KBIC of sherline, this worked very good. The gain and offset are determined by testing to have the real spindle rpm as close as possible to the spindle speed as set in emc. I only have approx 3% difference. Geert # # 5th stepgen for controlling the spindle. Type must be set to velocity # loadrt stepgen step_type=0,0,0,0,0 ctrl_type=p,p,p,p,v # # Use a scale module for offset and scaling of the stepgen # Offset and scale are determined by first calculating and then just testing # setp scale.0.in 0 setp scale.0.gain 0.36 setp scale.0.offset 60.0 addf scale.0 servo-thread # # Initialise the stepgen for the spindle # setp stepgen.4.position-scale 1 setp stepgen.4.maxvel 1300 setp stepgen.4.steplen 1 setp stepgen.4.stepspace 0 setp stepgen.4.dirhold 20000 setp stepgen.4.dirsetup 20000 setp stepgen.4.maxaccel 200 # # Enable # net spindle-enable <= motion.spindle-on => stepgen.4.enable # # Connect spindle speed to scaler # net spindle-cmd motion.spindle-speed-out => scale.0.in # # Connect scaler output to stepgen velocity # net spindle-freq <= scale.0.out => stepgen.4.velocity-cmd # # Connect output to the pin for the analog voltage of cnc4pc board # net spindle-out <= stepgen.4.step => parport.0.pin-14-out # # Control of spindle on/off (I1/I2 of KBIC speed controller over the # relay instead of triac # net spindle-cw => parport.0.pin-16-out Ian W. Wright wrote: > After struggling unsuccessfully for a long time to try to find the > direct relevance between the HAL tutorial and driving my stepper spindle > ( I haven't yet given up on this as I get the impression that it may > give me a bit more speed ) , I came across a script that Geert had made > a year or so ago. With a little bit of tweaking this is now embedded in > a lathe HAL file and is driving the spindle motor. I must admit that I > can't understand just how this script works as it seems totally > different to the HAL tutorial and this is the reason that I still have a > couple of problems that I can't sort out. The HAL and INI files are here > - www.watchman.dsl.pipex.com/cnc/lathe.hal and > www.watchman.dsl.pipex.com/cnc/lathe.ini . > > The only way I found to get any speed out of the stepper with this > script was to tweak the BASE_PERIOD and SERVO_PERIOD in the ini file > until the computer began to complain - I think they may still need a > little adjustment as I occasionally still get a 'real time task delay' > error. Having done this, I can get the stepper to run up to 300 R.P.M - > not as fast as I would have liked but still fast enough for most of the > things I want to use it for at the moment. However, to get it to run at > this speed via G-code I need to tell it to M03 S60000 ! Try as I might I > can't see where I should apply a scaling factor to bring this down to a > realistic figure. Oh, and the link to John's description of how EMC2 > works 'under the bonnet' seems to be broken from the linuxcnc page. > > If anyone can offer any advice to get me a bit further on with this I > would be most grateful. > > I now need to try to learn about classic ladder to find a way to set or > alter the spindle direction......... > ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users