How to set a Bit in HAL

More
31 Jan 2024 00:09 #292032 by wisao
Hey guys,

I'm using the LIMIT3 component linuxcnc.org/docs/html/man/man9/limit3.9.html

how do I activate limit3.0.enable ?

I need to activate it with one parallel port button and deactivate it with the another.

# Limit 3 Enable Set / Clr

net limit3-0-set <= parport.0.pin-12-in-not
net limit3-0-clr <= parport.0.pin-13-in-not

# net limit3-0-set => setp limit3.0.enable 1
# net limit3-0-clr => setp limit3.0.enable 0

The last two commented lines are giving me an error.

What I want to do is when I turn on pin 12, Enable is 1 and when I turn on pin 13, Enable is 0

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

More
31 Jan 2024 04:55 #292043 by zz912

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

More
31 Jan 2024 19:43 #292098 by wisao
Replied by wisao on topic How to set a Bit in HAL
Can you please show me a pratical example ? please

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

More
31 Jan 2024 20:13 - 31 Jan 2024 20:24 #292100 by Aciera
Replied by Aciera on topic How to set a Bit in HAL
I think 'toggle2nist' is for a single momentary button to change the states of two complementary output signals. What is needed here is the opposite, two input signals to change the state of one output signal.

Are your input signals on the parallel port momentary signals (ie signal goes high when you press the button)?

[edit]
Maybe an sr latch would do the job (using two 'and2' and two 'not' components):
www.educative.io/answers/the-sr-latch

There may be a ready made component for this but I cannot find one.
Last edit: 31 Jan 2024 20:24 by Aciera.

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

More
31 Jan 2024 20:30 #292101 by tommylight
Replied by tommylight on topic How to set a Bit in HAL
Flip-flop?

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

More
31 Jan 2024 22:31 #292109 by PCW
Replied by PCW on topic How to set a Bit in HAL
Yes, the flipflop component will work for this
since it has set and reset inputs:

loadrt flipflop
addf flipflop.0 servo-thread
loadrt limit3
addf limit3.0 servo-thread 

net limit3-0-set <= parport.0.pin-12-in-not  flipflop.0.set
net limit3-0-clr <= parport.0.pin-13-in-not  flipflop.0.reset
net limit3-enable flipflop.0.out limit3.0.enable


 
The following user(s) said Thank You: tommylight, zz912, wisao

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

More
31 Jan 2024 23:14 #292110 by wisao
Replied by wisao on topic How to set a Bit in HAL
Thanks, it works very well, i really appreciate your help

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

Time to create page: 0.079 seconds
Powered by Kunena Forum