GX Developer and FX1N/FX2N newbie

Thread Starter

dwalsh62

Joined May 9, 2014
4
While I realize this may seem simple for many and some will respond with remarks like RTFM, RTFM doesn't help me because it has no useable examples that tell me what I need to do and my knowledge/experience programming them is pretty much non-existent and I don't have 10 years to become a PLC guru.

The PLC is to be used with a tool changer. and it's functionality I'm told is rudimentary in comparison to the average PLC use.

I'm told if I don't code it correctly I can make the PLC unusable by preventing access to upload code by disabling or not enabling stuff so I'm not writing it to the PLC until I know it's good and understand what code needs to be included to allow me to continue writing to it.

The exact model is LK1N/LK2N-20MT (STM32F103RBT6 on board)

I believe I have covered all of the input/output requirements and have the basics coded and this is where I'm stuck.

There really is only one function which is to home the carousel and return it to it's starting position (if not already at home).

This is the function I am having an issue with as it requires working with DATA and the manual shows me no usable working examples and finding examples online seems difficult (or I just don't know how to search properly for any) or so complicated that I can't see the forest through the trees.

At startup (run), I've got to start at the current carousel position, count each up pulse of the position sensor until the home sensor is reached and then return to the starting position, if starting on home then just set it and then set a flag so the function doesn't run again.

I've added some states and timers to take into account things like drawbar activation/deactivation and shuttle extend/retract take time and use a busy/ready signal to prevent command issues and believe I have a solid starting point but could really use some help from someone who knows how to program these things really well to prevent me from doing something wrong or stupid.

I've attached the IO assignment and the GX Developer project for those looking to help me out.
 

Attachments

MaxHeadRoom

Joined Jul 18, 2013
28,619
I have the FX s/w for the FX series, I am not sure if it is compatible with your files, but normally if creating this scenario for a T.C. that has to be zero'd at power up, you would have some way of decoding each tool position such as binary or BCD prox sensors, another method is using an encoder on the main or motor shaft/operator.
Either of these ways normally would not need zeroing at power up as the posn would be known.
A lot depends on the actual mechanical arrangement of the T.C. Mitsubishi also has some tool change routines and features that help implementing a T.C.
You may find something on the MEAU site.
There is also a book 'Mitshibishi FX Programmable Logic Controllers' by John Ridley that covers program routines.
Max.
 

Thread Starter

dwalsh62

Joined May 9, 2014
4
Thanx for the reply Max and while the information is somewhat useful it doesn't help me quickly solve my problems.

A simple proximity sensor is suitable for the tool position detection and if you locate the zero position the PLC will know what tool it is on is just as simple way around a BCD proximity sensor but must be calibrated at power-on.

The code stuff from MEAU uses BCD sensors and these aren't practical for a DIY ToolChanger due to cost and the complicated coding involved.

This is one of those projects that when done will never need to be altered or changed and for one of the tool changers I would be surprised if it exceeds 250 steps.

The end result will be a functional ToolChanger for me and a readily available PLC which can be had for less than $50.00 programmed and shipped which will work with components most commonly used and readily available in the home/hobby CNC market which is in desperate need of reasonably priced solutions and my focus is to help provide some of these solutions and in some cases, without any profit.

At $50.00 shipped in the USA I'd see about a $5.00 profit and in a 2-3 year period I might sell 50 so it's nothing to get rich with but it is something that is desperately needed and something I'm asked about quite often.

The Carousel ToolChanger (CTC) PLC's main purpose is to prevent errors and provide a busy signal during motion or travel and send an alarm signal should something fail or cause damage like a motor not turning or, trying to deposit a tool in a slot that already contains a tool (extreme hardware damaging and great bodily injury can and will occur) and most of the functionality comes from Mach3 or a CNC panel as it tells it what to do and can take 10-15 seconds.

The Swinging Arm ToolChanger (SATC) PLC is more complicated as the entire process is fully automated and occurs in 1-2 seconds (almost instantaneously by comparison).

Unfortunately my experience with PLC's is pretty much non-existent and time is an issue.

With that said, the previously posted code didn't work but I did work it out.

I've spent the last two days rewriting the code and finally have a partially working solution with some minor issues, example, mach3 when sending a pulse on a parallel port might have bounce and I'm not sure why this is, I've looked at the output signal from the parallel port on a scope and some times there is 2 or 3 pulses in a 3ms to 5ms period depending on what windows is doing and the default timing filter for inputs in the PLC is 10us so my solution is to change the filter delay to 10ms to correct this issue.

When I check the output from a USB to parallel adapter there is no bounce on any outputs that I could measure and I've got a 600Mhz scope so the issue is related to windows, interrupts and parallel ports because on USB I believe it doesn't occur because everything is serially transmitted to the USB adapter and then interpreted and executed within the USB adapter and not subject to the delays and interrupts deriving from the computer/OS.

I'm missing the code that searches for the home position and then returns back to the position it was at.

I've figured out the code to test the shuttle and drawbar (if a tool is in the spindle it assumes it's working and skips the test).

