Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: marv2097 on August 24, 2016, 09:47:26 AM

Title: Mach4 API Help - Jogging
Post by: marv2097 on August 24, 2016, 09:47:26 AM
Hi,

I am trying to get the physical buttons on a Boxford VMC190 to work with Mach4. I am using a Pokeys56U and have mapped them buttons as inputs.

I can see the input change state in the Machine Diagnostics screen so that is all good.

I have also setup keys like the Enable/Disable and Cycle Start, Feed Hold etc using the API and this works well. What I cant find is what API functions control motion.

Can anybody give me any pointers? These are some of the things I would like to map to buttons:

 - Jog each axis.
 - Toggle between Cont Jog and Inc.
 - Change the feed rate
 - Change the Inc scale

Any help would be appreciated.
Cheers, Marv
Title: Re: Mach4 API Help - Jogging
Post by: Chaoticone on August 24, 2016, 12:06:55 PM
For the Axis Jog, i would just map the inputs to the jog inputs in Machs configuration.

To swap jog modes I would do that in the sig. library in the screen load script.

Not sure what you are using to change feed rate and increment size. If just buttons would do them like swaping the jog mode. If using something with an analog value would probably do it in the PLC script. Not sure how pokeys does that though. Maybe their analogs write to a register or something?

All of the API calls are in the Mach4CoreAPI.chm help file in the docs folder.

You can see how a pendant was set up by looking at the attachments in this post............ http://www.machsupport.com/forum/index.php/topic,32832.msg228065.html#msg228065 That should help.

Title: Re: Mach4 API Help - Jogging
Post by: TOTALLYRC on August 24, 2016, 05:46:02 PM
The other option is to use the PMC which is a ladder logic way to interact with Mach4. It is in the latest download of Mach4.
Worked great setting up the buttons on my machine.
Title: Re: Mach4 API Help - Jogging
Post by: marv2097 on August 25, 2016, 06:02:08 AM
Thanks guys I will take a look at the API doc and see if I can get the other bits working.

Got the Jog buttons mapped to the Jog X+ etc in the Mach config works well for jogging at full speed.

However I had hoped they would behave like the on-screen Jog buttons. When you put change from Continuous to Increment mode the screen buttons increment as expected but the hardware buttons still jog at full speed. Is there any option to change that or do you have to map those as normal inputs and script them in Lua?

The pendant code looks useful too! maybe I should be looking for a Pendant now ;)

Title: Re: Mach4 API Help - Jogging
Post by: Chaoticone on August 25, 2016, 09:02:40 AM
Yeah, if you want to manipulate an input so that sometimes it is a jog inc. and others times it is continuous you would have to manipulate that inputs action with script. If you do that I would do the same thing, add them to the signal library and write the function with the if statement in it. And, as Mike said earlier, you may be able to use PMC to generate the code for this. I have not played with PMC much. Just enough to know it is a very valuable tool.