- Posts: 1871
- Thank you received: 0
New Lathe build encoder index pulse stopped working
7 years 1 month ago #144598
by pl7i92
Replied by pl7i92 on topic New Lathe build encoder index pulse stopped working
it may look like this with no other parts just use the phasa A for a counter and compare if it eqals it is your REV signal
loadrt encoder num_channel=1
loadrt comp count=1
addf encoder.update-counters base-thread
addf comp.0 base-tread
addf encoder.capture-position servo-thread
setp encoder.0.counter−mode 1
net encscale encoder.0.position-scale [JOINT_yourscale]INPUT_SCALE
net encscale comp.0.in1
net enc0A encoder.0.phase-A <= parport.0.pin-10-in
net enccomp encoder.0.position comp.0.in0
net equenccomp comp.0.equal #1 Rev
loadrt encoder num_channel=1
loadrt comp count=1
addf encoder.update-counters base-thread
addf comp.0 base-tread
addf encoder.capture-position servo-thread
setp encoder.0.counter−mode 1
net encscale encoder.0.position-scale [JOINT_yourscale]INPUT_SCALE
net encscale comp.0.in1
net enc0A encoder.0.phase-A <= parport.0.pin-10-in
net enccomp encoder.0.position comp.0.in0
net equenccomp comp.0.equal #1 Rev
Please Log in to join the conversation.
7 years 1 month ago #145352
by andypugh
For power-of-two encoders you could just watch a single bit of the binary number:
linuxcnc.org/docs/2.7/html/man/man9/bitslice.9.html
Writing a simple HAL component is very easy, if you know any C at all.
linuxcnc.org/docs/2.7/html/hal/comp.html
Your component would be about as simple as the 15.2 sincos example there.
Replied by andypugh on topic New Lathe build encoder index pulse stopped working
Hakan wrote:
in some kind of pseudo-code should always give a signal once every turn no matter direction. But I couldn't find a "mod" hal component.Code:if abs(encoder.count mod encoder.position-scale) <1 index-Z = 1
For power-of-two encoders you could just watch a single bit of the binary number:
linuxcnc.org/docs/2.7/html/man/man9/bitslice.9.html
Writing a simple HAL component is very easy, if you know any C at all.
linuxcnc.org/docs/2.7/html/hal/comp.html
Your component would be about as simple as the 15.2 sincos example there.
Please Log in to join the conversation.
Time to create page: 0.141 seconds
