# Jog Pendant # load the hostmot2 driver, this doesnt do anything by itself, # it just waits for low-level drivers to register boards loadrt hostmot2 debug_idrom=1 debug_module_descriptors=1 debug_pin_descriptors=1 debug_modules=1 # load the low-level driver for the board # this will load the board's firmware and register it with the hostmot2 # driver loaded above, and it'll show up in HAL loadrt hm2_pci config="firmware=hm2/5i20/SVST2_4_7I47.BIT num_encoders=1 num_pwmgens=0 num_stepgens=0" # set up the watchdog #setp hm2_5i20.0.watchdog.timeout_ns 10000000 loadusr -Wn naiky pyvcp -c naiky naiky.xml # create realtime thread loadrt threads name1=base-thread period1=50000 name2=servo-thread period2=1000000 loadrt encoder num_chan=1 # "times 4 mode" one count per full quadrature cycle, instead of the usual one count per edge. # mpg jog wheels often have a full quadrature cycle per "click". 0 for off and 1 for on. setp encoder.0.x4-mode FALSE #net X1 hm2_5i20.0.gpio.000.in_not naiky.x1 #net X10 hm2_5i20.0.gpio.002.in_not naiky.x10 #net X100 hm2_5i20.0.gpio.004.in_not naiky.x100 #net SEL-X hm2_5i20.0.gpio.006.in_not naiky.x #net SEL-Y hm2_5i20.0.gpio.008.in_not naiky.y #net SEL-Z hm2_5i20.0.gpio.010.in_not naiky.z #net SEL-4 hm2_5i20.0.gpio.012.in_not naiky.4 #net SEL-OFF hm2_5i20.0.gpio.014.in_not naiky.off #setp hm2_5i20.0.gpio.016.is_output TRUE #setp hm2_5i20.0.gpio.016.invert_output TRUE #net LED hm2_5i20.0.gpio.016.out naiky.led #net MPG-A encoder.0.phase-A hm2_5i20.0.gpio.003.in_not naiky.a #net MPG-B encoder.0.phase-B hm2_5i20.0.gpio.001.in_not naiky.b #net X1 hm2_5i20.0.gpio.024.in_not naiky.x1 #net X10 hm2_5i20.0.gpio.026.in_not naiky.x10 #net X100 hm2_5i20.0.gpio.028.in_not naiky.x100 #net SEL-X hm2_5i20.0.gpio.030.in_not naiky.x #net SEL-Y hm2_5i20.0.gpio.032.in_not naiky.y #net SEL-Z hm2_5i20.0.gpio.034.in_not naiky.z #net SEL-4 hm2_5i20.0.gpio.036.in_not naiky.4 #net SEL-OFF hm2_5i20.0.gpio.038.in_not naiky.off #setp hm2_5i20.0.gpio.040.is_output TRUE #setp hm2_5i20.0.gpio.040.invert_output TRUE #net LED hm2_5i20.0.gpio.040.out naiky.led #net MPG-A encoder.0.phase-A hm2_5i20.0.gpio.027.in_not naiky.a #net MPG-B encoder.0.phase-B hm2_5i20.0.gpio.025.in_not naiky.b net X1 hm2_5i20.0.gpio.048.in_not naiky.x1 net X10 hm2_5i20.0.gpio.050.in_not naiky.x10 net X100 hm2_5i20.0.gpio.052.in_not naiky.x100 net SEL-X hm2_5i20.0.gpio.054.in_not naiky.x net SEL-Y hm2_5i20.0.gpio.056.in_not naiky.y net SEL-Z hm2_5i20.0.gpio.058.in_not naiky.z net SEL-4 hm2_5i20.0.gpio.060.in_not naiky.4 net SEL-OFF hm2_5i20.0.gpio.062.in_not naiky.off setp hm2_5i20.0.gpio.064.is_output TRUE setp hm2_5i20.0.gpio.064.invert_output TRUE net LED hm2_5i20.0.gpio.064.out naiky.led net MPG-A encoder.0.phase-A hm2_5i20.0.gpio.051.in_not naiky.a net MPG-B encoder.0.phase-B hm2_5i20.0.gpio.049.in_not naiky.b net COUNT encoder.0.position naiky.count net RESET encoder.0.reset naiky.reset # hook the functions to threads # read inputs addf hm2_5i20.0.read base-thread addf encoder.update-counters base-thread addf encoder.capture-position servo-thread # write outputs addf hm2_5i20.0.write servo-thread # pet the watchdog so he won't bite us! addf hm2_5i20.0.pet_watchdog servo-thread start show pin waitusr naiky