GX Works 2 (FX3G) how to mode input pulses to output?

Serhioromano

Member
Join Date
Sep 2015
Location
Kazakhstan
Posts
57
I have encoder connected to FX3G and stepper. What I want when I rotate encoder it moves stepper. Encoder sets position for stepper. Or each pulse on X0 create pulse on Y0,

What is the best instruction for that?
 
Hi,



|--|X0|-------(Y0)--|


but it depends on what kind of PLC you have and on speed of pulses
 
Best approach depends of needed speed of input and output, possible directions etc. We need more info.
 
You may not find that direct X0 input to Y0 output will work in respect of the speed that the encoder will be giving pulses, the FX range can use X0-X7 as high speed but this is done by hardware counters connected directly to the inputs, to get them to read high speed transitions you need to enable the counters or use input interrupts putting an X0 to output Y0 in the standard scan of the PLC will only do it at the rate the PLC code is run for example a medium program size will probably take 20 to 30 ms to scan so it will only give read or send pulses at that speed. There are functions to pwm outputs at fast speed but never used them.
 
I seem to remember that if you use I/O interrupts on X0-X7 there are special memory areas in the D8000 range that give you the input pulse duration as well as immidiate I/O update, you could use this in conjunction with the PWM instruction to output pulses by parameterising the PWM with pulse width in ms & number of pulses i.e. 1 so in effect it should give the Y output the same pulses as the X input, bear in mind the PWM instruction does not work on the simulator & obviously you need a FX3 with transistor outputs.
I cannot find it now but I also seem to remember there was some way of directly accessing the X/Y I/O i.e. immidiate update of physical inputs & outputs, but I have no idea if that will work on FX range of PLC's I believe it was some suffix on the I/O number like DX000 DY001 but I know it is not that just tried it but I'm certain I have seen it somewhere in the past.

Perhaps read this manual for high speed interrupts & PWM look at page 823 it shows the D8079 as the pulse period for X0 that is set when the interrupt is run
THE PWM instruction takes two input parameters i.e. pulse width in ms & number of pulses, never tried it but perhaps use that N1 would be D8079 & N2 would be 1, it's a guess, but perhaps in conjunction with the I/O interrupts it will give you a pulse every time X0 goes true & the last pulse width so sort of reflecting the input pulses back out to the output
 
I seem to remember that if you use I/O interrupts on X0-X7 there are special memory areas in the D8000 range that give you the input pulse duration as well as immidiate I/O update, you could use this in conjunction with the PWM instruction to output pulses by parameterising the PWM with pulse width in ms & number of pulses i.e. 1 so in effect it should give the Y output the same pulses as the X input, bear in mind the PWM instruction does not work on the simulator & obviously you need a FX3 with transistor outputs.
I cannot find it now but I also seem to remember there was some way of directly accessing the X/Y I/O i.e. immidiate update of physical inputs & outputs, but I have no idea if that will work on FX range of PLC's I believe it was some suffix on the I/O number like DX000 DY001 but I know it is not that just tried it but I'm certain I have seen it somewhere in the past.

Perhaps read this manual for high speed interrupts & PWM look at page 823 it shows the D8079 as the pulse period for X0 that is set when the interrupt is run
THE PWM instruction takes two input parameters i.e. pulse width in ms & number of pulses, never tried it but perhaps use that N1 would be D8079 & N2 would be 1, it's a guess, but perhaps in conjunction with the I/O interrupts it will give you a pulse every time X0 goes true & the last pulse width so sort of reflecting the input pulses back out to the output

Yes I know about refresh instruction that immediately update outputs. But it also works only during the PLC cycle.

I was thinking about interrupts but if those will occur 10 000 times a second how that will affect work of a PLC in general. I can hardly imagine anything will work that way.

There is instruction SPD which gives a speed of encoder I can convert it to speed of DRVI\PLSV instructions. Another way is every PLC cycle count difference of speed counter, lookup in D80** for time of current cycle and calculate a speed.

I have no problems converting to speed but drive stepper pulse-to-pulse. I want the stepper to move faster if I rotate encoder faster and vice versa. And exact number of pulses.

I have few ideas on how to achieve that, but I wanted to listen to what others think before I conclude the approach I going to take.

|--|X0|-------(Y0)--|


but it depends on what kind of PLC you have and on speed of pulses

Not sure that will work for fast inputs and outputs

Best approach depends of needed speed of input and output, possible directions etc. We need more info.

The speed is up to 20000, any direction for that matter.
 
Your PLC cycle time depends of complexity of application in PLC. IF you use classical LD X0 OUT Y0 approach latency will be:
DI Filter Time + PLC Cycle Time + DO Latency time (small but exists)
For 20KHz input enough there will be latency due to PLC cycle. Also take care about DI Filter Time.
I presume that you would like to make Master-Follower system, but it is usually not done with PLC.
Maybe you should look at DRVI function.
There is one thing that can help you, and that is inertia of mechanical system. It could happen that due to inertia you will not have the feeling that the system is lagging.
 
The most likely cause is that it is assumed the DVRI function is called in the scan program so due to the scan time of the PLC the value passed at the time of the call & the code you are running and processing of that code you may lag behind actual pulses from the encoder. Not sure how you get round that.
 
@Goghie: I was wondering about that but apart from timed interrupts not sure how the HSC's will react, never tried running HSC's & interrupts together so not sure what interaction there may be. I know sometimes you have to be careful when using interrupts as another interrupt occuring during a current one processing code can cause problems but who knows unable to test as although I do have an FX3U do not have a servo or encoder to try.
 
I never implemented HSC's & interrupts together also. Long time ago, when I needed to do some motion control with FX I would use 1PG and 1HC adapters, but this is different setup.
In this case, my idea would be to count high speed digital input edges in very short interval (task interval=10ms?) and that obtained number would be used for DRVI command.
I think that it would create minimum lag.
 
Last edited:
Ye I agree, just been looking at the FX series in detail, I'm sure somewhere that there was a way of immidiate update of I/O rather than the mapped I seem to remember something like instead of Y0 it was something like DY0, but cannot find it, although perhaps I'm thinking about another PLC.
I also think that perhaps the I/O is updated immidiately if using some of those instructions like the DVRI etc.
I also think there is a refresh function to refresh the I/O immidiate.
 
Last edited:
Yes the other is REFF orsomething like that setting the input filter in D8xx can set the filter time between 0-60ms I believe.
Trouble is it's been a few years & FX I have has relay outputs so cannot try anything.
 

Similar Topics

Hey everyone and anyone that can lend a helping hand. I have a project that I am being asked to add some animations of Solidworks or "3D" models...
Replies
9
Views
296
PLC: Fx5u CPU As Per manual High Speed Input Module can add from Navigation window  [Parameter]  [Module Information]  Right-click  [Add New...
Replies
1
Views
87
Hi all, anyone does have experience in Gx Works 2? Currently I having an issue which is when certain device added from MELSOFT Navigator and...
Replies
1
Views
107
Hi Guys, I want to connect my 1769-L36ERM to a different network domain, is it possible to do it using only the dual ports in the Controller? Or...
Replies
3
Views
202
I'm totally new to PLC's and I've just purchased an FX3U-14MR Mitsubishi Clone. I believe I need to use GX Works Software to program it but I've...
Replies
1
Views
115
Back
Top Bottom