The second version of the ToolChanger PLC code needs to do things a little differently as it is a swinging arm and not a carousel Tool Changer.
This second tool changer must keep track of the tools so this will require the use of data registers, the number of tools in the magazine, it doesn't put the in use tool back and then get the new one, it swaps the next one with the one in use.

SWATC:
You have 8 tools = 8 data registers plus a last tool register plus an in use tool register.

Here's an example of flow:

Start with
1
2
3
4
5
6
7
8
last tool = 0
in use tool = 0

get tool 1 then it's
0
2
3
4
5
6
7
8
last tool = 0
in use tool = 1

get tool 4
0
2
3
1
5
6
7
8
last tool = 1
in use tool = 4

get tool 7
0
2
3
1
5
6
4
8
last tool = 4
in use tool = 7

....
....

In reality there is usually 16, 20 or 24 tool holders but you get the idea from example of using 8.

As you can see, after a few changes the order is messed up but you need to have the ability to get the correct tool so in this case, you send the number of pulses for the next tool you want and the tool changer will get the correct tool, activate the drawbar and swap the tools all automatically so a tool change can occur rapidly and it is a marvel to watch.

As I said, time is my problem, I have very little and I'm well into my 50's so the thought of learning all this stuff needed to create all this code 10 days isn't realistic, I'll abandon the project before then and buy a programmed PLC that's plug and play and the rest of those in the home/hobby cnc community will have nothing instead of something that's suitable which can be had for almost nothing.

I am a part of the home/hobby CNC community, it's a bunch of DIY'ers fabricating machines to do work and I am trying to do my part by offering an inexpensive product that solves a problem and yes, I wont get rich selling the PLC and it's not my intention, I'm trying to fill the void of making available suitable products at a reasonable price because there's too many in the community who are using their poorly designed and poorly implemented products to get rich off the community while leaving the users with nothing but aggravation and frustration.

I can show you some products I already provide so you can confirm what I say I am doing is real.

In a nut shell, what is required of the carousel tool hanger is almost non-existent and the swinging arm tool changer a little more complicated but for a seasoned programmer, it should be a walk in the park and what I really need is for someone to step in and help by doing the things I cant instead of telling me to RTFM as I have enough on my plate as it is.

Of course on the other hand, if you wish to take over the PLC portion of the project and offer it for sale I have no issues if you charge a little more as long as it's not so overly priced that the community rejects it based on the price and who knows, it could turn into one of those project that gives you some fun money or I've under-estimated the demand and it puts some serious coin in your hands.

Hardware to test the PLC I can probably help you with by providing some of the parts like the PLC, powersupply, sensors and relays and other commonly used/needed parts reducing any expenditures you might have in your development, don't want you going broke trying to help, just a thought.
 

Attachments

Last edited:
Top