Re: getting the 57cnc to work with G540

Discussions and file drops for Auggie
GlennD
Old Timer
Posts: 80
Joined: Tue Oct 18, 2011 4:19 pm

Re: getting the 57cnc to work with G540

Post by GlennD »

it should go in the scripts library under Gcode then SpindleLib-RelayOnly it should be checked and the Gcode should be checked.

I think the 45,1 in the SpindleOn function should be 45,0 from the notes.

Glenn
Attachments
spindleLib.PNG
DanL
Old Timer
Posts: 362
Joined: Wed Sep 10, 2014 1:35 pm

Re: getting the 57cnc to work with G540

Post by DanL »

thanks glen it's probable that is what is wrong going by art's not the code should be correct I just put it in the wrong place

thank you
DanL
Old Timer
Posts: 362
Joined: Wed Sep 10, 2014 1:35 pm

Re: getting the 57cnc to work with G540

Post by DanL »

Art I have run into a problem, with glens help and me not reading what you said as do in that library,my bad I have done another library for the superpid just using the code out of the spindle relay only, and putting the changes what you said to do in it, I compile it comes up with no issues then I run it no problem's then when I go to check it back in it comes up with, no cntr Selected to update.

here is what I did

Code: Select all

// Library SpindleLib-RelayOnly 
// Created  Friday, January 22, 2016 
// Author  Art       
  
// number of the OC "Open Collector output"
//on the pokeys that will trip a relay 
//for spindle ON/OFF 
global MySpindleOutput = 1;
global SpindleDevice = Motion();   
   
//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 SpindleOn = function()
{
    SpindleDevice.SetPinDig( 45, 1);
    //SpindleDevice.SetOC( MySpindleOutput, 1); //turn on spindle
    print("Relay Spindle was turned on with OC#" + MySpindleOutput);
};   
 
//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 SpindleOff = function()
{
    SpindleDevice.SetPinDig( 45, 0);
    //SpindleDevice.SetOC( MySpindleOutput, 0); //turn on spindle
    print("Relay Spindle was turned off");
    print("using OC #" + MySpindleOutput);
};  
 
//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 SpindleSpeed = function( speed )
{
  //if an S000 is set, then turn the thing off
  if( speed == 0 )
  {
    SpindleDevice.SetPinDig( 45, 1);
    //SpindleDevice.SetOC( MySpindleOutput, 0); //turn on spindle
    print("Relay Spindle was turned off");
  };
 
};   
MaynardC
Old Timer
Posts: 35
Joined: Wed Feb 27, 2013 4:28 am

Re: getting the 57cnc to work with G540

Post by MaynardC »

Did you use the "Lib" dialog box to check the script back in with. If you check it out with the Lib, you need to check in back in with the "Lib" dialog. Same with the the debugger checkout.

Maynard
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4593
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: getting the 57cnc to work with G540

Post by ArtF »

Dan:

  You can check in a library only if its a complete library file, it must have the name header and such in it. So
create a new library first, then check it out. Modify it with your code, and then check it in .

  I cant find a message "no cntr Selected to update" in the program, can you check and see exactly what the message
is and Ill tell you why it occurs. It sounds as if your very close but are missing some syntax or routine, let
me know what youre getting and we'll trace it. Ill be away this morning, but this afternoon Ill write a description
of what may be happening..

Thx
Art


MaynardC
Old Timer
Posts: 35
Joined: Wed Feb 27, 2013 4:28 am

Re: getting the 57cnc to work with G540

Post by MaynardC »

It's what you get if you open a library in the scriptor, and try to check it back in via the check box on the scripting toolbar. :)





Attachments
Capture.PNG
Ya-Nvr-No
Old Timer
Posts: 188
Joined: Wed Sep 08, 2010 11:15 am

Re: getting the 57cnc to work with G540

Post by Ya-Nvr-No »

Yes I had noticed that too if I used one of the three buttons.
But the place to check them back in is under the Library button, same dialog screen you checked them out with.
Attachments
libfault.JPG
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4593
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: getting the 57cnc to work with G540

