GearHeads Corner
November 23, 2020, 04:32:37 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: 1 ... 21 22 [23] 24 25 ... 39
  Print  
Author Topic: reading Pokeys pins  (Read 57655 times)
0 Members and 1 Guest are viewing this topic.
gburk
Sr. Member
****
Posts: 319


View Profile
« Reply #330 on: July 30, 2019, 07:20:29 PM »

Thanks art

I have run into a small strange issue when running a g code file it seems to run at a good speed then for no reason at least no one I see...
when it gets to running a profile it runs great then it hits a spot and the Feed rate seems to slow down in half it may make I or two passes then the feed rate go's back to normal, I have look in the g code file at the lines it seems to slow down but I don't see any thing different that could make it slow down so much..

The feed rate is constantl y changing form Z that I have at F10 and X Y at F30  it almost seems like it just all of a sudden reads the F10 and doesn't switch to F30 for the x y
the feed rate lines are always back to back Z F then change to X Y Feed,  looks like next time it gets to the next feed rate change it's back to normal
then maybe 3 or 4 passes it will do it again...

not sure if it me or a buffer problem  the g code file is over 5000 lines..

I did test this with motors connected and running but cutting air...

Gary
Logged
ArtF
Administrator
Hero Member
*****
Posts: 5666



View Profile
« Reply #331 on: July 30, 2019, 07:38:28 PM »

Gary:


 What is your look ahead set to? Try 500 or so. See if that cures it.
Auggie is different in the way it plans, it will achieve whatever speed it can
up to demanded feedrate speed by adding lines and re-planning after each line
to see if it can readjust the previous lines speeds to go faster. When it starts
to move it has already planned its stop. So, if lines get added, as they always
do it will look ahead about 1/2 second, lock up to there and replan the
rest of motion to ensure its going as fast as it can, while knowing exactly
when it will run out of commands and stop  with normal decel.

   Ive seen what you describe, usually in arcs as they can have a lot of
very tiny moves, the type of thing that used to make Mach3 stutter.
Setting a longer lookahead tunes it to that kind of code and allows much
smoother motion on micro gcode motions.

 

Art

 

Logged
gburk
Sr. Member
****
Posts: 319


View Profile
« Reply #332 on: July 31, 2019, 08:26:18 AM »

Art

Ok will give it a try and let you know how it go's..

I was not getting alert messages for this site either, what I had to do was login to my internet provider account and shut off blocking or spam and then I started getting the alerts and all messages. .

Did the look ahead change and its fine now so that was the problem..

Gary
« Last Edit: July 31, 2019, 09:18:31 AM by gburk » Logged
gburk
Sr. Member
****
Posts: 319


View Profile
« Reply #333 on: August 02, 2019, 04:12:06 PM »

Art

I can't figure this out anything I enter below the last print line in this script I get compile error if I remove the line after the last print it complies fine..
and I don't see anything wrong with the code..

maybe it will compile for you, it imports into the LIB and doesn't show an error in the LIB only when I try to compile in the script window..

