> > 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 We have "net" as opposed to "setp" and "newsig" which also show up in the hal file. No idea what .net tells us. 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. Now "home-x" is really just a label - 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. It might have room.0.entrance-sw-in 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? I wouldn't even know where to start looking for it in the source code for LinuxCNC. Thanks John Dammeyer http://www.autoartisans.com > > 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