= Halui Examples For any Halui examples to work you need to add the following line to the {[}HAL{]} section of the ini file. HALUI = halui == Remote Start To connect a remote program start button to EMC you use the halui.program.run pin and the halui.mode.auto pin. You have to insure that it is Ok to run first by using the halui.mode.is-auto pin. You do this with an and2 component. The following figure shows how this is done. When the Remote Run Button is pressed it is connected to both halui.mode.auto and and2.0.in0. If it is ok for auto mode the pin halui.mode.is-auto will be on. If both the inputs to the and2.0 component are on the and2.0.out will be on and this will start the program. Remote Start Example . image::images/remote-start.png[] The hal commands needed to accomplish the above are: net program-start-btn halui.mode.auto and2.0.in0 <=  net program-run-ok and2.0.in1 <= halui.mode.is-auto net remote-program-run halui.program.run <= and2.0.out Notice on line one that there are two reader pins, this can also be split up to two lines like this: net program-start-btn halui.mode.auto <=  net program-start-btn and2.0.in0 == Paused & Resume This example developed from the need of EMC2 to move a rotary axis when told to do so by another machine. To coordinate between two control systems using Halui we take advantage of two components of Halui. - halui.program.is-paused - halui.program.resume In your custom.hal file we can add a couple of lines that when connected to your I/O can tell the other control system that the program is paused and to resume the program when the other control system wants EMC2 to resume. net ispaused halui.program.is-paused => your out pinnet resume halui.program.resume <= your in pin Your inand out'' pin is what is connected to the other controller. It could be a parallel port pin or any other pin you have access to. How this works is when a M0 is encountered in your g code halui.program.is-paused goes true. This turns on your outpin so the other controller knows EMC2 is finished. To resume the g code the other controller makes your inpin go true. This will then run the EMC2 g code up to the next M0. Timing requirements - Resume must not be true longer that it takes to run the g code - Is Paused must not be on when next resume arrives Timing issues that could foul up a good plan is when the other controller sends a resume out and sees the is paused bit on and thinks that EMC2 was very fast at completing the requested command. The second issue is the other controller sending out a resume that is longer than it takes to execute the program. This could be over come using ClassicLadder to turn on the is paused bit for a limited amount of time then turning it back off. Also the resume could be on a one shot or a very short timer.