When can you use -not and when can you not use -not?

More
12 Aug 2024 15:34 - 12 Aug 2024 15:37 #307552 by slowpoke
I'm a bit of a newbie with HAL logic, and I wanted to change a 2 input OR gate to a 3 input OR gate so that when I toggle machine power off the spindle would also stop in addition to any table motion related to the servo's.

Initially I tried driving the 3rd input to the OR gate with motion-enable-not and this did not work, so I added an inverter driven with motion-enable and then used the output of the inverter (named stop-the-spindle) to drive the 3rd input of the OR gate and that works.

It's not obvious to me when you can append a signal with "-not" to invert the signal and when you can't?
If there is an obvious more elegant solution to my approach, please let me know.

I have included the hal file, with the original 2 input OR commented out and the new 3 input OR with inverter implemented. "#A12"  highlights the changes. Also attached logic diagram that shows the change in magenta.
 


 

File Attachment:

File Name: postgui_20...8-12.hal
File Size:3 KB


 
Attachments:
Last edit: 12 Aug 2024 15:37 by slowpoke.

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

More
12 Aug 2024 15:53 - 12 Aug 2024 15:59 #307555 by Aciera
Whether a component provides a '...-not' pin to invert a signal depends on the author of that particular component. You can use the 'Show HalConfiguration' tool to see all available hal pins loaded in your current config. Mesa provides those for many pins as a convenience but usually you will need to use a separate 'NOT' component that is included in the hal component library.

[edit]
Example:
#load the component
loadrt not
#start an instance
addf not.0 servo-thread

# usage
net your-signal                  <= some_pin_here           => not.0.in
net yoursignal-inverted     <=not.0.out => your_destination_pin
Last edit: 12 Aug 2024 15:59 by Aciera.
The following user(s) said Thank You: slowpoke

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

More
12 Aug 2024 16:02 #307558 by PCW
You can list all pins by running LinuxCNC and issuing
this command in a terminal:

halcmd show pin > pins.txt

Which will create a file: pins.txt containing all available
pins in the running LinuxCNC configuration.
The following user(s) said Thank You: slowpoke

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

Time to create page: 0.191 seconds
Powered by Kunena Forum