Variable pitch belt driven spindle

More
6 years 6 months ago #163675 by cmorley
make sure the file is executable too

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

More
6 years 6 months ago #163677 by fungus
I added
Code:
halcmd show pin halcmd show sig
into the M1xx, but I saw no print of the pins or signals in terminal.

It's definitely executable, and within the search path (it will error out if not executable, and I have it in the NC file folder).

I do have a "Run" LED on the front panel I made, which blinks while in automatic mode. It cycles once when I issue the "M1xx Px" command, so it's acting like it's just shooting through without hitting any loops. I'm going to try some echos.

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

More
6 years 6 months ago - 6 years 6 months ago #163681 by cmorley
I would put the commands close to the top so you know it called. If you don't see the pins then it's not getting to the command.

I suppose you could use an echo statement too (Bash is not my strong suit)
Anyways the idea of course is to show the flow of the script.

Chris
Last edit: 6 years 6 months ago by cmorley.

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

More
6 years 6 months ago #163683 by fungus
Hmm. I just purposely removed the net assignment lines from the main HAL file, which should have caused errors. No errors occurred. Something fishy is going on... It's like the file isn't even running.

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

More
6 years 6 months ago #163685 by fungus
Yeah, I tried it several places within the script. Nada. I couldn't figure out if I was doing echoes correctly, probably due to the fact that it's not getting executed. I'm a bit baffled by this.

Here's the latest:
M101 (using direct pin assignments)
Code:
#!/bin/sh halcmd show pin #example usage: M101 P1 (changes variable pitch belt to ratio A) #uses argument P #parport.0.pin-11-in-not is input for range A #parport.0.pin-12-in-not is input for range B #parport.0.pin-13-in-not is input for range C #parport.0.pin-2-out is the valve to make RPM lower #parport.0.pin-5-out is the valve to make RPM higher range_request = $1 case $range_request in #change to ratio 1 #while the input for ratio 1 is not true, move RPM down until the input is true 1) while ! [halcmd getp parport.0.pin-11-in-not]; do if [halcmd getp parport.0.pin-13-in-not] || [halcmd getp parport.0.pin-12-in-not] then #start the spindle, unscaled vfd.speed-command 60 halcmd setp parport.0.pin-2-out True fi done #once complete, stop the spindle and set both airmotor valves to off vfd.speed-command 0.0 halcmd setp parport.0.pin-2-out False halcmd setp parport.0.pin-5-out False #set the correct gain for this range setp scale.0.gain 0.33 ;; #change to ratio 2 2) while ! [halcmd getp parport.0.pin-12-in-not]; do if [halcmd getp parport.0.pin-13-in-not] then vfd.speed-command 60 halcmd setp parport.0.pin-2-out True elif [halcmd getp parport.0.pin-11-in-not] then vfd.speed-command 60 halcmd setp parport.0.pin-5-out True fi done vfd.speed-command 0.0 halcmd setp parport.0.pin-2-out False halcmd setp parport.0.pin-5-out False setp scale.0.gain 0.66 ;; 3) while ! [halcmd getp parport.0.pin-13-in-not]; do if [halcmd getp parport.0.pin-11-in-not] || [halcmd getp parport.0.pin-12-in-not] then vfd.speed-command 60 halcmd setp parport.0.pin-5-out True fi done vfd.speed-command 0.0 halcmd setp parport.0.pin-2-out False halcmd setp parport.0.pin-5-out False setp scale.0.gain 0.99 ;; *) halcmd setp parport.0.pin-2-out False halcmd setp parport.0.pin-5-out False ;; esac exit 0

M102 (using nets):
Code:
#!/bin/sh halcmd show pin #example usage: M102 P1 (changes variable pitch belt to ratio A) #uses argument P #spin_rnge_a is net for range A #spin_rnge_b is net for range B #spin_rnge_c is net for range C #rpm_dn is the valve to make RPM lower #rpm_up is the valve to make RPM higher range_request = $1 case $range_request in #change to ratio 1 #while the input for ratio 1 is not true, move RPM down until the input is true 1) while ! [gets spin_rnge_a]; do if [gets spin_rnge_c] || [gets spin_rnge_b] then #start the spindle, unscaled vfd.speed-command 60 sets rpm_dn True halcmd show pin fi done #once complete, stop the spindle and set both airmotor valves to off vfd.speed-command 0.0 sets rpm_dn False sets rpm_up False #set the correct gain for this range setp scale.0.gain 0.33 ;; #change to ratio 2 2) while ! [gets spin_rnge_b]; do if [gets spin_rnge_a] then vfd.speed-command 60 sets rpm_up True elif [gets spin_rnge_c] then vfd.speed-command 60 sets rpm_dn True fi done vfd.speed-command 0.0 sets rpm_dn False sets rpm_up False setp scale.0.gain 0.66 ;; 3) while ! [gets spin_rnge_c]; do if [gets spin_rnge_a] || [gets spin_rnge_b] then vfd.speed-command 60 sets rpm_up True fi done vfd.speed-command 0.0 sets rpm_dn False sets rpm_up False setp scale.0.gain 0.99 ;; *) sets rpm_dn False sets rpm_up False ;; esac exit 0

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

More
6 years 6 months ago #163691 by fungus
Just tried one of the simple examples:
Code:
#!/bin/bash eog /home/myname/linuxcnc/nc_files/message.png exit 0

No dice. No errors. The path above is the one referenced in my INI. What the heck?

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

Time to create page: 0.146 seconds
Powered by Kunena Forum