Mitsubishi FX3 programming question

arpus4KM

Lifetime Supporting Member
Join Date
Sep 2021
Location
Mid
Posts
649
I'm been deciphering a program for a press here. I've gotten most of it deciphered using the manual to understand the instructions (first mitsu that's i've actually delved this deep into). and i'm having a bit of trouble finding explanations for some things.

the main one so far is

When using an A/B encoder and as it's assigned internally to C251, the rung looks like.


K9999999
M8000-----------------(C251)


What is the purpose of the K9999999? is it a constant value that becomes the maximum number it can count to? does it set the C251 value to 9999999 as soon as the scan runs past this rung?

shortly after that I have another rung

M8002----------------[RST C251]

Which is resetting C251 from whatever value it holds.... It seems counter-intuitive to upon Run mode (M8000) being active, that we then reset on first scan, only for M8000 to change the value right back.


Further down there is another rung

M8000----------------[DMOV C251 D200]

where D200 is the readout of the press position for usage in the program, so this clearly is transferring every scan as it's not a DMOVP. I just don't get the first two with the OTE and Reset in conjunction with each other and the relevance of the value above C251. I've read through multiple parts of the manual and it can be pretty vague when explaining details.

Thanks,
 
The first rung sets the counter max value i.e. when the counter reaches this value it's output contact comes on, however, these counters C235 > are normally used for A/B high speed count functions tied in hardware to X0-X7 it is possible to set a counter to a value I suggest you see this manual, the reset will reset the counter actual value not sure what they are trying to do here but that may depend on some other logic but it does sound this is for an encoder.
But you probably already have the manual, I can understand the reset & setting of the constant (max count) but not why they set the counter current value.
 
The set the counter value to K9999999, because they do not expect it will reach it. Most likely they are using the counter value to measure something like distance, from linear incremental encoder or something similar, and this is one way to do it. C251 is up and down counter (2-phase, 2-count input)
 
That is odd.

Counters usually only count rising edge (false-to-true) transitions of their input rung. So after the RST on M8002 (first scan), the next M8000 (RUN i.e. value is always 1 when PLC is in Run mode) would cause C251 to count to 1*, and then it should never count again (M8000 is always 1, so it cannot transition from 0 to 1 again).

* assuming the RST resets the "last scan's input rung state," so the M8000 appears to be a rising edge on the next scan cycle.
 
The first rung sets the counter max value i.e. when the counter reaches this value it's output contact comes on, however, these counters C235 > are normally used for A/B high speed count functions tied in hardware to X0-X7 it is possible to set a counter to a value I suggest you see this manual, the reset will reset the counter actual value not sure what they are trying to do here but that may depend on some other logic but it does sound this is for an encoder.
But you probably already have the manual, I can understand the reset & setting of the constant (max count) but not why they set the counter current value.
That answers my question on that as far as he Constant value being attributed to the counter. I never saw anything in the manual that stated this.

This is a 360 degree operation. theyre using DHSCR To reset the C251 value accumulated by X0-A X1-B signals from the encoder back to 0 once they hit 360

[DHSCR K360 C251 C251]

The initial counter value is done through an offset where they basically just DMOV a final value after subtracting the chosen value from 360 and putting it into another D word which then goes into the C251 before any rotation starts on home.
The set the counter value to K9999999, because they do not expect it will reach it. Most likely they are using the counter value to measure something like distance, from linear incremental encoder or something similar, and this is one way to do it. C251 is up and down counter (2-phase, 2-count input)
No it should never reach it, as stated in the above reply they are using DHSCR to reset the count at 360 counts so this incremental acts like an absolute for angle of a press.
That is odd.

Counters usually only count rising edge (false-to-true) transitions of their input rung. So after the RST on M8002 (first scan), the next M8000 (RUN i.e. value is always 1 when PLC is in Run mode) would cause C251 to count to 1*, and then it should never count again (M8000 is always 1, so it cannot transition from 0 to 1 again).

* assuming the RST resets the "last scan's input rung state," so the M8000 appears to be a rising edge on the next scan cycle.
On this instance, just activating the C251 shouldn't cause a count from my understanding, activating it is supposed to turn on the internal structures that turn X0 and X1 into A/B counters for high speed counting with an encoder. The other files from i think C235 through C255 can be chosen and each of them activate different internal uses of the physical inputs.

This is just Mitsu's way of setting up the HSC functions it seems, as opposed to toggling options in a menu somewhere like we do in AB stuff.


My assumption as to why they Reset is that the Reset would clear any stored values out, but I Don't know why that is preferable as opposed to just inserting a value of zero into C251 instead of resetting it as a word. But this is all internal counter functions that are hard coded into the processor.
 
mitsu-encoders.png


here is how the C251 is dictated internally. if you choose another, you get another hardware assignment and usage for counting.
 
you are wrong about the M8000 for the counter, these are effectively hardware counters, they are tied to the physical inputs X0-7, to enable the high speed counters you always must have them true to allow them to count. in other words you use M8000 always on from first scan to enable it.
it is the actual input(s) in this case X0 & X1 (two phase) connected to it that increments or decrements the count, Every scan the counter value is moved to the 32 bit word D200 & D201 (DMov is 32 bit move so in Mitsubishi it takes two 16 bit registers).
So what this is doing is on first scan the counter max value is set to 99999 (must assume that the encoder does not produce more than this value when counting), On first scan M8002 i.e. plc put into run from a stop or power down. From that point the value of the counter is transferred eveery scan to D200 + D201. As this is an up/down counter then in theory it will never reach the max set value if it does then the counter will stop counting until the down counts reduce it to below the max value but I would think by then the drive it is controlling has either smashed or hit a hard stop.
If you do not enable every scan the hardware high speed counters the inputs tied to them become normal inputs, you will notice that usually, the inputs connected to encoders are not used in the program so cannot be cross referenced but are in use.
 
