How to set a Bit in HAL
- wisao
- Offline
- New Member
- 
				  
		Less
		More
		
			
	
		- Posts: 15
- Thank you received: 1
			
	
						31 Jan 2024 00:09				#292032
		by wisao
	
	
		
			
	
			
			 		
													
	
				How to set a Bit in HAL was created 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
					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.
- zz912
- 
				  
- Offline
- Platinum Member
- 
				  
		Less
		More
		
			
	
		- Posts: 573
- Thank you received: 89
			
	
						31 Jan 2024 04:55				#292043
		by zz912
	
	
		
			
	
			
			 		
													
	
				Replied by zz912 on topic How to set a Bit in HAL			
			
					Please Log in or Create an account to join the conversation.
- wisao
- Offline
- New Member
- 
				  
		Less
		More
		
			
	
		- Posts: 15
- Thank you received: 1
			
	
						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.
- Aciera
- 
				  
- Offline
- Administrator
- 
				  
		Less
		More
		
			
	
		- Posts: 4552
- Thank you received: 2027
			
	
						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.
					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.
- tommylight
- 
				  
- Away
- Moderator
- 
				  
		Less
		More
		
			
	
		- Posts: 20839
- Thank you received: 7104
			
	
						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.
- PCW
- 
				  
- Away
- Moderator
- 
				  
		Less
		More
		
			
	
		- Posts: 17366
- Thank you received: 5062
			
	
						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
 			
					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.
- wisao
- Offline
- New Member
- 
				  
		Less
		More
		
			
	
		- Posts: 15
- Thank you received: 1
			
	
						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.083 seconds	
