Справочник Пользователя для Mitsubishi Electronics FX

Скачать
Страница из 382
FX Series Programmable Controllers
Points Of Technique 10
10-7
10.9.2
A 0.1 msec timer pulse measurement
This is a very accurate measuring process for pulse
inputs. The use of a standard timer is not accurate
enough in this case as the highest resolution is
1msec. Therefor, this example shows how the
special high accuracy devices M8099 and D8099
are used to capture the 0.1 msec resolution pulse
data.
Explanation:
The incoming pulse is captured between two
i n t e r r u p t   r o u t i n e s .   T h e s e   r o u t i n e s   o p e r a t e
independently of each other, one on the rising edge
of the pulse input and one on the falling edge of the
same input. During the pulse input the contents of
special register D8099 are continually moved into
data register D0. Once the pulse has completed the
contents of D0 can be viewed at leisure.
Please note for this high speed/accuracy mode to
be active for D8099, the corresponding special
auxiliary bit device M8099 must be driven ON in the
main program.
10.10
Using The Execution Complete Flag, M8029
Some of the applied instructions take more than one program scan to complete their operation.
This makes identification of the current operating state difficult. As an aid to the programmer,
certainappliedinstructionsidentify theircompletionbysettinganoperationcompleteflag, M8029.
Because this flag can be used by several different instructions at the same time, a method
similar to the following should be used to trap the M8029 status at each of the instructions
using it:
Explanation:
The M8029 'trapping’ sequence takes advantage of
the batch refresh of the FX family of PLC’s. As the
program scan passes each instruction using M8029
the status of M8029 changes to reflect the current
status of the instruction. Hence, by immediately
resetting (or setting) the drive flag for the instruction
the current operational status of the instruction is
trapped. So when the batch refresh takes place
only the completed instructions are reset. The
example above uses a pulse to set the drive flags
so that it is easy to monitor and see when each
i n s t r u c t i o n   f i n i s h e s   ( i f   t h e   i n s t r u c t i o n s   a r e
continuously driven it will be difficult to see when
they finish!).
FX
0(S)
FX
0N
FX FX
(2C)
FX
2N(C)
General wiring-pluse 
to be measured is 
connected to both X0 
and X1
Pulse to be 
measured
EI instruction
MUST be
included in main
program
Pulse has been
measured
Special device
D8099
Measured time
stored inD0
FEND
X10
X10
RST D8099
RST
M 0
IRET
X10
D 0
MOV D8099
SET
M 0
IRET
END
X 10
S (X0, X1)
I001
I100
M8099
X 0 X 1
FX
0(S)
FX
0N
FX FX
(2C)
FX
2N(C)
M8002
X0
D 0
MOV
D2
K 32766
MOV
K 0
M100
PLS
M100
Y5
SET
K100
K10
PLSY
Y0
Y5
M8029
Y5
RST
M101
PLS
M101
Y6
SET
Y6
M8029
Y6
RST
X1
D2
D0
RAMP
D3 K8000
Trapped 
instruction
Trapped 
instruction