GearHeads Corner
December 14, 2019, 09:24:24 PM *
Welcome, Guest. Please login or register.

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


View Profile
« Reply #300 on: July 07, 2019, 09:15:20 AM »

Art

It was failing when I added the code line the hitting RUN...

So of course it was bugging me all night, so first thing this morning I decided to delete the script file..
I then entered one tool change function at a time, it has a little less code per function now, and all 16 tool functions are working,,
don't know what will happen as I add more code to each function but will find out later...

anyway it does seem to be working now, i'm thing maybe some sort of a glitch somewhere in the code not one I was able to see
spent a lot of time on till I decided to delete old file and start again

You didn't mention if you thought that I would be alright running with the dos's not running to the values I entered 2 seems to stop at 1.994 does it with all the axis's
but if I enter for it to return to 0.0 it doe's ok

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


View Profile
« Reply #301 on: July 07, 2019, 07:54:16 PM »

Art

It was working then I went to add or modify the code, if I check back in the lib I see no errors in the lib, but if I edit the lib and do a RUN I get compile erorrs

If I hit the tool1 button it runs OK except the machine and work cord seem messed up now if I set the dro's to 0 and them run the script, I added a print to show the start x y z axis positions i am getting them with GetAxisPo s(1 2 and 3) I don't get a 0 value I will get what seems random values one time I will get 0.033 but I don't get 0 even though the DRO's are set to 0

My thought is because I am getting the compile errors problem is I don't see anything wrong, only seems to happen after adding or editing the script, but once it starts I have to redo the entire script..

Do you think I should break up the tool chance script into 3 or 4 separate scripts, there is 16 functions in the script. I haven't tried that yet maybe next thing to try.

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



View Profile
« Reply #302 on: July 07, 2019, 08:51:41 PM »

Gary:

 Breaking it up will probably get it to run. I will check into the GetAxisPo s
to see what the error may be. Ill see if I can figure out why the limitatio n as well,
though I may not be able to do much on that score..de pends on its cause.

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


View Profile
« Reply #303 on: July 08, 2019, 09:26:36 AM »

Art

Update
I deleted the entire script and folder..
Started from scratch..
Now tool1 seems to be working getting the correct Positions values the only thing I see is I do a Gcode  or Rapid move on x y z then I do FreeTo
when it does the free move I get the message buffer underrun. . still seems to jog to the correct value though. and now returns to 0..
Still stops a little short of the distance entered seem to be the same every time

if I enter 2.0 axis go's to 1.9994 same for all axis's off just a tad..

I think a lot of the problems are from the scripts getting corrupted don't know why, have typed in some code into notepad++  and copy and pasted into auggie
just a thought..

I have had to redo the tool button scripts from scratch 3 or four times now confused as to why, I did split the tool change into two lib scripts one with tool 1-8 and the other with toll 9-16 will see how that go's..

The getaxispo s is ok I think when the script gets corrupted it for some reason messes that up also..

Thanks gary
« Last Edit: July 08, 2019, 05:02:50 PM by gburk » Logged
gburk
Sr. Member
****
Posts: 298


View Profile
« Reply #304 on: July 09, 2019, 07:21:44 PM »

Art

Have a spindle problem, not sure if is me or something internal,

If I do a M3 S3000 the spindle and relays turn on as expected. . and the speed is ok.

Now if I do a M3 S0 it seems to mess up it looks like auggie is calling all the M3 functions over again, turning on relays again, and I get the message spindle turned on it should be turned off I have gone though the code and when I get the spindle speed = 0 I call the spindleof f() function it seems to turn off the spindle and relays but then it looks like it starting the M3 again and turning on the relays

M5 Works fine everythin g turns off.. Only problem is M3 with a value of 0.

not sure if i'm being clear?.

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



View Profile
« Reply #305 on: July 09, 2019, 08:02:58 PM »

Gary:

  I think you'd have to add to the SpindleOn script a check of the speed, and if
its zero, just turn it off. I suspect auggie is getting fooled by the m3s0 and not
really knowing what to do. I dont think m3s0 is a typical command, though I can
see where it would have it uses.

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


View Profile
« Reply #306 on: July 10, 2019, 08:51:38 AM »

Art

Yes I already had a check for 0 if speed = 0 then SpindleOf f() it just reacts weird to m3 s0 its fine if m3 is >0 it runs the relays and spindle as expected. .

But if I enter a m3 s3000 all is good then if I enter another m3 with s0 is when it messes up.

I have nothing in the code for it to do anything other the relays and spindeoff with m3 s0.,,

