Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: BIGWING on September 06, 2015, 07:57:09 AM

Title: Why Is this happening?
Post by: BIGWING on September 06, 2015, 07:57:09 AM
I am in the process of setting up my lathe tool turret

I am using small stepper motor, an encoder and using Pokeys 57E

I have a button via Pokeys calling a macro controlling the operation.

In the macro I have G01 code controlling the movement with a high

feed rate F900. I need this high a feed rate because of the turret gearing

It all works as expected except  when I first load up mach and try it

at this point it appears to use the feed rate in feed DRO.

It completes the cycle ok but way to slow.

Once it has completed one cycle it seems to follow the macro perfectly.

Does anyone have any ideas on what could be influencing the first cycle


Any ideas would be greatly appreciated

cheers George
Title: Re: Why Is this happening?
Post by: ger21 on September 06, 2015, 10:11:55 AM
Can you post the macro?
Title: Re: Why Is this happening?
Post by: BIGWING on September 06, 2015, 10:48:56 AM
Hi Gerry

Dim T1 As Long
Dim T2 As Long
Dim T3 As Long

DoOEMButton(1011)'Zero A axis DRO

DoOEMButton(303)'MPG Velocity Only

T1 = GetOEMDRO(102) 'current encoder count

Code (" G01 A47 F900") 'move 47deg anticlockwise fast
   While (IsMoving())
      Sleep (100)
   Wend
Code ("G01 A45 F200") 'move 2Deg clockwise slowly
   While (IsMoving())
      Sleep (100)
   Wend

T2 = GetOEMDRO(102) 'new encoder count

T3 = T2 - T1

SetOEMDRO(1999,T3)'Put value T3 into Encoder DRO


Note without DoOEMButton(303) it always runs slow


cheers George 

ps when I tried to attach file m1200 it told me 2 error one already exists rename"

so to load just remove (duplicate)               
Title: Re: Why Is this happening?
Post by: BIGWING on September 07, 2015, 07:12:53 AM
One other thing I have noticed is that if I go into

config ports and pins when I come out of it

and try turret it reverts back to slow feed

for first cycle.

George
Title: Re: Why Is this happening?
Post by: BIGWING on September 07, 2015, 03:45:55 PM
Another strange thing

I have tried to remove the feed rate issue altogether

by changing the two code lines to  G00 A47  and G00 A45  (rapid traverse)

and it is just the same slow on the first cycle fast on the rest !!!!!!!!



Where is the feed rate for G00 set?



The screen set I am using has feederate option G94 and G95

In one of my textbooks it says Fanuc type lathe controls normally use G98 and G99

Does anyone know what is correct for mach lathe?


Cheers George
Title: Re: Why Is this happening?
Post by: RICH on September 08, 2015, 07:42:35 AM
George,

Where is the feed rate for G00 set?

G00 - the max feedrate will be limited by the max Velocity  setting in motor tuning  
Note that an axis can be defined as linear and rotary.

G94  & G95 are correct for Mach3. See the manual for Mach's definition of G98 & G99. There are differences in the Gcode definitions
between manufactures and some manufacture Gcodes are specific to that manufacturer.

What version of Mach are you using?
What / who's screen set are you using?
May want to post you xml file.

RICH
Title: Re: Why Is this happening?
Post by: BIGWING on September 08, 2015, 10:47:21 AM
Hi Rich

Mach version is R3.043.066
Please find attached xml and screen set


Got the screen somewhere on forums a couple of months ago
but can't see it listed now. Wanted to try it as it already had A DRO set up
only mod I have made to original is added extra encoder DRO.

However since your post I have tried using standard lathe screen and
problem is just the same.

What I have also tried is typing G01 A45 F900 directly into MDI line and this
works every time even after restarting mach or after viewing ports and pins

So then I tried writing a new shorter macro (without using cut and paste from previous macros)
consisting only of

DoOEMButton(1011)

Code("G01 A45 F900")
     WhileIsMoving())
          Sleep(100)
      Wend

I then called this macro up direct from the MDI line and the problem is
exactly the same as before ie slow after start up then works fine
every subsequent attempt

Cheers George
Title: Re: Why Is this happening?
Post by: ger21 on September 08, 2015, 11:37:45 AM
Try going back to an older version like .062 or .057.
3.043.066 is known to be rather buggy,
Title: Re: Why Is this happening?
Post by: BIGWING on September 08, 2015, 02:40:33 PM
Hi Gerry

Just the same unfortunately

cheers George
Title: Re: Why Is this happening?
Post by: BR549 on September 08, 2015, 07:02:35 PM
When mach 3 first loads up the feerate is set to zero.That is a safety feature. Try adding in a Fcall in the initiation string. Something like F100.  The reason it is slow when you come out of config IS mach3 resets and that sets the Feedrate back to ZERO again (;-).

