Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: poppabear on July 03, 2016, 09:54:29 AM

Title: LOVING the PMC!! Thanks Steve!!!
Post by: poppabear on July 03, 2016, 09:54:29 AM
LOVING the PMC!! Thanks Steve!!!

Scott
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: TOTALLYRC on July 30, 2016, 03:13:05 PM
+1 on the PMC love!!!!!!!
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: smurph on August 04, 2016, 04:58:02 AM
I'm glad you guys like it!  :)
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: TOTALLYRC on August 04, 2016, 07:19:52 AM
 ;D Everybody who used brains but wanted them to be better and easier to use should be singing your praises right now. ;D
I can't wait to get my BTC-1 changed over to Mach4. Because of the PMC, I can do it without learning how to code all of my brains in LUA.
The PMC will allow me to do my toolchanger integration as well. It is so nice to be able to make a change without having to delete all the rungs below it.

PMC PMC PMC PMC PMC PMC

Thanks again Steve.
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: rhtuttle on August 04, 2016, 01:13:47 PM
OK...what is a PMC?
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: smurph on August 04, 2016, 02:58:44 PM
Programmable Machine Controller.  It is a Fanuc term.  Basically, it is a ladder logic editor that spits out LUA code behind the scenes.  VERY fast.  It can be used instead of the regular Mach mapping of I/O or in conjunction with it.

The pros of the Mach I/O mapping is that it is event driven.  The PMC runs at a defined timer interval, thus is not event driven.  However, I did try to improve on that a bit at least for the Mach output signals.  When any of them fire, I force a PMC cycle.  So the PMC is basically event driven for the Mach output signals only.  Otherwise, it runs on a cycle just like any other PLC type of thing.  But...  you can have insane timer intervals (depending on the PC hardware).  I run my PMC object at 20ms intervals which is about the finest resolution my Atom board will do with a timer.  They complete their cycles in less that 1ms.  My real PC can handle 10ms intervals.  The OS seems to be a limitation on timers as well because 10 ms is about the finest resolution I can get.  But still!  10ms!!  That is smoking.

Steve

Steve
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: Hood on August 04, 2016, 03:06:50 PM
This has actually made me think about looking at  Mach4 again, took me long enough to get the basics of VB for what I needed and screwed if I was going to learn Lua to do the the basics in Mach4.
 I am not a programmer and don't want to be, I just want to be able to get my machine working like I want and use it without having to be multilingual.

I have always liked ladder logic, it is natural to me and PMC, at first glance, seems to make having to learn Lua redundant, hope I am right ::)

Always wanted ladder logic for Mach3 but Brian doesn't seem to like it, he is a programmer and they are weird, looks like some are only half weird though :)

Hood
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: machiner on August 04, 2016, 03:15:10 PM
I assume you used LDmicro's Ladder Program, apparently that is the program that was 'ported' over.

i can't locate any examples from LDmicro , if there are any, i could sure use them.

Very nice job. I noticed that LDmicro has a 'make persistent'  instruction, can this be added in the future ? .

Congrats on nice addition.
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: smurph on August 04, 2016, 04:35:32 PM
We did start with LDMicro.  However, it was purely for the GUI as a starting point.  To keep from having to re-invent that wheel.  However, the GUI was cleaned up a bit (looks nicer without all of the dashed lines) and I added some nice features to make paralleling circuits easier, among other things.  The back end guts were completely re-written for generating LUA code. 

Some things that were in LDMicro just are not applicable to the Mach/LUA environment.  Persistence can be done with Mach registers in the Regfile plugin.  Then just use the PMC to operate on those registers that you define as persistent. 

Just in case anyone is wondering, we did license the LDMicro code, so the GPL stuff does not apply.  We paid the author handsomely.  :)  We will have to sell a LOT of Mach licenses to get a return on the investment.  However, we consider it a win/win as we got the PMC a lot quicker that we would have otherwise and we like supporting guys that make cool software. 

Steve
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: dunnitagain on August 07, 2016, 06:44:27 PM
Thank You!!!!! For the PMC! Now I can the ATC going on my big old Fadal !!!!
Title: Reading Registers on PMC
Post by: arturod on August 30, 2016, 03:48:35 PM
I am trying to read a register on PMC, but cannot access the ESS encoder register.  I can see in the diagnostics the encoder register just fine, but it is not accessible on PMC.

