× Forum Header

Update ini and hal file

More
15 Jul 2019 17:59 #139480 by Dinuka_Shehan
How to add new codes to ini and hal files to my currunt config?

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

More
15 Jul 2019 18:02 #139482 by BigJohnT
Replied by BigJohnT on topic Update ini and hal file
Use a text editor, you might want to make a copy first.

JT

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

More
15 Jul 2019 18:10 #139485 by tommylight
Replied by tommylight on topic Update ini and hal file

How to add new codes to ini and hal files to my currunt config?

Use only a text editor like mousepad or xed or gedit or geany, it is not advisable to use windows for editing machine files.

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

More
15 Jul 2019 18:16 #139489 by Dinuka_Shehan
These are the codes

### This code goes in your main .hal file

############# Spindle Encoder #############
# add scale and lowpass, these will be used in custom_postgui.hal
loadrt scale count=1
loadrt lowpass count=1

# add the encoder to HAL and attach it to threads.
loadrt encoder num_chan=1
addf encoder.update-counters base-thread
addf encoder.capture-position servo-thread

# set the HAL encoder to 60 pulses per revolution.
setp encoder.0.position-scale 60

# set the HAL encoder to non-quadrature simple counting using A only.
setp encoder.0.counter-mode true
#setp encoder.0.counter-mode 1 - alternative line

# connect the HAL encoder outputs to LinuxCNC.
net spindle-position encoder.0.position => motion.spindle-revs
net spindle-velocity encoder.0.velocity => motion.spindle-speed-in
net spindle-index-enable encoder.0.index-enable <=> motion.spindle-index-enable

# connect the HAL encoder inputs to the real encoder.
net spindle-phase-a encoder.0.phase-A <= parport.0.pin-13-in
net spindle-phase-b encoder.0.phase-B
net spindle-index encoder.0.phase-Z <= parport.0.pin-12-in
############# End Spindle Encoder #############
#### The following code goes in custom_postgui.hal

# **** Setup of spindle speed display using pyvcp -START ****
# **** Use ACTUAL spindle velocity from spindle encoder
# **** spindle-velocity bounces around so we filter it with lowpass
# **** spindle-velocity is signed so we use absolute component to remove sign
# **** ACTUAL velocity is in RPS not RPM so we scale it.

setp scale.0.gain 60
setp lowpass.0.gain 0.010000
net spindle-velocity => lowpass.0.in
net spindle-fb-filtered-rps lowpass.0.out => abs.0.in
net spindle-fb-filtered-abs-rps abs.0.out => scale.0.in
net spindle-fb-filtered-abs-rpm scale.0.out => pyvcp.spindle-speed

# **** set up spindle at speed indicator ****

net spindle-cmd => near.6.in1
net spindle-velocity => near.6.in2
net spindle-at-speed <= near.6.out
setp near.6.scale 1.500000
net spindle-at-speed => pyvcp.spindle-at-speed-led
### The following code goes in custompanel.xml

<?xml version='1.0' encoding='UTF-8'?>
<pyvcp>
<vbox>
<bd>6</bd>
<label>
<text>"Spindle Speed:"</text>
<font>("Helvetica",20)</font>
</label>
<bar>
<halpin>"spindle-speed"</halpin>
<max_>3000</max_>
</bar>
<label>
<text>"Spindle-At-Speed:"</text>
<font>("Helvetica",20)</font>
</label>
<hbox>
<label>
<text>" "</text>
<font>("Helvetica",20)</font>
</label>
<led>
<halpin>"spindle-at-speed-led"</halpin>
<size>30</size>
<on_color>"green"</on_color>
<off_color>"red"</off_color>
</led>
</hbox>
</vbox>
</pyvcp>

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

More
15 Jul 2019 18:30 #139491 by Grotius
Replied by Grotius on topic Update ini and hal file
Hi,

Geany is the easyest text editor for your example.
To intall geany type in terminal : apt-get install geany
If this giving nothing type in terminal : sudo apt-get install geany

Then at menu -> document -> set-filetype -> scripting languages -> python source file

Your text is displayed as :


Add your lines to your needs...
# = sign's are comments. (red color)
setp = set parameter
addf = add function
loadrt = loadrealtime
net = make a connection
=> or in your file <=> is only for fun, you can delete this if you want

If you are using parport, my advise is to use stepconfi wizard. Then you will see how to invert signal's by in-not.
I see you have a pyvcp screen designed, that is nice !

Good luck in editing !
Attachments:
The following user(s) said Thank You: Dinuka_Shehan, geewhiz

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

More
15 Jul 2019 18:52 #139497 by Dinuka_Shehan
Are there any tutorial for learning the code names,their meanings and method of using them?

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

More
15 Jul 2019 21:47 #139507 by BigJohnT
Replied by BigJohnT on topic Update ini and hal file
Yes, the Documents and asking specific questions on the forum stating what you did, what you expected, any error messages (copy and paste, no screen shots) and what you got.

JT
The following user(s) said Thank You: Dinuka_Shehan

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

More
21 Feb 2021 21:27 - 21 Feb 2021 21:29 #199652 by geewhiz
Replied by geewhiz on topic Update ini and hal file
Grotius

re: Geany
"Then at menu -> document -> set-filetype -> scripting languages -> python source file"

I have been looking all over for this information!!!
I think this will solve one of the many ERRORS I am getting! Like this one.
"joypad_jog_speed.hal:11: Warning: File contains DOS-style line endings."
Do I have to tick "python source file" every time? or is this a default now?
Can I open the files I have already edited and make this change, then re save to fix them?

Thank you, I am very new, and struggling with Linuxcnc.
It just seems so hard to find the information I'm looking for,
and for it to work with the version I'm using.

LinuxCNC:~$ uname -r
4.19.0-13-rt-amd64
LinuxCNC:~$ lsb_release -ic
Distributor ID: Debian
Codename: buster

LINUXCNC - 2.8.1
Last edit: 21 Feb 2021 21:29 by geewhiz.

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

More
21 Feb 2021 22:30 #199659 by tommylight
Replied by tommylight on topic Update ini and hal file

"joypad_jog_speed.hal:11: Warning: File contains DOS-style line endings."

It usually (or always) means the file was edited on a windows PC.

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

More
21 Feb 2021 22:30 #199660 by phillc54
Replied by phillc54 on topic Update ini and hal file
menu -> Edit -> Preferences -> Files -> Default end of line characters

www.geany.org/documentation/manual/

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

Time to create page: 0.229 seconds
Powered by Kunena Forum