Thats why I am thinking if you already sent an m3 s-speed, then another one m3 s0 the second m3 seems to rerun the m3 from the beginning  and not just change the speed... I attached the script..

Gary

* Spindle.zip (1.56 KB - downloaded 11 times.)
Logged
gburk
Sr. Member
****
Posts: 298


View Profile
« Reply #307 on: July 10, 2019, 02:46:36 PM »

Art

Did some more messing around with the m3 calls
best I can tell auggie calls, gobal SetSpindl eSpeed = function( speed ) is called first, I put a print statement in that function also a sleep(10)
I also put a print statement in global SetSpindl eState = function( state ) and a sleep(10).

it printed the print from gobal SetSpindl eSpeed = function( speed ) but the sleep didn't seem to have any affect there.. it printed the print from SetSpindl eState = function( state ) with no delay at all, but it did sleep after the print in SetSpindl eState = function( state ).

So it looks like every time a m3 is called it runs both functions so endless i'm not getting this, and i'm probably not, is if a m3 s200 is call the fist m3 call its good
Now if I call it again m3 s0 or any value it auggie is calling both functions again, so  the  SetSpindl eState = function( state ). is calling spindleOn again and it does set the speed to 0 but it is messing up the relays, that are set with the first  spindleOn call...

let me know if you get what I'm trying to say a little confusing

New update

made a few changes seems like it may work here is some of the code let me know if you think its Good or if I may have a problem with it somewhere down the road.
still have the long delays but seemed to do what I expected now..

global MySpindle Output = 5;
global MySpindle Axis = 5;
//global SpindleMO DE = 0;
global SpindleDe vice = Motion();
 
//Sets the Spindle speed, triggered by S3000 fo example
global SetSpindl eSpeed = function( speed )
{
    print("first speed");
    SpindleSp eed( speed );
};
 
//Set Spindle State.
global SetSpindl eState = function( state )
{
    if (SpindleMO DE == 0 || state == 0)
    {
    //1 = CW, 2 = CCW, 0 = off
    print( "Setting Spindle with " + state);
    sleep(10);
    switch( state )
    {
        case 1: {  if( lookup("SpindleOn")) { SpindleOn( ); }; }
        case 2: {  if( lookup("SpindleRE V")) { SpindleOf f( ); }; }
        case 0: {  if( lookup("SpindleOf f")) { SpindleOf f(); }; }
    };
   }
};
 
 
global SpindleOn = function()
{
    global SpindleMO DE = 1;
    FreeSetSp eed( MySpindle Axis, GlobalGet("SpindleSp eed")); //turn on spindle
    print("Frequency Spindle was turned on");
    print("Set to Frequency " + GlobalGet("SpindleSp eed"));
};   
 
//this is a relay spindle control,
//it will use only the OC output #1
//to control a relay to turn a simple
//on/off spindle, on or off.
 
global SpindleOf f = function()
{
    //FreeSetSpeed( MySpindle Axis,0); //turn off spindle
    print("Spindle speed zeroed turned off");
    global SpindleMO DE = 0;
   
}; 
 
//this is a relay spindle control,
//it has no speed control but this dummy
//routine will stop any error, and maybe
//test for zero speed.
 
global SpindleSp eed = function( speed )
{
    print("Entering SpindleSp eed function "+speed);
     sleep(10);
     if( speed != 0)
     {
      Maxspeed = GlobalGet("MAXspindl eSpeed");    // Max spindle speed
      zerotohun dred = (speed / Maxspeed) * 100;   // Get PWM5 value to set the spindle speed 0-100 for 0-10 volts
      SpindleDe vice.SetP WM( MySpindle Output, zerotohun dred  );
      print("Spindle Speed set to " + speed );
     }
      else
      {
      SpindleDe vice.SetP WM( MySpindle Output, 0 );
      print("Spindle Speed set to " + speed );
      };
};   

Is there a way to check to see if when sending an m3 if the S is sent also, from what I can tell if no S code sent its doesn't call the spindle speed function
but it still calls the spindleon with no speed setting so I can't check for 0 speed...
 

Gary

« Last Edit: July 10, 2019, 06:01:01 PM by gburk » Logged
ArtF
Administrator
Hero Member
*****
Posts: 5477



View Profile
« Reply #308 on: July 11, 2019, 11:52:54 AM »

Gary:

>>You didn't mention if you thought that I would be alright running with the dos's not running to the values I entered 2 seems to stop at 1.994 does it with all the axis's
but if I enter for it to return to 0.0 it doe's ok


  Yes, thats fine, its not unusualy to stop just short of a step. So you probably are
using 166.6 steps per inch or mm.. Mach3 does the same, it knows internall y where you are
as a number of steps, not a position really.

