reading Pokeys pins

C Scripting questions and answers
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Thanks art

The pecking has been a problem with me I keep finding new problems I think I fixed a couple more here I a new peck a also changed the sleep time..
and if the cam program put a -0.1 I was loosing the 1 so would not peck with the 0 value losing values after the decimal..
removed the yield... do you think I should remove the stop program also ?

//G888 P.25 H1 R.2 I10
// M888 = Peck drilling Call with G888 H = Depth to drill R = retract hight P = Peck distance I Feed Rate
global GCode888 = function()
{
  HoleDepth = ParmsH[0];
&nbsp; if (HoleDepth< 0)
&nbsp; {
&nbsp; HoleDepth = math.abs(HoleDepth);
&nbsp; }
//ok pos value lets do so pecking
&nbsp; print("Peck Drilling ");
&nbsp; for( pecking = 0; pecking <= HoleDepth; pecking+=ParmsPRI[0])
&nbsp; {
&nbsp; &nbsp; if (pecking + ParmsPRI[0] > HoleDepth)
&nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; pecking = HoleDepth;
&nbsp; &nbsp; }
&nbsp; print(" Pecking Z = "+pecking);
&nbsp; Engine.GCode("G90 G01 Z-"+pecking+" F"+ParmsPRI[2]);
&nbsp; block("MotionStill");
&nbsp; Engine.GCode("G90 G01 Z"+ParmsPRI[1]+" F"+ParmsPRI[2]);
&nbsp; block("MotionStill");
&nbsp; lastpos = pecking;
&nbsp; sleep(.5);
&nbsp; };
&nbsp; print("Finished pecking to the depth of "+lastpos);
Engine.StopProgram();
};

Thanks gary
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Art

Tested new version Only main thing I see is when the g code file is loaded the G888 scripts seems be run also while the g code loads..

I uploaded The same g code file but did a little more on the post, so it should now have the X and Y moves before the peck starts..

Also I am not sure what I had changed while testing but I was getting the g code to display the paths but I lost it now no path display, but seems to run ok..

Thanks gary
Attachments
XballscrewmountFinal4.zip
(1.36 KiB) Downloaded 277 times
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4648
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Gary:

>>do you think I should remove the stop program also ?

&nbsp; The stop program only tells the program to stop and wait for a press of run after
the peckdrill. It should be its only effect.

>>G888 scripts seems be run also while the g code loads..

&nbsp; Did you mean it was actually moving the axis while loading? or just printing the messages?
All Gcodes have to run while loading, but in simulation, there should be no axis motion, but
any Gcode used will execute in sim as it has to to make the toolpath display properly. Each Gcode
file is parsed twice to create a toolpath and setup subroutine locations and such. There shouldnt be
any motion though...but if you print in the script, that will print.



Art
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Art

I went back and tested in motion mode and yes the Z axis was pecking while the G code file was loading...
That's if the estop was set if estop was off it only printed the pecking messages..

Thanks gary
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4648
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Thanks Gary:

Ill fix that up right away..

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

Re: reading Pokeys pins

Post by ArtF »

Gary:

Version h is online, GCodes cannot now initiate motion during load.
It was already in effect for most other items, just missed that one.
Hadn't had GCode capability in the scripts till now.

Art
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Art

Good JOB No more pecking when g code loading...

Did you look at the pecking script do you think I should do anything different, I was thinking to except a positive or neg number and remove the Z- form the engine gcode ? I'm not a good programmer just hacking my way though and making a mess of things, but you get to fix the hard stuff.&nbsp;

Also have you looked at the g code file and have any idea why it doesn't display the tool path, is it the G888 messing it up..

Thanks gary
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Art

Don't know what I did but the display seems to be working now&nbsp; ???

When I first boot auggie and load a g code file then hit run it seems to do a m6 right away my dialog runs and I hit X end exit the code runs to the first M6 and runs my dialog again... a little strange but only happens on the first run its ok if I load a different g code and run it or stop and run same g code again..

Thanks gary
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4648
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Gary:

&nbsp; Thx, Ill do a few test runs. Your getting closer anyway, at least these bugs are
slowly going away. Ive found a few more small ones along the way as well for
next release. Laser didnt stress Auggie the way trying general cnc does it seems.


Art
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Art

I am guessing you weren't planning on cnc milling with auggie, jest got lucky and stumbled across a pain in the BUTT like me...
Do have more request but will give you a little break...

