# loads all HAL modules for Universal PWM controller with threading # Modified and intended for use only with Kirk Wallace's HNC lathe - KW 20070823 # 20070831 KW - Added turret.comp # 20091213 KW - Removed s32equal.comp, no longer needed # kinematics loadrt trivkins # motion controller, get name and thread periods from ini file loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD traj_period_nsec=[EMCMOT]TRAJ_PERIOD key=[EMCMOT]SHMEM_KEY # next load the PID module, for four PID loops loadrt pid num_chan=4 # install Universal PWM Controller driver loadrt hal_ppmc extradac=0x00 # load realtime portion of scope, just to have it handy loadrt scope_rt # make some signals for the scope for tuning. loadrt ddt count=4 loadrt and2 count=1 # two nots for spindle high/low clutch plus one for tuning(?) loadrt not count=3 # one or2 for the spindle DAC enable loadrt or2 count=1 loadrt estop_latch count=1 loadrt hal_parport cfg="0xECF8" # decoder for turret tool position encoder loadrt weighted_sum wsum_sizes=4 # Turret position change handler loadrt turret # set up the realtime thread # read inputs first addf ppmc.0.read servo-thread addf parport.0.read servo-thread addf process_wsums servo-thread addf turret.0 servo-thread # then run the motion controller addf motion-command-handler servo-thread addf and2.0 servo-thread addf estop-latch.0 servo-thread addf motion-controller servo-thread addf or2.0 servo-thread addf not.0 servo-thread addf not.1 servo-thread addf not.2 servo-thread # then the PID loops addf pid.0.do-pid-calcs servo-thread addf pid.1.do-pid-calcs servo-thread addf pid.2.do-pid-calcs servo-thread addf pid.3.do-pid-calcs servo-thread # write outputs last addf ppmc.0.write servo-thread addf parport.0.write servo-thread