I would appreciate if somebody can help.

Thanks,

Arturo Duncan
http://cnc4pc.om
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: smurph on August 30, 2016, 11:39:18 PM
Arturo,

At this time, encoder registers are not included in the list of input registers.  But are you needing an encoder value in the PMC?  To drive an MPG?  If so, you can associate an encoder to a MPG object in the Mach config.

Steve
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: arturod on August 31, 2016, 07:39:53 AM
Steve,

We need to read the motor encoder to compare it with commanded position when motor speed =0.  To alert the user if an axis has lost its position.

I guess it can be done in a lua script, but thought a PMC would have been easier for users.

Let me know if you have any thoughts on doing this.

Arturo Duncan
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: smurph on August 31, 2016, 08:12:55 PM
Arturo,

I added the encoder registers in the list of input registers for the PMC.  So the next build will have that in there.  However, I really don't think the PMC is the proper place for it.  That sounds like something the motion controller plugin should be doing.

Steve
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: arturod on August 31, 2016, 08:36:34 PM
Steve,

Thanks...  Yes, I agree with you, it should be the ESS, we all hope that someday it will be able to process this in real time.

When do you think it will be available?

Arturo Duncan
http://cnc4pc.com
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: smurph on September 01, 2016, 12:52:12 AM
Well...  that is hard to say.  Maybe by week's end?  I'm working on jogging during feed hold and it is a complex issue.  :(
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: jderou on September 02, 2016, 05:47:10 PM
Why can't I find the PMC?  I have the most recent version downloaded from the main page.

Edit* just realized I have to go to the ftp site to get the most recent builds.  Is it safe to grab the latest release or should I stay back a couple?
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: smurph on September 02, 2016, 08:05:22 PM
The SAFE thing to do is use a general availability release from the main page.  :)  ANY of them from the development ftp site are likely to be bleeding edge. 

Steve
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: jderou on September 02, 2016, 08:07:19 PM
I guess I have to play it safe.  the Hicon plugin only supports up to 2914.  PMC is looking good though.
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: jderou on September 07, 2016, 07:52:42 PM
I figured out I had to do a fresh install of the latest version to get the Hicon to communicate properly.  I now have a dozen or so rungs working in the PMC.  I am stuck on one right now that I just can't figure out.  I have LED's that represent different jog increments (.01, .001, .0001).  I have Mach4 setup to only step through these increments.  I want each LED to light up when the corresponding step increment is active.  I tried reading the jogincx variable into PMC using a read from register instruction, but it seems it is not reading the decimal value (I assume because the variable is long dim).  How do I read this data type?
Thanks!
and BTW, I am way ahead of where I would be without the PMC.
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: arturod on September 08, 2016, 08:44:30 AM
Steve,

Any update on the new release?