IF putting a f100 in the initiation string does not help then FORCE the Fcall it your macro by making a call.  Code"F900" put it in before any action code, right after the last DIM call

Code"F900"
While Ismoving()
Wend







Title: Re: Why Is this happening?
Post by: ger21 on September 08, 2015, 09:42:01 PM
When mach 3 first loads up the feerate is set to zero.


Doesn't it always default to 6ipm?
Title: Re: Why Is this happening?
Post by: RICH on September 08, 2015, 10:02:00 PM
Hmm...thought it was 6 ipm also

I will need to check something in ver 62 as I have noticed, but ignored while testing my screen set, that  at times that a slow feedrate
occurs,  when,  "I think" I have used the mpg and then want to rapid jog. So his use of the mpg in the script kind of rang a bell.
I may be all wet......but will try to check it out.


RICH

 
 
Title: Re: Why Is this happening?
Post by: BIGWING on September 09, 2015, 10:44:48 AM
HI BR549

Thanks for the help.

When I did what you suggested the feed value does appear in the feed rate DRO but is not used

in either the fast or slow cycles. At the end of the cycle the feed DRO reverts back to this value.


However I have noticed something very strange.


When it does the fast cycle I thought it was following the feed rate in the macro.   It is not.

It is actually following the value I have set up in motor tuning for axis A acceleration.

I have tried altering this for low to high values and it does appear to be using the acceleration value

as the feed rate.


Does anyone have any idea what could be causing this?



For information

The stepper driver I am using for the turret is a Leadshine   DM422C

I have the steps per set to 93.333333333

the steps per rev of stepper is 1600
the turret gear ratio is 1:21

so     (1600 x 21) / 360 = 93.3333333

also the manual states that  t3 the pulse width should not be less than 7.5 us

(page 12 of manual)

I have tried the step pulse width at both 5 and 8 dir pulse width 5

with no change

I have tried several different acceleration values but for most of the time

I had it set at 900 which was the same feed rate value I had in my macro

and why I didn't realise it wasn't using that value

the velocity I have normally set to about 1/3 the accel value

let me know if you think this may be part of the problem?

cheers George
Title: Re: Why Is this happening?
Post by: BR549 on September 09, 2015, 05:05:37 PM
First I would NOT use the A axis for a turrent . It has special features that allow it to radius sync to the XYZ motion. I would use one of the other axis B C.  You also need to start with a more normal setup I would start with VEL =200 and acel =20 as a test. THEN run the code and see how it responds.

ONCE you get it running smooth THEN you can play to find max vel and accel settings.

You could also be having trouble with the POKEYS ??

Just a thought, (;-)
Title: Re: Why Is this happening?
Post by: BIGWING on September 12, 2015, 11:33:26 AM
Hi Guys

Sorry about the delay in responding but I have been working away for a few days.

Have done what you said ie changed axis over from A to B and it has made some improvement .

When the system is initialized it does start up at 6  (although my selected units are mm not inches)

Now when the turret moves in the fast cycle (either macro or MDI) it does follow the feed rate

(not the acceleration value in motor tuning as before)  set in the code.

(or at least it seems to compared to the DRO I haven't actually timed it)

But I still have the problem that after start up coming out of ports and pins

it runs the first cycle slow (occasionally it will be two cycles)

This is true if the code is entered via the macro or MDI.

One thing I have noticed is that when the cycle is running on the slow

cycle the feed increase/ decrease buttons never work. When it is running in the

fast cycle some times the feed  rate change buttons sometimes work!!

(but I haven't been able to spot the pattern why sometimes it does and sometimes

it doesn't)

I don't know what else to try.

Any suggestions would be greatly appreciated.

Cheers George

(ps I am contacting pokeys so see if the issue may stem from

pokeys but not holding my breath as I have tried without using

encoder readings or pokeys controlled button but just via MDI.

but we shall see what they say)
Title: Re: Why Is this happening?
Post by: BIGWING on September 13, 2015, 10:49:12 AM
Hi Guys

Good news.  I've cracked it.  (well it seems to be working so far)

But I have absolutely no idea why it's working.

Stumbled across it by complete accident. I noticed that if I zeroed

the axis DRO immediately after start up or after coming out of ports and pins

it didn't go through the slow cycle.

What is strange is the first line of my macro zero's the DRO using

DoOEMButton(1012)

The button on the screen zeros the DRO using

Call SetDRO(4,0)

when I put the   Call SetDRO(4,0)   line at the start of the macro I don't get the slow cycle


The vb manual says SetDRO is just a legacy command and it's use is not recommended

So I tried putting an extra line of  DoOEMButton(1012) but that didn't work

But at least I have a solution which seems to work so far.

If anyone has any has any theories why it is behaving like this I would love to hear them.

Cheers George