Just as a side note: although the ladder rung is just like a normal counter, these hardware/software counters are actually different, the compiler knows that these counters are for High speed so under the umbrella of the continuous enable the actual input count pin is connected to the relevant input, if not enabled, the high speed mode of those inputs act like normal inputs with the parameters like 10ms true to false transition based on I/O update of the processor, when enabled for HSC or interrupt the input filter is bypassed & instant access is used in either the interrupt or HSC.
 
Just as a side note: although the ladder rung is just like a normal counter, these hardware/software counters are actually different, the compiler knows that these counters are for High speed so under the umbrella of the continuous enable the actual input count pin is connected to the relevant input, if not enabled, the high speed mode of those inputs act like normal inputs with the parameters like 10ms true to false transition based on I/O update of the processor, when enabled for HSC or interrupt the input filter is bypassed & instant access is used in either the interrupt or HSC.
d'Oh! Thanks, got it now. I still haven't exactly sussed out exactly what that first rung looks like (where is the K99999999?), but of course it's setup and it's not triggering the count - X0/X1 do that.
 
Yep it does seem weird but once you get into the mind of the south east asian train of thought.
Unlike many other PLC's that use either the done bit or Counter.Q the Japanese tend to use just the Timer number as a contact.
so in effect call a counter like [C 200, K300] sets the limit of the counter before the count contact goes true.
Call a counter like [C200, D200] loads the current count into a D register.
although you can load a Counter in a compare like [CMP > C200, 150].
In the later IEC format they have produced IEC timers that have the usual other bits i.e. IN, PT, Q, ET & Preset variables equivelent to the other plc's like AB
 
you are wrong about the M8000 for the counter, these are effectively hardware counters, they are tied to the physical inputs X0-7, to enable the high speed counters you always must have them true to allow them to count. in other words you use M8000 always on from first scan to enable it.
it is the actual input(s) in this case X0 & X1 (two phase) connected to it that increments or decrements the count, Every scan the counter value is moved to the 32 bit word D200 & D201 (DMov is 32 bit move so in Mitsubishi it takes two 16 bit registers).
So what this is doing is on first scan the counter max value is set to 99999 (must assume that the encoder does not produce more than this value when counting), On first scan M8002 i.e. plc put into run from a stop or power down. From that point the value of the counter is transferred eveery scan to D200 + D201. As this is an up/down counter then in theory it will never reach the max set value if it does then the counter will stop counting until the down counts reduce it to below the max value but I would think by then the drive it is controlling has either smashed or hit a hard stop.
If you do not enable every scan the hardware high speed counters the inputs tied to them become normal inputs, you will notice that usually, the inputs connected to encoders are not used in the program so cannot be cross referenced but are in use.
Thanks for giving some more clarification, this is where I was leaning to initially since the rest of it made plenty of sense. No worries on the max being hit, for some reason they chose an outlandish number for the "PRE" value whereas anything over 365 would suffice since it only counts to 360 on normal operations. Although the bad programming inside has allowed those numbers to shoot past 360 and never reset because they didn't have a catch for anything but "Equal to" 360, nothing above.

And from your explanation I could assume that they are doing the RST on first scan just to dump any information out of the counter as a precaution.... Although based on the way this is operating I may have to change it up and let it keep it's numbers on startup each time. This machine has been "losing it's position" on startup frequently. Chinese machine purchased for an american small business and they didn't get the best support for it, not to mention the translations are as good as you assume they would be.

So an Origin/home offset button is simply labeled "Position", and they've been entirely unsure what it was doing until now. so when this starts up, it's clearing the encoder counts out regardless of it's position. It's supposed to stop in the same place every time, but obviously if it doesn't stop on top like it's supposed to then it's going to be out of time at next startup due to the clearing of the position.
 
Yes, to reset the position is ridiculous, it should have a homing position if for some reason the power fails or whart ever i.e. not automatically start where it left off but make the operator rest the machine in the correct sequence before starting the system. done this many times when power is applied & sytem enabled, check if it is out of normal start conditions & if not inform the operator to do a homing or return sequence before it can be started. normally this ensures that any drives or cylinders go to the home position, often with servo drives, there is a homing sensor, it returns to this then possibly moves forward so many counts to it's correct position i.e. 0 counts & not the home position, often the reason for this is that hitting the home sensor at speed may cause the drive to overrun slightly probably does not matter in your case but if that home position is critical i.e. to pick something up then it is important that the zero count is correct, we had some systems that used to do a re-calibrate every so often in creep mode.
 

Similar Topics

I’m fairly new to PLC programming. This is our first machine that uses an FX5 PLC rather than an FX3, and therefore GX Works3 instead of GX...
Replies
1
Views
1,255
I'm trying to communicate between the Mitsubishi FX3 series plc and my Gp2600 HMI through ethernet or serial that is faster than 19200. Mitsubishi...
Replies
0
Views
3,849
Hello! If someone can help me with the following problem. I can't change the phone number. Do I really need the interface (AL-232CAB - Programming...
Replies
0
Views
39
how to communicate FactoryTalk Optix and Mitsubishi Q Series. I want to know the details of that
Replies
0
Views
37
Back
Top Bottom