Arturo Duncan
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: smurph on September 11, 2016, 08:10:24 PM
Probably not until after IMTS.  :(
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: arturod on October 04, 2016, 11:05:06 AM
Steve,

I am now able to read the encoders in the ESS.  THANKS!!!

I ran into a new issue.  I cannot use decimal points on PMC.  I need to do an operation where I multiply the encoder count by a multiplier to get the actual motor potion.  But he operation is truncating decimals.

I did an small sample that probably illustrates the problem better.  I am just diving 5 by 2 to get 2.5, but the simulation only shows 2, truncating the .5.

Let me know if you have any thoughts on doing this.

Arturo Duncan
http://cnc4pc.com
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: smurph on October 04, 2016, 11:37:07 AM
PMC was never meant to handle decimals as most PLCs don't have decimal registers.  :(  I'll see what it takes to put that in but it may not be trivial at all.  It will not handle strings either, FYI.
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: arturod on October 06, 2016, 01:17:16 PM
Steve,

Do you have any thoughts on this?  We could also move it to lua if you think PMC is not going to be the tool for this.  We wanted to make it in PMC as we did one like for Mach3 using the brains that became very popular as it was very intuitive and easy to use, so users were able to do further implementation to it.

Arturo Duncan
http://cnc4pc.com
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: smurph on October 06, 2016, 04:25:44 PM
I think I have it working with decimals now.  All of the tests I did showed good results.  But I had to change a lot of code and I might have missed a path or two.  It will be in the next release. 

Steve
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: arturod on November 08, 2016, 03:45:07 PM
Steve,

Any news on the new release?

Arturo Duncan
http://cnc4pc.com
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: smurph on November 09, 2016, 12:09:26 AM
It should be there in the 3233 build. 
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: arturod on November 09, 2016, 06:15:36 AM
Steve,

I cannot find that built.  I am looking for it in the Development Versions Folder: ftp://ftp.machsupport.com/Mach4/DevlopmentVersions/

Arturo Duncan
http://cnc4pc.com
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: smurph on November 09, 2016, 01:18:51 PM
I guess they haven't posted it up then.  :(  I just make the builds but I don't put them up on the web site or ftp site.  I'll see if can't find out what's going on. 
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: thespindoctor on November 20, 2016, 06:39:14 PM
Where is the PMC to be found and any docs on it?

Thanks
Keith
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: TOTALLYRC on November 20, 2016, 07:05:59 PM
You need  Mach4 version 4 ******************.3112. Under configure select PMC. Docs are in the mach4 doc folder, PMC.


Mike
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: thespindoctor on November 20, 2016, 07:32:55 PM
Thanks Mike!!
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: TOTALLYRC on November 20, 2016, 07:51:03 PM
No problem.
I am just spreading the PMC love!!!!
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: thespindoctor on November 20, 2016, 08:21:41 PM
I want to fall in love too! But when to use this is in Mach4. 
Is it just to deal with inputs and outputs monitoring activities or could it be used to write a probe routine for instance?

Thanks,
Keith
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: TOTALLYRC on November 20, 2016, 08:48:46 PM
While the PMC is very powerful I am not sure if you can do that with it.

Mike
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: arturod on June 09, 2017, 08:58:26 AM
Steve,

It looks like PMC is still not doing calculations with decimals:

Arturo Duncan
http://cnc4pc.com
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: smurph on June 09, 2017, 12:36:00 PM
Arturo,

I need an example.  Because what I just tested works.  Can you post the PMC file? 

Steve
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: arturod on June 09, 2017, 01:01:37 PM
Steve,

Here it is.

I had to add the .txt so it would allow to upload it.

Arturo Duncan
http://cnc4pc.com
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: smurph on June 09, 2017, 06:23:59 PM
Ok Arturo, I think I have it.  Thanks for the example because the math portion was working correctly.  The error was with reading and writing registers.  The fix will be in the next build.  

Steve
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: Fabworx on July 27, 2017, 08:40:03 PM
How do I get selected tool and current tool into PMC. Also how do I start a PMC file from M6?
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: smurph on July 27, 2017, 09:13:23 PM
You don't start a PMC file from any macro script.  The PMC is running all of the time (it is a software PLC).  Regulars ways of interfacing to a hardware PLC from a macro script can be used.  Typically by using Mach registers to communicate.  For your tool change stuff, you could load the selected tool into a register that the PMC is watching, etc...

Steve
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: Fabworx on July 27, 2017, 10:55:24 PM
Ok so how do you do that?
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: smurph on July 27, 2017, 11:08:01 PM
I can't possibly explain all of that in a forum post.  My advice is to search this forum for PMC examples.  Then familiarize yourself with the LUA scripting API to figure out how to get the selected tool, etc..  Look at some of the M6 example scripts.  They might help.  You may not even need the PMC, depending on what you want to do. 

Steve
Title: Re: LOVING the PMC!! Thanks Steve!!!
Post by: Fabworx on July 27, 2017, 11:55:19 PM
Ive been doing that for days now Im lost. I dont understand lua at all thats why Im trying to use PMC. Ive gotten a few things figured out but dont know where to start with getting the current and selected tools. Thank you though. Im trying to setup my lathe tool changer. It's a turret style 8 position that uses a combination of 5 limit switches to determine position of the turret. As to say when both limit switches 1 and 2 are tripped its in position 1 and when LS 1 and 4 are tripped its in position4. I also need to output FWD and REv to a vfd to run the motor on the turret while activating a relay to operate a hydraulic solenoid to unlock the turret and monitor its own limit switch.