Comments and notes decide whether a program can be understood by yourself later and by anyone else. In GX Works there is more than one place to write them, with separate entries for program blocks, instruction lines and devices, and only the right mix keeps the program readable without affecting how it runs.
There are usually four: block (or program file) level titles and notes, which summarise what a section of program does; instruction or line level comments, attached beside a particular line; device level comments, bound to a given X, Y, M or D address to say what it is for; and network level comments, one for each network in a structured program. Higher levels are more general and lower levels more specific, and only together do they give a clear but not long-winded picture.
A device comment is bound to an address, so writing it once makes it appear everywhere in the program and gives the best return for the effort. Label an X input "start button" or "left limit", an M relay "manual/auto selector", and a D register with its units and range, and anyone understands it at a glance. Prefer a structure of "object plus function", avoid empty names such as "No. 1" or "spare", and remember that changing the comment for an address updates every place it is used.
An instruction line comment sits after a particular statement and is good for saying why a line is written that way, for example the reason for a delay at some point; a network comment is for a structured project and says which step of the logic that network performs. The difference is that a line comment addresses "this statement" and a network comment addresses "this passage". Too many comments crowd the display and an over-long one is hard to read, so keep each to the shortest length that makes the point.
The editor lets you choose whether each kind of comment is shown: turn them all on while debugging for easy reading, and switch off what you do not need when editing so there is less visual clutter. When printing a program you can also choose whether comments are included, and for handover or archiving they normally should be. The display switches are independent of the comment content, so hiding a comment does not delete it — do not assume the comment is lost.
Comments are saved with the project, and can also be imported or exported on their own as text files, which makes them easy to maintain centrally or hand to different people for translation. Note that when program or comments go to an older PLC model, or through a particular format conversion, comments may be unsupported or length-limited, showing up truncated or garbled; in that case confirm the comment is complete inside the software before deciding whether to write it with the program.
| Comment type | Where it goes | Main purpose | What to watch |
|---|---|---|---|
| Program block note | Program file/block properties | Summarise the function of a whole section | Concise and easy to search |
| Device comment | Bound to an X/Y/M/D address | State what a point is for | Name with object and function |
| Instruction line comment | Beside a particular statement | Explain why the line is written that way | Should not be over-long |
| Network comment | A network in a structured project | Describe that step of logic | Split networks by function |
| Title line | Top of the program | Name the program and version | Update with each version |
| Change record | Program or project properties | Record what changed and when | Every change must leave a trace |
| Parameter note | PLC parameter page | Explain the basis for parameter values | Keep in step with the program |
| Exported comment file | A separate text file | Central maintenance and translation | Watch truncation and encoding |
| Printing with comments | Print settings | Handover and archiving | Confirm the comments are complete |
Comments take no part in program execution, so more or fewer of them makes no difference to how the PLC runs, yet they decide how maintainable the program is. When a project is handed over, a commented program saves a great deal of time spent re-deriving the logic; a bare program usually forces a line-by-line rework instead. It is worth writing the comment conventions into the project rules, such as a consistent device-name prefix and a block title format.
The conventions for identifiers, variables and comments in PLC programming languages follow GB/T 15969.3 (identical to IEC 61131-3); the graphical and text symbols used on the program drawings follow the GB/T 4728 series, Graphic symbols for electrical diagrams; the electrical connection, protection and earthing of the equipment follow GB 5226.1 and the equivalent international standard IEC 60204-1. Character length limits and supported ranges for comments are as stated in the manufacturer's manual.
Before writing a program, confirm the comments are accurate and carry no wrong information; before writing to an older PLC model, check whether the comments are supported so the program itself is not affected. When the program logic changes, update the related comments at the same time so that comments and program never disagree and mislead the reader.