// Library Probing
// Created  Sunday, April 16, 2019
// Author  Gary       -- Do not edit above this line
// Z probe touch off                                             
  // ex: global mylibprob e = function(axis,distance,feedrate,touchPlate);
 
 //Z Axis probe, distance to move down, fast feedrate, slowfeed rate, touch off plate thickness if 0 no plate
 
 global ZreturnPo s = 0;
 
 global Z_ProbeTo uch = function(distance,Ffeedrate,Sfeedrate,touchPlate,retracthight)
{
   if ( Ffeedrate <= 0 || Sfeedrate <= 0 || distance <= 0 || retracthi ght <= 0  )        // Axis needs to be 1 to 3 feedrate can't be 0
    {
      print("Error: Sfeedrate - Ffeedrate - distance - retracthi ght all need to be higher than 0 "); // error wrong axis number or no feedrate entered
      return -1;                             // exit probing
    }
   
  XstartPos = GlobalGet("Axis1CurP os");     // 1 = X save the x start position
    YstartPos = GlobalGet("Axis2CurP os");     // 2 = Y save the y start position
    ZstartPos = GlobalGet("Axis3CurP os");     // 3 = Z save the z start position 
   
   print("distance = ",distance);         // just a test will remove
   print("Ffeedrate = ",Ffeedrate);         // just a test will remove
   print("Sfeedrate = ",Sfeedrate);         // just a test will remove
   print("touchPlat e = ",touchPlate);      // just a test will remove
   print("startheig ht = ",ZstartPos);      // just a test will remove
   print("retracthi ght = ",retracthight);   // just a test will remove
 
   GlobalSet("ProbeInve rt",0);   // set probe to normal state = false
   
   Gcodestri ng = "G90 G31 Z-" + distance + "F" + Sfeedrate;      // gcode string G31, axis Z, distance, feedrate
   Engine.GC ode(Gcodestri ng);                          // probe  DRO distance down in Z
   block("MotionSti ll");                             // wait for all motion to stop, no system delay for this.
 
   if( !GlobalGet("ProbeHit"))                         // If probe not hit Error
   {
     print("No probe Hit..Ente r a Higher Travel Distance or may have missed part/touchoff plate.");  // no probe hit probe stopped to high, travel distance to small or missed plate
     Gcodestri ng = "G90 G01 Z" + ZstartPos + " F" + Ffeedrate;    // gcode string G01, Z, Zstart Position, fast feedrate
     Engine.GC ode(Gcodestri ng);                         // Return to Z start Position
     block("MotionSti ll");                                // wait for all motion to stop, no system delay for this.
     return -2;                                           // we didnt hit the probe during the move, exit probing with ERROR code
   }                                                   
 
     print("Probe Hit");                               // Great probe was Hit
     sleep(0.5);                                    // lets take a short nap
     GlobalSet("ProbeInve rt",1);                           // invert probe switch 1 = true
     ProbePos = GlobalGet("ProbePos2");                       // Z probe Save position to probepos
     Gcodestri ng = "G31 Z" + ProbePos + "F" + Sfeedrate;      // gcode string G31, Z, slow feedrate just a short distance
     Engine.GC ode(Gcodestri ng);                             // probe upwards slowly till switch releases
     block("MotionSti ll");                                // wait for all motion to stop, no system delay for this.
 
       if( GlobalGet("ProbeHit"))                         // probe released upward travel all good
       {
        Engine.Se tAxisPos( null, null, touchPlat e );         // now set Z position to touchoff plate thickmess or 0 if none
        yield();                                              // take a break
        sleep(0.5);                                           // and a nap
        Gcodestri ng = "G01 Z" + retracthi ght +" F" + Ffeedrate;  // gcode string G01, Z, fast feedrate to retract height
          Engine.GC ode(Gcodestri ng);                             // do the retract
        block("MotionSti ll");                                 // wait for all motion to stop, no system delay for this., 1,
        print("Z Axis Height set, probe complete." + retracthi ght ); // yes show message Probe completed and retracted to                           
       }
       else                                                      // Looks like probe not released don't know why but ERROR it
       {
        print(" Error in Ztouch Backoff" );                // probe didn't open don't know why
        return -3;                                   // Return ERROR message
       };
  ZreturnPo s = GlobalGet("Axis3CurP os");             // 3 = Z save the z start position 
  return 0;                                          // No errors probe done return 0
};        
 

// Find the center of X!, probe the Z first why we want to know the Z zero so the probe can
// start below the parts surface the probe will move half the parts langth plus over shoot
// then the probe will do a g31 probe move down to make sure the probe if off the parts surface
// if the probe is hit than enter a larger distance for X length, if hit the probe will
// rapid move up to Z start position and then rapid back to X start position. now enter a
// larger X distance. .
// We do the g31 move down so the probe doesn't get bent or broke, the Z stops if the probe
// isn't off the part, and travels to the entered distance below surface to start the X probe
// Then g31 probe movers back to parts edge when hit rapids back and g31 probes again saves the
// X position rapids back on X then rapids up to Z start position, now rapids back to X start
// position now rapids to X- and repeats all the preious moves.. saves the X- posistion
// now the part center is half the distance between X and X-, probe rapids up to Z start
// position and to parts new center and the Z dro is set to 0.
 
