Machsupport Forum
Third party software and hardware support forums. => PoKeys => Topic started by: BIGWING on September 05, 2015, 09:00:03 AM
-
I have hit a brick wall here and in desperate need of help
I am driving my lathe tool turret with a small stepper motor. The turret rapid rotates (47deg) anticlockwise past location, pawl engages then slowly rotates (2 deg) clockwise to locate etc.
I have got it working physically in that I press a button and it indexes properly. However as a safety feature I have added an encoder to verify that it has indexed correctly.
(eventually I want to get it working automatically via M6 macro)
I have linked the turret rotation up to A axis and that DRO is working fine. I have created a encoder count DRO and that is mimicking the values in the Pokeys F7 table but what I can't
get it to do is to zero. Note if I press the reset button on the F7 table it does zero but not via my macro.
What I want to achieve is the following. (encoder related only)
When the button is pressed the macro is called.
The encoder count is set to zero.
When the turret rotation is complete the encoder count value is compared with a reference value.
If it is within range proceed, if not output an error message and stop.
For the moment I have cleaned the macro down to just two lines
DoOEMButton(1011) ' This zeros the A axis DRO and this works' I have left this in as this proves my link from the button to the macro works
SetOEMDRO(102,0) ' This isn't working
For information
The encoder is set up as encoder 2 in pokeys mapped to OEM DRO 102 " MPG2" and setup in config ports and pins encoders
(Also don't know if it's relevant but I am not using pokeys pulse engine)
I am pulling my hair out here so any help would be greatly appreciated
cheer George
-
Hi, George
Encoders are handled in the PoKeys device itself and the plugin merely forwards the values to Mach3. It is not possible to set the encoder value from Mach3.
Since you are not using MPGs for jogging, you can assign the encoder value to an unused DRO slot and handle the resetting in your script.
-
Hi NeoTO
Many thanks for your help
I have changed the DRO used to 1999 to both Pokeys encoder DRO, and dro box via screen4
then using SetOEMDRO(1999,0) in macro
and I am just getting the same result
ie the values are in the DRO box and moving with the motor but still won't reset
Can you see what I am doing wrong?
cheers George
-
Instead of setting DRO to zero, save the current value of the DRO in your own variable. This is offset that you subtract from encoder DRO to get your new position, which you can save to a new DRO.
So, for example, you determine that the encoder value of 1234 should be showing 0. Save 1234 to a offset variable and subtract this value from then on. The encoder value of 1244 will then read +10.
-
Hi NeoTO
Cracked it (I Think)
I set Pokeys Encoder2 DRO setting to 102 'MPG2"
Then did a short one line brain program
(ADD Input) Mach variable MPG2 count
(ADD Input) No Operation
(Terminate) DRO 1999
This just copies the values from DRO 102 to DRO 1999
then in script
SetOEMDRO(1999,0)
and it works (or seems to so far) the only thing I think I need to
check is what the transfer rate is like in real time to make sure of it's repeatability.
If it introduces too many errors I will do what you say and tweak in script.
Many Many thanks for all your help (On a Saturday Too !!!!!)
cheers George
-
Spoke too soon, It doesn't work
The values are copied from DRO 102 to DRO 1999
and you can reset DRO 1999
but when turret starts moving again the values don't start from
zero and count up they just copy DRO 102 Obvious when you think about it
Hey Ho I will do it as NeoTO suggested and subtract start value in script
cheers George