On Saturday 09 March 2019 22:44:19 John Dammeyer wrote:

> > > On Sat, 9 Mar 2019 at 16:31, John Dammeyer
> > > <jo...@autoartisans.com>
> >
> > wrote:
> > > > How does a simple test like:
> > > >
> > > > if (COOLANT_SWITCH == 1) PUMP1 = 1; else PUMP1 = 0;
> > > >
> > > > become abstracted through the HAL into the actual low level?
> > >
> > > Skipping all the other stuff that I can't answer....
> > >
> > > In HAL that is "net some_signal an_input => an_output"
> > > A concrete example:
> > >
> > > net coolant_on iocontrol.0.coolant-flood =>
> > > hm2_5i35.0.7i76.0.1.gpi0-00-out
> >
> > That should be .0. above, not ,0.  :)
>
> The Xylotex HAL file for the BBB MachineKit has:
>
> # connect DB25-11 to X home and min limit
> net home-x bb_gpio.p8.in-10 => axis.0.home-sw-in axis.0.neg-lim-sw-in
>
net as used above is a hookup instruction to hal
net signal-name src-of-signal target-to-send-signal. the "net 
signal-name"
can be used later in the hal file
net same-signal-name new-target new-target new-target   
to send that same signal to 3 new targets. If there is a fanout limit, 
I'm not aware of it. 
> We have "net" as opposed to "setp" and "newsig" which also show up in
> the hal file.  No idea what .net tells us.
newsig has been deprecated but is still recognized. 
setp applies a parameter, and I believe 
"sets" sets a signal-name to a given value, but I've never used it.>
> Next there's "home-x"  which I'm guessing is the name of the signal
> and at some level somewhere deep in the bowels of the application just
> before a step pulse is issued and the step would move in the direction
> of the home switch the program checks to see if where home-x points is
> ON.
nominally correct if its homing.

> Now "home-x" is really just a label

yes, in this case carry's the labels value

> - like a word in a dictionary and 
> the definition would be, in the C language, a pointer to structure
> that eventually maps to the actual physical hardware.
>
> The other side of the => is an application specific data structure.  A
> different non-CNC program that was using this pin as a door closed
> sensor wouldn't have  axis.0.home-sw-in axis.0.neg-lim-sw-in.
>
Those => and <= are there for us, to show the direction of the value 
flow.  hal throws them away, so the usage is 100% optional.
> It might have room.0.entrance-sw-in

and the underlying functionality is identical

> Anyway for LinuxCNC the "axis" is the overall structure of all axis on
> the machine.
>
> The ".0" identifies that it's the first axis which is the X axis and
> the ".home-sw" is pretty self-evident. The second space delimited
> identifier on the line "axis.0.neg-lim-sw-in" tells us this switch is
> also used for the X axis negative direction limit switch.
>
> If compiled into C code it would ultimately look something like this
> when the home switch is checked.
>
>      if (axis.0.home-sw-in)  {
>       // home reached so decelerate if homing.
>     }
>
>      if (axis.0.neg-lim-sw-in)  {
>       // negative limit reached so stop motion now.
>     }
>
>
> At the compiled level the axis.0.home-sw-in holds the address of
> bb_gpio.p8.in-10 and the real code hidden behind the dressing is more
> like this in both cases. If (*bb_gpio.p8.in-10)
>   }
>
> But I don't think LinuxCNC nor MachineKit compiles this into C code. 
> So how is this indirection used?

At the hardware level, the label is a memory address containing the 
value.

> I wouldn't even know where to start looking for it in the source code
> for LinuxCNC.

Neither would I John.

> Thanks
>
> John Dammeyer
> http://www.autoartisans.com

Start by reading everything in /usr/share/doc/linuxcnc.  With a few 
exceptions that is the bible for linuxcnc.
>
> > > atp
> > > "A motorcycle is a bicycle with a pandemonium attachment and is
> > > designed for the especial use of mechanical geniuses, daredevils
> > > and lunatics."
> > > � George Fitch, Atlanta Constitution Newspaper, 1916
> > >
> > >
> > > _______________________________________________
> > > Emc-users mailing list
> > > Emc-users@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/emc-users
> >
> > Cheers, Gene Heskett
> > --
> > "There are four boxes to be used in defense of liberty:
> >  soap, ballot, jury, and ammo. Please use in that order."
> > -Ed Howdershelt (Author)
> > Genes Web page <http://geneslinuxbox.net:6309/gene>
> >
> >
> >
> > _______________________________________________
> > Emc-users mailing list
> > Emc-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/emc-users
>
> _______________________________________________
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users


Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>



_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to