global  ZeroXCent er = function(ZDisDown,FastFeed,SlowFeed,TouchOffPlate,retractheight,belowpart,xlength)
{
  print("Find the X center ");
  if (FastFeed <= 0 || SlowFeed <= 0 || ZDisDown <= 0 || retracthe ight <= 0 || belowpart <= 0 || xlength <= 0)        // Axis needs to be 1 to 3 feedrate can't be 0
  {
   print("Below part " + xlenght);
   print("Error:  Z Distance Down - FastFeed - SlowFeed - retractHe ight - below part surface need to be higher than 0"); // error wrong axis number or no feedrate entered
   return;                                        // exit probing
  }

 XstartPos = GlobalGet("Axis1CurP os");     // 1 = X save the x start position
   YstartPos = GlobalGet("Axis2CurP os");     // 2 = Y save the y start position
   ZstartPos = GlobalGet("Axis3CurP os");     // 3 = Z save the z start position 
 
  // touch off Z first and retract then do the X move to the X -pos first
 ZTouchOK = Z_ProbeTo uch(ZDisDown,FastFeed,SlowFeed,TouchOffPlate,retractheight);
   if (ZTouchOK != 0)  // if not 0 must have errored
   {
    print("Zprobe Touch Error Exiting X Centering " + ZTouchOK); // Show Error
    return -1; // Exit with Error
   }

   // Z probe done with no errors now lets try X probing
  print("Zprobe Finished No Errors Now moving X " + xlength);            // No Error Continue Probing
  Engine.Ra pidTo((xlength / 2) + belowpart, null, null, null);  // move to half the part langth plus a little
  block("MotionSti ll");

  ZTouchOK = Z_ProbeTo uch(ZDisDown,FastFeed,SlowFeed,TouchOffPlate,retractheight);
   if (ZTouchOK != 0)  // if not 0 must have errored
   {
    print("Zprobe Must have hit top of part enter a Larger X length Aborting X Centering " + ZTouchOK); // Show Error
    Engine.Ra pidTo(XstartPos, null, null, null);  // move to half the part langth plus a little
    block("MotionSti ll");
    return -2;  // Exit with Error
   }

  // now we will start the X probe to parts first edge probe not hit
  GlobalSet("ProbeInve rt",0);   // set probe to normal state = false
   
  Gcodestri ng = "G31 X-" + xlength/2 + "F" + Sfeedrate;  // gcode string G31, axis Z, distance, feedrate move back twards part
  Engine.GC ode(Gcodestri ng); // probe  DRO distance X-
  block("MotionSti ll");

   if( !GlobalGet("ProbeHit"))      // If probe not hit Error
   {
    print("No probe Hit..Ente r a lower xlength to far off parts edge.");  // no probe hit probe stopped to high, travel distance to small or missed plate
    Engine.Ra pidTo(null, null, ZstartPos, null);  // move back to safe z height
    block("MotionSti ll");
    Engine.Ra pidTo(XstartPos, null, null, null);  // move Back to X start position
    block("MotionSti ll");
    return -2;   // we didnt hit the probe during the move, exit probing with ERROR code
   }

// X probe was hit so far so good
  print("X Probe Was Hit Retractin g Z then moving to X+ Postition");
    XNegPos = GlobalGet("Axis1CurP os");     // 1 = X save the x start position
  Engine.Ra pidTo(null , null, ZstartPos, null);  // Rapid to Z safe Height
  block("MotionSti ll");
  Engine.Ra pidTo(XstartPos, null, null, null);   // Rapid to X start position
  block("MotionSti ll");

// now move to X+ position for next probe
  Engine.Ra pidTo(-(xlength / 2) - belowpart, null, null, null);  // move to half the part langth plus a little
  block("MotionSti ll");

// now we will start the Z probe to to make sure we are off part
  GlobalSet("ProbeInve rt",0);   // set probe to normal state = false
   
  Gcodestri ng = "G31 X" + xlength/2 + "F" + Sfeedrate;   // gcode string G31, axis Z, distance, feedrate move back twards part
  Engine.GC ode(Gcodestri ng);       // probe  DRO distance X-
  block("MotionSti ll");                    // wait for all motion to stop, no system delay for this.

  if( !GlobalGet("ProbeHit"))      // If probe not hit Error
   {
    print("No probe Hit..Ente r a lower xlength to far off parts edge.");  // no probe hit probe stopped to high, travel distance to small or missed plate
    Engine.Ra pidTo(null, null, ZstartPos, null);  // move back to safe z height
    block("MotionSti ll");
    Engine.Ra pidTo(XstartPos, null, null, null);  // move Back to X start position
    block("MotionSti ll");
    return -2;   // we didnt hit the probe during the move, exit probing with ERROR code
   }
// X probe was hit so far so good
  print("X Probe Hit");
    XPosPos = GlobalGet("Axis1CurP os");     // 1 = X save the x start position
};

Gary
Logged
ArtF
Administrator
Hero Member
*****
Posts: 5666



View Profile
« Reply #334 on: August 02, 2019, 09:55:22 PM »

Gary:

 Ill check the code, I may have length limits on the script screen, though I
didnt think I did... Ive never hit one, but I probably havent tried one that long..

Art
Logged
ArtF
Administrator
Hero Member
*****
Posts: 5666



View Profile
« Reply #335 on: August 03, 2019, 08:02:02 AM »

Gary:

 Can you attach that script as a file, I cant copy from the editor, it adds spaces and such and makes it impossibl e to run without a lot of debugging ..

Art
Logged
gburk
Sr. Member
****
Posts: 319


View Profile
« Reply #336 on: August 03, 2019, 11:52:49 AM »

