Example Of Creating A Structured Program - Mitsubishi Electric MELSEC Q Series Programming Manual

Structured. fundamentals
Hide thumbs Also See for MELSEC Q Series:
Table of Contents

Advertisement

Example of creating a structured program

This section shows an example of creating a sequence program same as the program created in GX Developer using GX
Works2.
Ex.
The following examples explain the method for creating a structured program same as the data receive program for a Q-
compatible serial communication module, using the structured ladder/FBD and ST languages.
The following shows the original program.
Replacing devices with labels
Replace devices of the original program with labels.
Replace input/output devices with global labels. For devices such as internal relays, replace them with local labels.
Device
Purpose
X3
CH1 reception data read request
X4
CH1 reception abnormal detection
D0
Control data
D1
D2
D3
D10 to D109
Reception data
D110 to D209
Reception data storage area
M0
Data reception
completion flag
M1
M100
Abnormal completion flag
X100
Abnormal completion flag reset command
APPX
104
Appendix 3 Recreating Ladder Programs
Reception channel
Reception result
Number of reception data
Number of allowable reception data
Completion flag
Status flag at completion
Specify the receive channel.
Clear the reception result and receive data count
storage device to 0.
Specify the allowable receive data count.
With normal completion, the receive data within the
allowable receive data count (user specified) is read
from the receive data storage area in the buffer memory.
Once the INPUT instruction is executed, the user
specified read completion signal (M0) turns ON for
1 scan.
The reading of receive data and switching of the
ON/OFF status are performed by the programmable
controller CPU.
The abnormal completion flag is reset by an external
command.
Label
Data type
Label name
Bit
CH1ReadRequest
Bit
CH1AbnormalDetection
Word (unsigned)/16-bit string
ControlData
[0] to [3]
Word (unsigned)/16-bit string
ReceiveData
[0] to [99]
Word (unsigned)/16-bit string
Data
[0] to [99]
Bit [0] to [1]
Completion
Bit
AbnormalCompletion
Bit
ResetAbnormalCompletion

Advertisement

Table of Contents
loading

This manual is also suitable for:

Melsec f seriesMelsec l series

Table of Contents