Im still reading your scripts, but the command m3 literally means turn
on spindle while S means set speed. Typically you turn it on and then only use
S commands to change the running speed. So M3S0 wouldnt be quite the same as
M5 as a stop. Speed is set first when command are on one line, this is just a priority
thing and the spindle speed has higher priority than spindle on.

  Now when you call M3, the spindle is set to on, then your script is called.
If the M3 is seen again it does the same. Now I could change this internall y
so that if M3 is called when the spindle is already running, the M3 could
be ignored. The S command will still work, you dont need an M3 before
every S command, just for the first turn on.

  That may be the best way around it.

Art


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


View Profile
« Reply #309 on: July 11, 2019, 12:42:25 PM »

Art

Thanks I think I may have it figured out, not being a programme r I sometimes get lost in the logic maybe most of the time.
Anyway with a few global var, placed in the right spots I do have it running fine...

Now that I when from testing m6 to m3 I see that the g code I sent you has no S commands only m3 so spindle turning on but not moving..

So I had to edit cambams post again re ran it an now I have m3 S3000 in the g code,

I ran the g code it was looking good all relays turning on and off spindle flood exc.. tool change dialog also..

But seems like cambam left out the m8 after doing the two dill pecks cycles. so when it started to run the pocket holes no flood strange not sure if I can fix that in the post..

anyway seems like I got the m3 m4 m5 scripts going ok.. tool change seems ok also, so maybe I can clean them up a little now...

I'm sure I will have more questions, we came a long way..

Thanks again Gary
Logged
gburk
Sr. Member
****
Posts: 298


View Profile
« Reply #310 on: July 11, 2019, 01:40:28 PM »

Art

Just an update I was able to get the m8 working right with cambam now...

But one problem, still having the m6 called twice on first run...

if I run stop and run the g code again its fine, seems only when the code is first loaded then run to runs the first m6 t twice..

Do you think the buffer underrun I get when running the freeaxis's will be a problem?..

told you I'd have more questions ..

do you want a new copy of the g code its not much different other than m8 is where it should be and m3 now has the S in the g code..

Also I don't think I ever mentioned this but 98% of the time when I shut auggie down it close's them reboots it's self..

Gary
« Last Edit: July 11, 2019, 05:11:58 PM by gburk » Logged
ArtF
Administrator
Hero Member
*****
Posts: 5477



View Profile
« Reply #311 on: July 11, 2019, 07:50:50 PM »

Gary:

>>if I run stop and run the g code again its fine, seems only when the code is first loaded then run to runs the first m6 t twice..

  Ill continue to try to find that one, I have seen it occur, just not repeatabl e for me for
some reason.

>>Do you think the buffer underrun I get when running the freeaxis's will be a problem?..

  Hard to say. Buffer Underrun means for some reason the system ran out of data
from a planner. OR it may feel its out of position, so let me know if you see
ill effects, as your doing mill work your stressing the program more than most
of us with lasers.

>>Also I don't think I ever mentioned this but 98% of the time when I shut auggie down it close's them reboots it's self..

  Sign of an internal memory fault as it shuts down, Some windows will restart the
program in such an event, others wont. I suspect the scripting has some dangling
memory at times, and as it trys to delete it at shutdown it creates a memory
fault. Doesn't matter at that point really, but windows see's it as an error and
restarts if the group policy tells it to.

Art




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


View Profile
« Reply #312 on: July 13, 2019, 04:13:18 PM »

Art

I don't think there is much going on when I run freeaxis all other motion had stopped.., so far I haven't seen any problem with the buffer underrun message..

I have a pokeys board question don't know if you will have an answer...

I ended up putting 2 more relays in so if I wanted to switch from pokeys control to manual,  so the switch and relays turn on the spindle and forward relays but of course there still connected to the plugs in the pokeys relays.. so if there is no power going to the pokeys and I turn on the manual relays it seems to power up the pokeys I assume it is feeding back somehow though the pokeys relays and powering the pokeys board do you think it should back feed power to the pokeys and the pokeys power up like normal..  I know weird question if its there or not I will make it happen..

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


View Profile
« Reply #313 on: July 17, 2019, 01:01:22 PM »

Art

Have a question about reading and writing to files,
How can that be handled with a script, I tried a few ways I have done it in c++ and c but not having any luck getting it to work..

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



View Profile
« Reply #314 on: July 17, 2019, 08:08:43 PM »

Gary:

 Script commands do exist for several file interface commands
in script. What kind of file are we talking.. . text, binary, data, gcode?
 

Art
Logged
Pages: 1 ... 19 20 [21] 22 23 ... 38
  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!