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

More
2 years 2 months ago #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.
 

Attachment not found



 

Attachment not found



 

Please Log in to join the conversation.

More
2 years 2 months ago #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:
Code:
#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

Please Log in to join the conversation.

More
2 years 2 months ago #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.

Please Log in to join the conversation.

Time to create page: 0.474 seconds
Powered by Kunena Forum