MPG encoder count by 4?
- jhandel
- Offline
- Premium Member
- 
				  
		Less
		More
		
			
	
		- Posts: 158
- Thank you received: 7
			
	
						18 Oct 2020 19:41				#186489
		by jhandel
	
	
		
			
	
			
			 		
													
	
				MPG encoder count by 4? was created by jhandel			
			
				I am wiring up my MPG... This is a single ended MPG so it take +5v, 0v, and returns A Pulse and B Pulse... It is counting (so that is great) but in multiples of 4 so 0,4,8,12... (in both directions so 0,-4.-8.-12 and so forth).
I tried changing W10,11,13 from right (default) to left but when I do that I get no counting at all...
should I just account for this in my HAL MPG Increment calculations or is this mis-count a sign of something else wrong?..
Current wiring (because I am using the Spindle encoder for this) is :
* A Pulse - TB3-7
* neg (0v) - TB3-9
* B Pulse - TB3-10
* Positive (+5v) - TB3-12
and I haven't set anything up in the HAL yet, so I am just looking at the data coming out of HAL Configuration's Watch Tab on Encoder 08/09 (the two encoders share the same values because its the last or 10 encoders, the other 8 being on my 7i89 card).
Thanks
					I tried changing W10,11,13 from right (default) to left but when I do that I get no counting at all...
should I just account for this in my HAL MPG Increment calculations or is this mis-count a sign of something else wrong?..
Current wiring (because I am using the Spindle encoder for this) is :
* A Pulse - TB3-7
* neg (0v) - TB3-9
* B Pulse - TB3-10
* Positive (+5v) - TB3-12
and I haven't set anything up in the HAL yet, so I am just looking at the data coming out of HAL Configuration's Watch Tab on Encoder 08/09 (the two encoders share the same values because its the last or 10 encoders, the other 8 being on my 7i89 card).
Thanks
Please Log in or Create an account to join the conversation.
- rodw
- 
				  
- Offline
- Platinum Member
- 
				  
		Less
		More
		
			
	
		- Posts: 11460
- Thank you received: 3843
			
	
						18 Oct 2020 20:08				#186497
		by rodw
	
	
		
			
	
			
			 		
													
	
				Replied by rodw on topic MPG encoder count by 4?			
			
				What card are you using? Does it have dedicated MPG pins like the 7i76e?			
					Please Log in or Create an account to join the conversation.
- jhandel
- Offline
- Premium Member
- 
				  
		Less
		More
		
			
	
		- Posts: 158
- Thank you received: 7
			
	
						18 Oct 2020 20:20				#186504
		by jhandel
	
	
		
			
	
			
			 		
													
	
				Replied by jhandel on topic MPG encoder count by 4?			
			
				It is a 7i76e and I am using the spindle encoder pins.
Thanks
					Thanks
Please Log in or Create an account to join the conversation.
- rodw
- 
				  
- Offline
- Platinum Member
- 
				  
		Less
		More
		
			
	
		- Posts: 11460
- Thank you received: 3843
			
	
						18 Oct 2020 20:35				#186507
		by rodw
	
	
		
			
				
Why not use the pins that are dedicated for running MPGs?
					
	
			
			 		
													
	
				Replied by rodw on topic MPG encoder count by 4?			
			It is a 7i76e and I am using the spindle encoder pins.
Thanks
Why not use the pins that are dedicated for running MPGs?
Please Log in or Create an account to join the conversation.
- jhandel
- Offline
- Premium Member
- 
				  
		Less
		More
		
			
	
		- Posts: 158
- Thank you received: 7
			
	
						18 Oct 2020 21:16				#186515
		by jhandel
	
	
		
			
	
			
			 		
													
	
				Replied by jhandel on topic MPG encoder count by 4?			
			
				Several reasons.
1) not running in software mode 2 (not sure how to set the mode actually
2) using all the inputs for other things (5 axis machine with ATC, so lots of inputs)
3) I’m using an encoder port (spindle encoder) not sure why it shouldn’t work (or maybe it is)
					1) not running in software mode 2 (not sure how to set the mode actually
2) using all the inputs for other things (5 axis machine with ATC, so lots of inputs)
3) I’m using an encoder port (spindle encoder) not sure why it shouldn’t work (or maybe it is)
Please Log in or Create an account to join the conversation.
- rodw
- 
				  
- Offline
- Platinum Member
- 
				  
		Less
		More
		
			
	
		- Posts: 11460
- Thank you received: 3843
			
	
						18 Oct 2020 21:41				#186517
		by rodw
	
	
		
			
	
			
			 		
													
	
				Replied by rodw on topic MPG encoder count by 4?			
			
				As I understand it the encoders are different. Maybe you have found the difference! Maybe you can mult2 by 0.25 before using the encoder count output but I think there would be a lot of hal overhead to get to the right data type. Maybe it would be cleaner to write a custom component that only output a count on every 4th step? that would be pretty simple using integer division.
eg			
					eg
if(!count_in % 4)
  count_out +=1Please Log in or Create an account to join the conversation.
