Incorporating best practices – Yaskawa NS300 User Manual
Page 7

Subject: Technical Note
Product: NS300/NS500
Doc#: EM.MCD.05.106
Title: NS300/500 Master Ladder Example
Doc#: Copyright Yaskawa Electric America
©2004
May 9, 2007
Page 7 of 16
Incorporating Best Practices
The second main topic is incorporating best practices programming into the ladder code. It is strongly
recommended to follow best practice programming recommendations, as these have been developed through a
wealth of application experience. Three main best practices are recommended for this program:
1. Write to each register/bit only one time in the program. Writing to registers in multiple locations is
highly discouraged. Use the waterfall technique to load registers with the proper values.
2. Avoid using set/reset coils. Set and reset coils can be hard to identify what has caused the current
state of the bit, making diagnosis very difficult. Instead, use latching circuits to latch and unlatch bits.
3. Force non-utilized command bits off. By forcing command bits that are not being used off, interference
between commands cannot occur. With proper interlocking, no two commands will be set together.
Each of these practices have been demonstrated in the example program. The first best practice is writing to a
register or bit only once. Errors can occur when registers are accessed multiple times, as improper data can
accidentally be loaded. When using the waterfall technique, data is loaded into the accumulator, the accumulator
is manipulated based upon logic conditions and required math operations, and then moved to the selected
register at the end of the section once all operations have been performed.
Manipulations only
occur in
accumulator
Actual register is
only loaded once
Load accumulator
with starting value
(i.e. zero, current
register value,
etc.)
Manipulate data
based on program
logic
Manipulated data
loaded into
selected register
Fig 2. Waterfall Technique