This document describes the example ladder program for implementing control of the NS300 and NS500
application modules in a master PLC. This example code demonstrates how to control motion and how to use the
set/read commands. Example ladder files are available in .pdf and .mal formats as a guide for implementing the
code into any type of ladder language. Please see document eng.MCD.05.105 for the example ladder files.
Demonstrated Features
Motion commands: Feed Command, Step Command, Point Table Command, Station Command, Zero
Set/Read commands: Read Parameter, Write Parameter, Set Current Position, Set Zero Point, Read Alarm,
Reset Module
Development Setup
The setup used to write and test the example ladder is shown below. An MP940D was used as the DeviceNet
master, and NS300 demo was used as the test unit. Note that operation is identical on the NS500, except that
the PROFIBUS protocol is used instead of DeviceNet. Ladder code was written in the MPE720 MotionWorks
software environment, and local I/O of the MP940 was used to simulate PLC signals.
Before beginning programming for the NS300/500 master ladder, be sure to do the following:
Configure communications in the PLC. Follow the setup procedure provided with the PLC for adding a
device to the scan list of the selected network. The NS300/500 requires 8 bytes in/out. It is
recommended to configure the second four bytes as data type long (or double-word) for convenience. If
using a PLC that requires a setup file, the DeviceNet and PROFIBUS files can be found as shown below:
Configure communications in the NS300/500. This entails setting the DIP switches properly for
communications baud rate and network address. See the NS300/500 manual for proper settings.
Verify the functionality of E-stop, POT, and NOT on CN4 of the NS300/500. If using the hardware E-
stop, monitor the status of this bit using the NSxxx software to ensure that it is working as intended.
Disable this input if not being used by setting Pn81B, bit 0 = 0. Verify POT and NOT are connected
properly to the SGDH by monitoring these with the NSxxx software. If not using either of these signals,
they can be masked off by setting Pn50A.3 = 8, and Pn50B.0 = 8.
Test communications between the PLC and NS300/500. Make sure the two devices are
communicating by opening a watch window in the PLC software. Test the E-stop bit from the PLC (be
sure the E-stop bit at CN4 of the NS300/500 is set) and verify that a response is being received from the
NS300/500 as the bit is toggled. Spin the motor by hand and monitor motor position by observing bytes 4
thru 7 of the response message.
The chart below shows the assignment of the global and I/O registers used in the example program. Local
registers are used throughout the program, but are not listed in this chart. This chart contains the registers
accessed directly by the user.
Table 2. Example Master Ladder Register Addressing
PLC_COMMAND_SELECT
PLC_RESPONSE_CO DE
PLC_FEED_SPEED
PLC_STEP_NUMBERML000063
PLC_STATION_NUMBERML000084
PLC_POINT_TABLE_ROWML000105
PLC_TARGET_POSITIONML000126
PLC_PARAMETER_N UM BER
PLC_PARAMETER_D ATA
PLC_CURRENT_POSITION_SETML000189
Register
MW000020
MW000031
ML000042
MW00014
ML00016
PLC_C O M M AND_ S ELE CT Se ttin g s
Value to be loaded for type of motion command
PLC_RESPONSE_CODE Settings
Determines meaning of response message
Follow response code settings as listed in user's manual.
Setting
10Read Parameter
11Write Parameter
12Set Current Position
13Set Zero Point
14Read Alarm
15Reset Module
Description
No operation
Feed
Step
Station
Point Table
Zero Point Return
Positioning
Properly programming the network master controller of the NS300/500 is essential for success when
implementing one of these application modules. Most application issues identified in the field are the result of an
application program that does not adhere to the NS300/500 timing diagrams. This technical note is intended to
explain how the example master ladder program operates, and how it effectively eliminates common
programming mistakes. Following the principles described in this tech note will greatly reduce troubleshooting by
eliminating the majority of application issues. Three main issues are addressed; general program flow, best
practices programming, and proper command bit sequencing and interlocking. After addressing these issues,
specific highlights of the program are also discussed.