Art

can do, I have figured out a work around for now, I worked on the scripts yesterday and created a lib for each function a lot of lib's but they seem to compile this way with no errors...

will upload later..

Gary
Logged
gburk
Sr. Member
****
Posts: 319


View Profile
« Reply #337 on: August 03, 2019, 12:09:13 PM »

art

here is the file..

I did find one thing, as is it the file errors for me but if I remove all the rem // lines before the second function it compiles fine, also if I leave the rem// lines and remove 6 or 7 lines at the end of the function it complies, it really seems to me there is a limit to how many lines will compile.. .

gary

* script.zip (2.69 KB - downloaded 50 times.)
Logged
ArtF
Administrator
Hero Member
*****
Posts: 5666



View Profile
« Reply #338 on: August 04, 2019, 04:52:31 PM »

Thx Gary:

 Ill check it out

Art
Logged
ArtF
Administrator
Hero Member
*****
Posts: 5666



View Profile
« Reply #339 on: August 04, 2019, 05:24:06 PM »

Gary:

 Found it. Limit was 9999 character s, I have increased it by a factor of 10,
I will do a release of the new version by next weekend.

Art
Logged
gburk
Sr. Member
****
Posts: 319


View Profile
« Reply #340 on: August 04, 2019, 07:11:56 PM »

art

if you have time and could check why the g code rewinds on the first m6 before you post the new update..

Thanks gary
Logged
ArtF
Administrator
Hero Member
*****
Posts: 5666



View Profile
« Reply #341 on: August 04, 2019, 07:55:47 PM »

Gary:

 Ill see if I can duplicate that again.

Art
Logged
gburk
Sr. Member
****
Posts: 319


View Profile
« Reply #342 on: August 06, 2019, 03:35:01 PM »

Art

Trying to get PWM spindle running correct.

I get the spindle and relays to turn on forward and reverse, but I need to set the S to over 700 or 800 before the spindle will start to spin
so any suggestio n as how to tune it or do you think the KB spindle speed controlle r pots will need adjustmen t...

It works fine in manual mode turning the manual speed pot.
I don't want to mess that up trying to tune the KB pots and messing up manual mode..
do you think I will mess manual up messing with the adjustmen t to get PWM from pokeys working better?.

 Thanks gary
Logged
ArtF
Administrator
Hero Member
*****
Posts: 5666



View Profile
« Reply #343 on: August 06, 2019, 08:05:17 PM »

Gary:

 
You will need to scale it for proper use. The number you send to
the SetPWMDut y call is 1.0 for full speed.
If you script in the test window and do a Motion.Se tPWM(n, 1.0)
where n is the channel, does the spindle go full speed?
 Does SetPWM(n,0) slow to a stop? When you set duty to 1.0,
the PWM should now be running at 100%.  You then measure
actual spindle speed, and in your spindle script on the S call
you would set the PWM to a scaled amount... as in

 float duty = CalledFor Speed / ActualRec ordedMaxS peed;
SetPwmDut y( n, duty ).

  so if you had a S5000 call, the script would calculate

float duty = 5000 / 20000;
SetPwmDut y( n, duty ); //which would set it to 25% with .25..

  So the question is, what do you get with a SetDuty to 1.0
or 0.0, that should be max and min of the pwm output. There are many ways
to do a scaling, some linear, some not, but you need to make sure the PWM
is actually having the proper effect first at 0 and 100%. If you have a voltmeter
at 100% it should read full voltage out for that pwm channel. See what you get as
outputs with those tests..

Art


Logged
gburk
Sr. Member
****
Posts: 319


View Profile
« Reply #344 on: August 07, 2019, 10:53:36 AM »

Art

here is the voltage results I am getting out to the Mill from pokeys

I started at S300 = volts .590
S400 = .758 no spindle running yet
S500 = .928 no spindle yet
S600 = 1.101 no spindle
S700 = 1.283 spindle starts to turn checked with dig tach RPM = 150-152
S800 = 1.426 RPM = 350-355
S900 = 1.638 Didn't check RPM
S1000 = 1.817 RPM = 760-770s

zerotohun dred = (speed / Maxspeed) * 100;
this is the way I am getting the pwm value
speed = M3 S value
MaxSpeed = the max RPM allowed its read from a DRO that I entered the value 3500 MaxSpeed=3500.

I'm not good at math..

I also tried this with mach4 and ESS Smoothste pper with almost the same results..
So I assume I may need to adjust the KB pots max and min, I just don't want to mess up the manual control..

Hope this helps..

Gary
Logged
Pages: 1 ... 21 22 [23] 24 25 ... 39
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!