- PCW
- 
				  
- Away
- Moderator
- 
				  
		Less
		More
		
			
	
		- Posts: 17371
- Thank you received: 5064
			
	
						18 Oct 2020 22:11				#186521
		by PCW
	
	
		
			
	
	
			 		
													
	
				Replied by PCW on topic MPG encoder count by 4?			
			
				The high speed encoders lack the 1x mode that the MPG
encoders support, so with a 100 PPR MPG dial you will get
400 counts per turn. One thing to do if you use a high speed
encoder for a MPG is to scale the jog increment by 1/4. This does
mean that every MPG detent crossed will result in 4 smaller jogs.
A better way is to use the 7I76Es built in MPG encoders
that do support 1X mode by default so you get 1 count per detent.
You do this by setting the sserial port mode to 2 by adding a
statement like "sserial_port_0=20xxxx" in the loadrt hm2_eth
config string. If you only have one MPG , you will only lose 2
digital inputs by doing this
					encoders support, so with a 100 PPR MPG dial you will get
400 counts per turn. One thing to do if you use a high speed
encoder for a MPG is to scale the jog increment by 1/4. This does
mean that every MPG detent crossed will result in 4 smaller jogs.
A better way is to use the 7I76Es built in MPG encoders
that do support 1X mode by default so you get 1 count per detent.
You do this by setting the sserial port mode to 2 by adding a
statement like "sserial_port_0=20xxxx" in the loadrt hm2_eth
config string. If you only have one MPG , you will only lose 2
digital inputs by doing this
		The following user(s) said Thank You: jhandel 	
			Please Log in or Create an account to join the conversation.
- fery15sty
- Away
- Premium Member
- 
				  
		Less
		More
		
			
	
		- Posts: 82
- Thank you received: 11
			
	
						19 Oct 2020 03:30				#186547
		by fery15sty
	
	
		
			
	
			
			 		
													
	
				Replied by fery15sty on topic MPG encoder count by 4?			
			
				open "custom_postgui.hal"
setp encoder.0.x4-mode 1
change with:
setp encoder.0.x4-mode 0
linuxcnc.org/docs/html/man/man9/encoder.9.html
					setp encoder.0.x4-mode 1
change with:
setp encoder.0.x4-mode 0
linuxcnc.org/docs/html/man/man9/encoder.9.html
Please Log in or Create an account to join the conversation.
- jhandel
- Offline
- Premium Member
- 
				  
		Less
		More
		
			
	
		- Posts: 158
- Thank you received: 7
			
	
						19 Oct 2020 12:15				#186572
		by jhandel
	
	
		
			
				
I am not sure that works with the Mesa-card based encoders, but I'll give it a look..
Thanks
					
	
			
			 		
													
	
				Replied by jhandel on topic MPG encoder count by 4?			
			open "custom_postgui.hal"
setp encoder.0.x4-mode 1
change with:
setp encoder.0.x4-mode 0
linuxcnc.org/docs/html/man/man9/encoder.9.html
I am not sure that works with the Mesa-card based encoders, but I'll give it a look..
Thanks
Please Log in or Create an account to join the conversation.
- jhandel
- Offline
- Premium Member
- 
				  
		Less
		More
		
			
	
		- Posts: 158
- Thank you received: 7
			
	
						19 Oct 2020 12:17		 -  19 Oct 2020 12:22		#186573
		by jhandel
	
	
		
			
				
Thanks, I was thinking about the 1/4 increments as an option. I mostly wanted to make sure this was expected behavior and wasn't a sign I screwed something up in the wiring...
I really am using almost all of my inputs so moving to software mode 2 would require combining some inputs (like limits) and loosing fidelity on input data..
Thanks for the suggestion, and sharing how to switch to Software Mode 2..
					
	
	
			 		
													
	
				Replied by jhandel on topic MPG encoder count by 4?			
			The high speed encoders lack the 1x mode that the MPG
encoders support, so with a 100 PPR MPG dial you will get
400 counts per turn. One thing to do if you use a high speed
encoder for a MPG is to scale the jog increment by 1/4. This does
mean that every MPG detent crossed will result in 4 smaller jogs.
A better way is to use the 7I76Es built in MPG encoders
that do support 1X mode by default so you get 1 count per detent.
You do this by setting the sserial port mode to 2 by adding a
statement like "sserial_port_0=20xxxx" in the loadrt hm2_eth
config string. If you only have one MPG , you will only lose 2
digital inputs by doing this
Thanks, I was thinking about the 1/4 increments as an option. I mostly wanted to make sure this was expected behavior and wasn't a sign I screwed something up in the wiring...
I really am using almost all of my inputs so moving to software mode 2 would require combining some inputs (like limits) and loosing fidelity on input data..
Thanks for the suggestion, and sharing how to switch to Software Mode 2..
		Last edit: 19 Oct 2020 12:22  by jhandel.			
			Please Log in or Create an account to join the conversation.
		Moderators: PCW, jmelson	
		Time to create page: 0.088 seconds	