Gary
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Art

I am lost on the spindle setup

It looks like the 0-10volt is on PWM5 Pin 17&nbsp; I assume its needs this - SetPWMDuty_1(5,0) - to get going but how does it know pin 17 or is pwm channel 5 all that needed and is connected to pin 17, and what would be the max output value to get 10volts ?
if the max RPM was say set to 3000.
or am I way off base and need to approach it differently Math is my weakest subject..

Thanks gary

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

Re: reading Pokeys pins

Post by ArtF »

Gary:

&nbsp;The Pokeys controls that voltage with PWM from 0 - 100%. Usually the Spindle is
controller by just that 0 - 100% setting.

&nbsp;So to calibrate such a setting.. you set it for 100% and measure the spindle speed. You then
know 100% is ..say 20,000RPM. So then youd script it to put out an error if the requested
rpm is greater than 20,000 or just set 100%, other wise youd set the PWM
to a percentage reflecting the request. So

newpwm = (requestedRPM / 20000.0) * 100.0;

&nbsp;That RPM would be a simple linear responce curve. One could get more complex I guess.
If you look in the library youll see I use a PWM channel for laser power, in the TestFire
library function it fires the laser with the sliders power for a set time. Youd setup
your Pokeys so a particular channel controls the 0-10volts.
&nbsp;You can test it just by using the script tab and sending PWM commands
to set various voltages. Then just set the pwm commands into the
SetSpindleSpeed script..

Art

Last edited by ArtF on Tue May 21, 2019 3:09 pm, edited 1 time in total.
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Art

Ok Still lost in space..
In the pokeys configuration the pwm is set to pin17 (pwm 5)
Pdm period 50 and set to (us)

You have a few different scripts with the global SpindleOn() it looks link if I run SpindleOn() in the script window its turning on OC #5 that is in SpindleLib-RelayOnly
I did change it to #5 so I do get the message Relay spindle was turned on OC #5. and I left the other scripts as they were..
If I hit the fire button I get the message spindle not turned on
So to get it to turn on and fire I have to change the&nbsp; if( Engine.GetSpindleState() == 0 ) to == 1 now the auto on led lights and I get the message
Firing Test: Power and the time, when I press the fire button, but I get no voltage change on pin 17...
I also tried changing global LaserPWMChannel = p.GetInt("Channel",5); to #5 is this correct...?

If I don't change anything and hit the fire button I see the onboard led for OC #4 light up...
But the is no OC led for PWM 5

Also I am running your default laser screen and have all my scripts turned off...

So Like you see i'm lost and most likely on the wrong path here..

Most likely getting you confused as well..

One other thing I see Axis 5 Dro moving when I hit fire and keeps running...

Thanks gary



Last edited by gburk on Fri May 17, 2019 1:29 pm, edited 1 time in total.
gburk
Old Timer
Posts: 324
Joined: Sun Nov 25, 2018 3:57 pm

Re: reading Pokeys pins

Post by gburk »

Art

When I turn on the spindle I get the message channel 5 axis 5, this is confusing as far as I can see in your scripts its set to channel 4 axis 8..

and axis 5 starts running I don't see anywhere in the laser scripts that has this print message, so not sure where this channel and axis are being set I don't seem to be able to change it...

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

Re: reading Pokeys pins

Post by ArtF »

Gary:

In my laser spindle script, I have

p = Profile("rtPWM");
global LaserAxis = p.GetInt("Axis",8);
global LaserMaxPower = 100;&nbsp; //max power = 100%
global LaserPWMPeriod = p.GetFloat("Period",.0002); //for 5khz tickle&nbsp;
global LaserPWMChannel = p.GetInt("Channel",4);
//get a pokeys link for the spindle
global SpindleControl = Motion();

&nbsp; &nbsp; This means the system starts up with getting these data items from
the profile under the heading rtPWM. The declaration as in

global LaserAxis = p.GetInt("Axis",8);


&nbsp; Means to set the LaserAxis to whatever is stored in the profile,&nbsp; and
to use 8 as the axis is nothing has ever been set. The 8 is just a
default though. To change it it this type of use you can
simply change my declarations to

LaserAxis = 8; for example. It may be in your profile its stored as
a 5 and so doesnt use the 8 as default. Same thing with Channel
and such, they have defaults, but if set in the profile they can differ.

(You can open your profile, its just text and see if there are entries
for those variables unless you intend to use your own globals.).

Art


Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest