Good resource to understand HAL

More
29 Jun 2020 20:19 #173132 by umfan110
Hows it going guys,

I just picked up a MESA 7i76e and got it up and running no problem. I have have proceeded with the PnCConfig and am able to run linuxcnc. I am still pretty new to Linuxcnc and was wondering if someone could point me in the right direction in understanding HAL. I am having a hard time understanding it conceptually. I know that the .hal file is a configuration file but thats about it. Is it some kind of configuration file for linuxcnc so it knows what board you are using, how to connect to it, and gives a layout of all the pins ? Am I on the right track? Any more resoruces would be awesome. Thanks for reading !

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

More
30 Jun 2020 03:18 #173170 by cmorley
HAL is infrastructure that makes sharing specific information between programs possible and easily reconfigurable.

ie the mesa board program shares data (via HAL) with the linuxcnc machine's I/O controller program.

It's best analogy is electrical connections.

The manual is surely the best source of information.
Actually playing with simple (non machine controller) examples may be a good way to learn.
The following user(s) said Thank You: umfan110

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

More
30 Jun 2020 23:14 #173240 by andypugh
One thing that it might help to get straight immediately is that the HAL file isn't a program that is run continuously. It defines data connections and is parsed only once at system startup.
All it does is load all the modules of LinuxCNC and define how they pass data to each other All the code that runs is inside those modules.
The following user(s) said Thank You: umfan110

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

More
01 Jul 2020 17:22 #173322 by umfan110
Ok so since the MESA is an FPGA card at the end of the day the HAL file is a way to tell LinuxCNC what is connected to where and these "connections" can be managed as one sees fit.

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

More
01 Jul 2020 18:10 #173329 by andypugh
With a Mesa card you connect, for example, the stepgen-position-command input pin of the Mesa card to, for example, the Z axis position command output pins from the linuxcnc motion module LinuxCNC.
net zpos joint.0.motor-position-cmd => hm2_5i25.0.stepgen.02.position-command

The strength of HAL here is that you could use any of the stepgens, or any other interface card, or a software stepgen and then use more HAL to connect the output of the software stepgen to specific parallel port pins.

And then you can load "signal processing" modules, for example to add X and Y position commands together and send them to a PWM, or an LCD display or anything you fancy.
The following user(s) said Thank You: umfan110

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

More
09 Jul 2020 12:51 #174087 by umfan110
Andy,

Thanks for the reply I think I understand. This may be a step to far but could you brake down the syntax of the HAL line you included that would be a game changer or point me in the right direction as to where i can learn the syntax of HAL.

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

More
09 Jul 2020 14:43 #174095 by andypugh
The syntax for "net" is

net signame pin2 [pin2...pinN]

ie, the net command takes two compulsory arguments and many optional additional ones.

The signame is something that you choose.
The pin names are HAL pins from HAL components that you want to pass data between.
The arrows are just to help human readers and are optional.

linuxcnc.org/docs/2.7/html/hal/basic-hal.html
The following user(s) said Thank You: umfan110

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

Time to create page: 0.070 seconds
Powered by Kunena Forum