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 »

Art

I have ran it many times now, and not seeing any feed rate problems..
Will let you know how things look when i get the back off's working in the x and y, have it going in z will test x y tomorrow, I think the code I added for back off's is right, but you know how that go's.

>>
>> I guess one way is to check the pin status to see if its hit, I repaired that as well so if you ask
>>the digital level of that probe pin you should get the right answer, it was broken but now reports
>>if the pin is high or low.

forgot to reply to this, what i have been doing is testing pin19
    pinstate = Pokeys1.GetPinDig(19); 
    //print("Pin 19 Changed");
    GlobalSet("ProbeLED",1);
    block( "MotionPin19");
not the complete script but as far as i know it has not stopped working, i only use it to toggle the probe hit LED on or off..

is there a better or faster way ?.



Thanks
Gary
Last edited by gburk on Sat Nov 09, 2019 2:14 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

I seem to be having another small issue i can't figure out

right now it the bore or hole probe

I have an 1.5" hole i set the bore size to 1.5 this probe's and centers great every time and ZERO's the axis's
I also tried a .75 hole also worked fine every time.

but if i have one that is to .5 or below after it centers a axis it should Zero it, but this is a hit or miss, it seems to always move to the center but doesn't set the axis to Zero
its random sometimes it doesn't zero the X and sometimes i't's the Y.
I tried a pause before setting the axis to Zero
also tried both  Engine.SetAxisPos( 0, null, null, null );  and GlobalSet("Axis1CurPos",0);  or Axis2 get the same results.

This one is real strange don't know why it messes up on the smaller holes...

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

Re: reading Pokeys pins

Post by ArtF »

Gary:

    pinstate = Pokeys1.G etPinDig(19);
    //print("Pin 19 Changed");
    GlobalSet("ProbeLED",1);  // I suspect you meant ", pinstate" rather than ,1?

  No, looks good.

>>but if i have one that is to .5 or below after it centers a axis it should Zero it, but this is a hit or miss, it seems to always move to the center but doesn't set the axis to Zero

  Strange symptom. Does the zero button work afterwards to set the zero?

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

Re: reading Pokeys pins

Post by gburk »

Art

I think i figured it out for now, i'm thinking the smaller the hole maybe its moving things to fast and loosing track, just a thought

I never thought to lower the feed rates, they were set at 10 slow probe and 40 for g01 moves, that works good for the holes larger than .5 or so
So i lowered the feed rates to 5 for slow probe and 20 for g01 moves and this seems to have fixed the problem Axis's get set to Zero correctly at these feed rates..

I think you can kill the print's to screen now also.

Gary
Last edited by gburk on Sun Nov 10, 2019 1:15 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

xx = Engine.GetAxisPos(3); this seems to return a random number if the Z axis is set to 0.
if i set the Z to .5 it will return the correct value, just seems to return a bad number at or around 0.
the x (1) and y (2) are fine they will return a 0 correct number..

GlobalGet Axis3 works corrent returns a 0

Sorry figured it out had to convert ToInt now works...

Thanks gary
Last edited by gburk on Thu Nov 14, 2019 3:34 pm, edited 1 time in total.
User avatar
ArtF
Global Moderator
Global Moderator
Posts: 4586
Joined: Sun Sep 05, 2010 6:14 am
Contact:

Re: reading Pokeys pins

Post by ArtF »

Gary:

Sounds like things are working mostly well. Sorry Ive been only
intermittently. Im testing some code for clubfoot escapements, once Im
finished up Ill look in Auggies direction again as I have some things
Id like to flesh out.

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

Re: reading Pokeys pins

Post by gburk »

Art

No problem thanks for you work and a lot of help..

I'm hoping that removing the latest print statements may help with not having to slow down feed rates for the smaller holes..

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

Re: reading Pokeys pins

Post by gburk »

Art

Having some trouble with dowhile and while loops

maybe i 'm just confused go figure..

Anyway can you call a function from the while loop, and in the function you are call have a while loop also?
And if i call the function is there a way not to reset the variable's each time its called..
say i have a loop counter in the second function, i don't want to reset the counter every time i call that function, there may be 3 or 4 values i don't want to reset..

there is no way to a goto, or use a sub in a script right..

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

Re: reading Pokeys pins

Post by ArtF »

Hi Gary:

>>Anyway can you call a function from the while loop, and in the function you are call have a while loop also?

  yes. shouldn't be an issue.

>>And if i call the function is there a way not to reset the variable's each time its called..
say i have a loop counter in the second function, i don't want to reset the counter every time
i call that function, there may be 3 or 4 values i don't want to reset..

  Unless their global var's they will reset. You could use global vars and
have a reset routine as well, but there is no real support for static I dont think.

>>there is no way to a goto, or use a sub in a script right..

  No, other than conditional breaks , there isnt much for loop control. Best you can do is clever design of
scripts called that use globals with other scripts to set them to defaults.

Art


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

Re: reading Pokeys pins

Post by gburk »

Thanks Art

I thought global's would be the only way but just in case i figure i'd ask..., if you don't ask no matter how dumb it may sound you will never know..

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

Re: reading Pokeys pins

Post by gburk »

Art

Been working with the % bar.
Is there a way that every time the bar is moved, slide up down to call a function?

It has a var name, but if i create a function with that var name, its not called to that global function.
I know how to get the value from the slider i just wanted to do some stuff every time it's moved..

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

Re: reading Pokeys pins

Post by ArtF »

Gary:

  Ill check. As I recall as long as a function is named it will be called when the slider changes,
but I may have turned that off for traffic control.. too many calls.. I'll check and see.

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

Re: reading Pokeys pins

Post by gburk »

Thanks art

Was hoping i'd catch you before you made the change to enable Reading %bar, if you could remove the prints you added for the feed rates.
Wanted to see if that had any effect on having to use  slower feed rate's when probing smaller holes..

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

Re: reading Pokeys pins

Post by ArtF »

Gary:

Ill do that as well..
Probably by end of weekend..

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

Re: reading Pokeys pins

Post by ArtF »

Gary:

Found a rather serious error in the messaging flow for the control scripts.
I think I have it fixed, still testing, be out this weekend I suspect.

Thx
Art
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest