2011/12/30 Spiderdab <[email protected]>:
> Hi all, i need to compare 4 inputs into hal (a limit value on each of 4
> motors) and if one of them is true the output will be true. (it is a
> tetrapod, so only one motor-limit at a time can be true, fisically.)
>
> The fastest way in my mind is to use 3 or2 components, so i compare two
> or2 outputs as the third or2 inputs, and i know that will work, but is
> there some way i can solve the same logic with less components?
>

Another pretty easy thing would be customizing existing or2 module to
create or4 module.
It requires adding 2 lines in the beginning and changing last line of
the or2 source file:
http://git.linuxcnc.org/gitweb?p=emc2.git;a=blob;f=src/hal/components/or2.comp

Now last line is:
FUNCTION(_) { out = in0 || in1; }

For or4 it should be:
FUNCTION(_) { out = in0 || in1 || in2 || in3; }

And 2 lines need to be added in the beginning to create in2 and in3 input pins:
pin in bit in2
pin in bit in3

To install it in existing EMC, You need:
1) get EMC source from Git, just follow instructions here:
http://wiki.linuxcnc.org/emcinfo.pl?Installing_EMC2#Getting_the_source_with_git
2) edit and save or component file (I will assume that it saved as or4.comp);
3) install emc2-dev package from repository;
4) run in terminal:
    a) cd ~/emc2-dev/src/hal/components
    b) sudo comp --install or4.comp

Even though You already have solved Your question, I suspect this
information might become handy to You or any other user some other
time, because I have found that customizing existing components is
much easier than trying to combine different HAL modules to do some
specific task. Some examples - I created and5 module, modified thc
module to follow 2 different thc sensors etc.

Viesturs

------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to