New Lathe build encoder index pulse stopped working
- pl7i92
- Offline
- Platinum Member
Less
More
- Posts: 1875
- Thank you received: 354
09 Sep 2019 12:50 #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 or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
Less
More
- Posts: 23178
- Thank you received: 4864
17 Sep 2019 00:16 #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
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.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 or Create an account to join the conversation.
Time to create page: 0.058 seconds