Post by ArtF »

Ahh yes, I see.

There are 2 classes of scripts. Screen Scripts, and Library scripts. You check in the library scripts by using the LIB
button only. Ill explain that better in a future video. :)

Art
DanL
Old Timer
Posts: 362
Joined: Wed Sep 10, 2014 1:35 pm

Re: getting the 57cnc to work with G540

Post by DanL »

that was the problem thank you gents, now to see if it works.
DanL
Old Timer
Posts: 362
Joined: Wed Sep 10, 2014 1:35 pm

Re: getting the 57cnc to work with G540

Post by DanL »

it's still not working it does not come up with any error.

Code: Select all

// Library SpindleLib-SuperPid 
// Created  Saturday, February 27, 2016 
// Author  Daniel       -- Do not edit above this line
  
 //  Enter Global vars below this line. 
//  the librarian no matter where they are, but its easier 
//  to find and edit them in one spot.
   
   
   
 //The 6 lines previous to a function will appear as  
 //comments to help users to understand the parameters   
 //required for use by each function, so try to   
 //always add as clear a set of instructions in these  
 //lines as an aid to fellow travellers.   
 //                                              
  // ex: global mylibfunc = function(x,y,z);  
   
//for spindle ON/OFF 
global MySpindleOutput = 45;
global SpindleDevice = Motion();   
   
//this is a spindle control, 
//it will use only pin 45 output
//To turn A spindle on/off
 
global SpindleOn = function()
{
    SpindleDevice.SetPinDig(45,0);//turn on spindle
    print("Spindle was turned on" + MySpindleOutput);
};   
 
//this is a spindle control, 
//it will use only the output #45
//to control a on/off spindle.
 
global SpindleOff = function()
{
    SpindleDevice.SetPinDig( 45, 1); //turn on spindle
    print("Spindle was turned off");
    print("using pin 45" + MySpindleOutput);
};  
 
//this is a spindle control, 
//it has no speed control but this dummy
//routine will stop any error, and maybe
//test for zero speed.
 
//global SpindleSpeed = function( speed )
//{
  //if an S000 is set, then turn the thing off
 // if( speed == 0 )
 // {
   // SpindleDevice.SetPinDig( 45, 1);
    //SpindleDevice.SetOC( MySpindleOutput, 0); //turn on spindle
   // print("Spindle was turned off");
 // };
 
//};   
   
 
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4593
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: getting the 57cnc to work with G540

Post by ArtF »

Dan:

Does it say in the log and on the toolpath screen

"Spindle was Turned on"

and

"Spindle was turned off"  ??

  Lets go from there...

Art
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4593
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: getting the 57cnc to work with G540

Post by ArtF »

Dan:

The Docs for the SuperPID seem to show it needs an opencollector drain to turn it on ..

Pin 45 may not be suitable. Id use either the relay.. OR OC1, just as the default spindle was set up for.
Youd connect your RUN wire from the super PID just to OC1 on the board. This also means youd see the LED to show
if its on or off...

Art
DanL
Old Timer
Posts: 362
Joined: Wed Sep 10, 2014 1:35 pm

Re: getting the 57cnc to work with G540

Post by DanL »

OK I will try that
DanL
Old Timer
Posts: 362
Joined: Wed Sep 10, 2014 1:35 pm

Re: getting the 57cnc to work with G540

Post by DanL »

it worked
DanL
Old Timer
Posts: 362
Joined: Wed Sep 10, 2014 1:35 pm

Re: getting the 57cnc to work with G540

Post by DanL »

it turn's on or off, but run's at full noise.

now for the pwm control on pin 20 pwm 2 do I put the changes into the Library MotionIO at the bottom it has Pokeys1.SetPWM( channel, duty); so channel will be 2 duty not sure.

and Pokeys1.SetPWM( period ); period would be 20ms

I got 20 from the pokeys config if I set 20ms in the pwm bit it has that it is  50.00 Hz

I will try this anyway and take a guess at what duty should be
Last edited by DanL on Sat Feb 27, 2016 11:25 am, edited 1 time in total.
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests