OK! I have most of my test panel working. I decided to use the jog buttons on the panel anyway since I already had it wired. I had to figure out how to use or2. The exercise was good for my understanding of HAL.
Im starting to see how things fit. I had to separate the code for my tiny brain to handle.
I do have a issue now that Im not sure where to look to fix it. Below is the section of my HAL with overrides. Im using a cheap Chinese VFD with their MODBUS. The spindle override is where Im having issues.
At 5% override I am at 30 hz on my spindle, the lowest allowed setting in my parameters in the VFD.
at 19% override I am at 65 hz the highest setting allowed by my parameters in the VFD.
The scale of my override in halui continues from 19% to 100% with the pot adjustment as expected, however this has no effect otherwise. I have tried to change scale and other factors and still nothing has changed this behavior.
csbrady was kind enough to give me his hal which this is part of. He is using analog voltage to his VFD for control. I do not know if this matters. My spindle scale is up to 100% max in the INI.
Any ideas?
Code:
###################################################################
# "Overrides" #
###################################################################
# "Read analog inputs from the override knobs. Full scale will be"#
# "approximately 24v. Scale the input accordingly. 1.0 = 100%" #
# #
# "Scale up the raw values 100x so that when converted to" #
# "integers we have good resolution." #
# "The results will be between 0 and 2400." #
###################################################################
################"--- Feed Override ---"##################
# Convert from float to S32 #
#########################################################
# "Read in analog input and send to halui.feed-override"
# "Enable direct count input"
net scale_ovr => scale-fo.gain scale-ro.gain scale-so.gain
sets scale_ovr 100.0
#600
net fo-ena halui.feed-override.count-enable halui.feed-override.direct-value
sets fo-ena 1
# "Scale down the value to a percentage"
net scf-scale => halui.feed-override.scale
sets scf-scale 0.000852
net scf-raw scale-fo.in <= hm2_5i25.0.7i77.0.0.analogin0
net scf-raw-adj cnvf.in <= scale-fo.out
net scf-s halui.feed-override.counts <= cnvf.out
################"--- Rapid Override ---"#################
# Convert from float to S32 #
#########################################################
# "Read in analog input and send to halui.rapid-override"
# "Enable direct count input"
net ro-ena halui.rapid-override.count-enable halui.rapid-override.direct-value
sets ro-ena 1
# "Scale down the value to a percentage"
net scr-scale => halui.rapid-override.scale
sets scr-scale 0.00044
net scr-raw scale-ro.in <= hm2_5i25.0.7i77.0.0.analogin1
net scr-raw-adj cnvr.in <= scale-ro.out
net scr-s halui.rapid-override.counts <= cnvr.out
###############"--- Spindle Override ---"################
# Convert from float to S32 #
#########################################################
# "Read in analog input and send to halui.spindle-override"
# "Enable direct count input"
net so-ena halui.spindle-override.count-enable halui.spindle-override.direct-value
sets so-ena 1
# "Scale down the value to a percentage"
net scs-scale => halui.spindle-override.scale
sets scs-scale 0.0004
#0.0005
# "Add an offest so that we have a minimum override of 30%"
net scs-offset => scale-so.offset
sets scs-offset 100
net scs-raw scale-so.in <= hm2_5i25.0.7i77.0.0.analogin2
net scs-raw-adj cnvs.in <= scale-so.out
net scs-s halui.spindle-override.counts <= cnvs.out
EDIT: Figured it out. My spindle is being commanded to go to 10K rpms. Looks like I have some reading to do.