help understanding the difference ...
With a goal of making a config with zero extraneous lines of config and/or redundant hal connections I'm trying to understand my pncconf file output and I thought by comparing to a one of the demo configs I might learn something but as it turns out there are differences that are making it confusing...
- The demo config is called 5i22big and is under the Mesa servo tab
- My config was 5 axes XYZA and a servo spindle and what I hoped would be nothing else (to keep things simple)
... but coolant, limits, estop and toolchanger stuff has turned up as has other bits I dont understand yet
Many questions but I'll be methodical and chip away at them one by one - I'll paste one axis of info from each config where I have put the similar stuff I understand at the top of each and the stuff I dont get at the bottom
Firstly from pncconf (you can tell from the alias function replacing the '0' with 'x'):
#*******************
# AXIS X
#*******************
setp pid.x.Pgain [AXIS_0]P
setp pid.x.Igain [AXIS_0]I
setp pid.x.Dgain [AXIS_0]D
setp pid.x.bias [AXIS_0]BIAS
setp pid.x.FF0 [AXIS_0]FF0
setp pid.x.FF1 [AXIS_0]FF1
setp pid.x.FF2 [AXIS_0]FF2
setp pid.x.deadband [AXIS_0]DEADBAND
setp pid.x.maxoutput [AXIS_0]MAX_OUTPUT
setp hm2_5i22.0.pwmgen.01.output-type 1
setp hm2_5i22.0.pwmgen.01.scale [AXIS_0]OUTPUT_SCALE
setp hm2_5i22.0.encoder.01.counter-mode 0
setp hm2_5i22.0.encoder.01.filter 1
setp hm2_5i22.0.encoder.01.index-invert 0
setp hm2_5i22.0.encoder.01.index-mask 0
setp hm2_5i22.0.encoder.01.index-mask-invert 0
setp hm2_5i22.0.encoder.01.scale [AXIS_0]ENCODER_SCALE
net x-index-enable <=> pid.x.index-enable
net xenable => pid.x.enable
net xoutput pid.x.output => hm2_5i22.0.pwmgen.01.value
net xpos-cmd axis.0.motor-pos-cmd => pid.x.command
net xenable axis.0.amp-enable-out => hm2_5i22.0.pwmgen.01.enable
net xpos-fb <= hm2_5i22.0.encoder.01.position
net xpos-fb => pid.x.feedback
net xpos-fb => axis.0.motor-pos-fb
net x-index-enable axis.0.index-enable <=> hm2_5i22.0.encoder.01.index-enable
# ---setup home / limit switch signals---
net x-home-sw => axis.0.home-sw-in
net x-neg-limit => axis.0.neg-lim-sw-in
net x-pos-limit => axis.0.pos-lim-sw-in
Then from the demo config:
# ################
# X [0] Axis
# ################
setp pid.0.Pgain [AXIS_0]P
setp pid.0.Igain [AXIS_0]I
setp pid.0.Dgain [AXIS_0]D
setp pid.0.bias [AXIS_0]BIAS
setp pid.0.FF0 [AXIS_0]FF0
setp pid.0.FF1 [AXIS_0]FF1
setp pid.0.FF2 [AXIS_0]FF2
setp pid.0.deadband [AXIS_0]DEADBAND
setp pid.0.maxoutput [AXIS_0]MAX_OUTPUT
setp hm2_[HOSTMOT2](BOARD).0.pwmgen.00.output-type 1 #pwm on pin1, dir on pin2
setp hm2_[HOSTMOT2](BOARD).0.pwmgen.00.scale [AXIS_0]OUTPUT_SCALE
setp hm2_[HOSTMOT2](BOARD).0.encoder.00.counter-mode 0
setp hm2_[HOSTMOT2](BOARD).0.encoder.00.filter 1
setp hm2_[HOSTMOT2](BOARD).0.encoder.00.index-invert 0
setp hm2_[HOSTMOT2](BOARD).0.encoder.00.index-mask 0
setp hm2_[HOSTMOT2](BOARD).0.encoder.00.index-mask-invert 0
setp hm2_[HOSTMOT2](BOARD).0.encoder.00.scale [AXIS_0]INPUT_SCALE
# axis enable chain
newsig emcmot.00.enable bit
sets emcmot.00.enable FALSE
net emcmot.00.enable => pid.0.enable
net emcmot.00.enable => hm2_[HOSTMOT2](BOARD).0.pwmgen.00.enable
net emcmot.00.enable <= axis.0.amp-enable-out
net motor.00.pos-fb hm2_[HOSTMOT2](BOARD).0.encoder.00.position => pid.0.feedback
net motor.00.pos-fb => axis.0.motor-pos-fb #push copy back to Axis GUI
net emcmot.00.pos-cmd axis.0.motor-pos-cmd => pid.0.command
net motor.00.command pid.0.output => hm2_[HOSTMOT2](BOARD).0.pwmgen.00.value
Lots of it is the same - but from the encoder scale down the code unique - Is it doing the same thing ? something different ??
Also one refers to encoder.00 and the other encoder.01 - egad (?)
The links to the .ini files are working - and attached is the .ini from the pncconf file in case its helpful ...
Trying to nail this down ...
Any help appreciated
Please Log in or Create an account to join the conversation.
Similarly, pncconf uses "alias" extensively to make it easier for the code to create4 a HAL file.
The tersest HAL file will contain only "net", "setp", "loadrt" and "addf" functions.
net allows you to create a signal, and link it to an output pin and to many input pins, all on one line. As an example
net enable axis.0.amp-enable-out => parport.0.pin-01-out parport.0.pin-01-out parport.0.pin-02-out parport.0.pin-03-out
However, terse is not necessarily good. it often makes sense to write the HAL file in blocks, for example defining the hardware IO pins by function all together in one block by assigning them to signal names, then using those signal names in the axis definition blocks.
Please Log in or Create an account to join the conversation.
John
Please Log in or Create an account to join the conversation.
I'm using 2.5 - maybe thats it
Yes, you're right about making code clear Andy - that was the intention, I was more concerned about the extra hal lines turning up from pncconf and also just making sure for the future when I write some lines of my own I dont fluff it up.
Old code huh ? Oh dear, not much use then right ?
Anyway - at the moment pretty much from "setp hm2_5i22.0.encoder.01.filter 1" down I'm swimming - anyone care to comment it a little ?
Also I dont recall seeing "<=>" in the hal tutorial - it means they mirror each other ?
Please Log in or Create an account to join the conversation.
Also I dont recall seeing "<=>" in the hal tutorial - it means they mirror each other ?
That one is in the manual
![:) :)](/media/kunena/emoticons/smile.png)
www.linuxcnc.org/docview/html/hal_basic_hal.html
John
Please Log in or Create an account to join the conversation.
"<=>" doesn't get any hits on a string search on the manuals I have
That basic HAL page is new to me also - so many different places to get all the info...
so for example:
net x-index-enable <=> pid.x.index-enable
net x-index-enable axis.0.index-enable <=> hm2_5i22.0.encoder.01.index-enable
a signal called x-index-enable has been made - but the inequalities on both sides mean ??
that signal is then wha ???
![:blink: :blink:](/media/kunena/emoticons/blink.png)
Please Log in or Create an account to join the conversation.
net xenable => pid.x.enable
net xenable axis.0.amp-enable-out => hm2_5i22.0.pwmgen.01.enable
(second line should be first or?)
Just some plain english on what is happening here and I might crack the conceptual block
really looking forward to understanding this stuff
![:) :)](/media/kunena/emoticons/smile.png)
Please Log in or Create an account to join the conversation.
John
Please Log in or Create an account to join the conversation.
…Absolutely nothing.a signal called x-index-enable has been made - but the inequalities on both sides mean...
The arrows are just for humans to show us which direction the information is flowing. And if you get the arrow the wrong way round, then the numbers still flows the same way.
The signal name is something you can choose yourself. Think of it as a wire, and the name is the colour. In just the same way as you can use red for 0V if you choose, the name has no significance, it is what you do with it that matters.
Anywhere in the HAL file you can use that same signal, and it will have the same value.
The value it has is set by the output pin that you connect it to. You can only connect it to one output pin, in much the same way as connecting the red wire above to 5V would let you take 5V anywhere in your machine you can connect to many input pins. However, you can only connect to 1 output pin, in much the same way as connecting our 5V wire to the 12v line would be very bad.
It doesn't matter which order you make the connections in, nothing gets "switched on" until the HAL files are fully loaded.
Please Log in or Create an account to join the conversation.
I see:
The irony"The direction indicators "<= and =>" are only to make it easier for humans to follow the logic and are not used by the net command."
![:dry: :dry:](/media/kunena/emoticons/ermm.png)
So as I'm meant to understand the '<' are technically meaningless and the code will have the same functionality whatever way you put them ...
In that case I don't understand why someone would use two, my head is wired differently I guess - sucks to be me !
...or for that matter put code in an order that appears to be carts before horses - I understand the code when its sent to the Mesa card will make sense to the blips, bleeps and zeros and ones but for a beginner trying to follow the train of logic of a config it is really confusing
![:silly: :silly:](/media/kunena/emoticons/silly.png)
Please Log in or Create an account to join the conversation.