M101

More
15 Jul 2024 17:16 #305248 by tomala89
M101 was created by tomala89
Hey, I wanted to turn on the relay on pin 14 of m101, but unfortunately the command does not work.
M101
#!/bin/bash

halcmd sets parport.0.pin-14-out True

sleep 1

exit 0
Hal file

# Generated by stepconf 1.1 at Mon Jul 15 08:51:45 2024
# Jeśli zmodyfikujesz ten plik zmainy zostaną
# nadpisane gdy uruchomisz ponownie Stepconf
loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadrt hal_parport cfg="0 out"
setp parport.0.reset-time 5000
loadrt stepgen step_type=0,0,0
loadrt pwmgen output_type=1

addf parport.0.read base-thread
addf stepgen.make-pulses base-thread
addf pwmgen.make-pulses base-thread
addf parport.0.write base-thread
addf parport.0.reset base-thread

addf stepgen.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf stepgen.update-freq servo-thread
addf pwmgen.update servo-thread

net spindle-cmd-rpm => pwmgen.0.value
net spindle-on <= spindle.0.on => pwmgen.0.enable
net spindle-pwm <= pwmgen.0.pwm
setp pwmgen.0.pwm-freq 0.0
setp pwmgen.0.scale 91269.8412698
setp pwmgen.0.offset -0.0109565217391
setp pwmgen.0.dither-pwm true
net spindle-cmd-rpm     <= spindle.0.speed-out
net spindle-cmd-rpm-abs <= spindle.0.speed-out-abs
net spindle-cmd-rps     <= spindle.0.speed-out-rps
net spindle-cmd-rps-abs <= spindle.0.speed-out-rps-abs
net spindle-at-speed    => spindle.0.at-speed
net coolant-mist <= iocontrol.0.coolant-mist

net probe-in => motion.probe-input

net coolant-mist    => parport.0.pin-01-out
net xstep           => parport.0.pin-02-out
setp parport.0.pin-02-out-reset 1
net xdir            => parport.0.pin-03-out
net ystep           => parport.0.pin-04-out
setp parport.0.pin-04-out-reset 1
net ydir            => parport.0.pin-05-out
net zstep           => parport.0.pin-06-out
setp parport.0.pin-06-out-reset 1
setp parport.0.pin-07-out-invert 1
net zdir            => parport.0.pin-07-out
net spindle-on      => parport.0.pin-14-out
net spindle-pwm     => parport.0.pin-16-out
net xenable         => parport.0.pin-17-out
net estop-ext       <= parport.0.pin-10-in
net home-x          <= parport.0.pin-11-in
net home-y          <= parport.0.pin-12-in
net home-z          <= parport.0.pin-13-in-not
net probe-in        <= parport.0.pin-15-in-not

setp stepgen.0.position-scale [JOINT_0]SCALE
setp stepgen.0.steplen 1
setp stepgen.0.stepspace 0
setp stepgen.0.dirhold 23000
setp stepgen.0.dirsetup 23000
setp stepgen.0.maxaccel [JOINT_0]STEPGEN_MAXACCEL
net xpos-cmd joint.0.motor-pos-cmd => stepgen.0.position-cmd
net xpos-fb stepgen.0.position-fb => joint.0.motor-pos-fb
net xstep <= stepgen.0.step
net xdir <= stepgen.0.dir
net xenable joint.0.amp-enable-out => stepgen.0.enable
net home-x => joint.0.home-sw-in

setp stepgen.1.position-scale [JOINT_1]SCALE
setp stepgen.1.steplen 1
setp stepgen.1.stepspace 0
setp stepgen.1.dirhold 23000
setp stepgen.1.dirsetup 23000
setp stepgen.1.maxaccel [JOINT_1]STEPGEN_MAXACCEL
net ypos-cmd joint.1.motor-pos-cmd => stepgen.1.position-cmd
net ypos-fb stepgen.1.position-fb => joint.1.motor-pos-fb
net ystep <= stepgen.1.step
net ydir <= stepgen.1.dir
net yenable joint.1.amp-enable-out => stepgen.1.enable
net home-y => joint.1.home-sw-in

setp stepgen.2.position-scale [JOINT_2]SCALE
setp stepgen.2.steplen 1
setp stepgen.2.stepspace 0
setp stepgen.2.dirhold 23000
setp stepgen.2.dirsetup 23000
setp stepgen.2.maxaccel [JOINT_2]STEPGEN_MAXACCEL
net zpos-cmd joint.2.motor-pos-cmd => stepgen.2.position-cmd
net zpos-fb stepgen.2.position-fb => joint.2.motor-pos-fb
net zstep <= stepgen.2.step
net zdir <= stepgen.2.dir
net zenable joint.2.amp-enable-out => stepgen.2.enable
net home-z => joint.2.home-sw-in

net estop-out <= iocontrol.0.user-enable-out
net estop-ext => iocontrol.0.emc-enable-in

loadusr -W hal_manualtoolchange
net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change
net tool-changed iocontrol.0.tool-changed <= hal_manualtoolchange.changed
net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared

I don't see any error in the notation.
 

Please Log in or Create an account to join the conversation.

More
15 Jul 2024 17:20 - 15 Jul 2024 17:24 #305249 by Aciera
Replied by Aciera on topic M101
Try setp instead of 'sets'

[edit]
Just noticed that the pin is assigned to a signal so see post below
Last edit: 15 Jul 2024 17:24 by Aciera.

Please Log in or Create an account to join the conversation.

More
15 Jul 2024 17:21 - 15 Jul 2024 17:25 #305250 by Aciera
Replied by Aciera on topic M101
Try:

halcmd sets spindle-on True
Last edit: 15 Jul 2024 17:25 by Aciera.

Please Log in or Create an account to join the conversation.

More
15 Jul 2024 17:47 #305254 by tomala89
Replied by tomala89 on topic M101
This may work, but I need to attach in

M101 relay from pin 14 / left rotation
M102 relay from pin 1 / right rotation

Please Log in or Create an account to join the conversation.

  • tommylight
  • tommylight's Avatar
  • Away
  • Moderator
  • Moderator
More
15 Jul 2024 17:54 #305256 by tommylight
Replied by tommylight on topic M101
Any reason for not using M62-M65 digital pins?
linuxcnc.org/docs/devel/html/gcode/m-code.html#mcode:m62-m65

Please Log in or Create an account to join the conversation.

Time to create page: 0.070 seconds
Powered by Kunena Forum