CL3-E CANopen/USB Technical Manual

Configuration

General information

The following options exist for configuring the motor controller:

Configuration file
This file can be stored on the motor controller by using the USB port. Read the sections "USB port" and "Configuration file.
NanoJ program
This program can be programmed, compiled, and then transferred over USB to the motor controller with NanoJ Easy. Read the sections and "NanoJ program"Programming with NanoJ".
CANopen Node-ID and terminating resistor
This motor is fitted with the CANopen field bus. Furthermore there is a DIP switch for terminating. is fitted next to it. Read the "CANopen" section for details.
Modbus over RS-485 or RS-232
This controller is fitted with a Modbus interface. Moreover there is a DIP switch mounted for the terminating resistor. Read the "Modbus RTU" section for details..
After it has been connected to a voltage supply, the motor controller reads out the configuration in the following sequence:
  1. Configuration file is read out and processed.
  2. The NanoJ program is launched

USB port

CAUTION
  • Use only a standardized micro-USB cable. Never use a USB cable that manufacturers of cell phones enclose with their products. These USB cable may have a different connector form or pin assignment.
  • Do not save files on the motor controller other than those listed below:
    1. cfg.txt
    2. vmmcode.usr
    3. info.bin
    4. reset.txt
    5. firmware.bin
    All other files are deleted when the voltage supply for the motor controller is switched on!
Note
  • The controller behaves like a mass storage device ("USB flash drive"), no further drivers are necessary.
  • The motor is brought to idling when the USB cable is connected. The "Switched On" mode is set (see the " DS402 Power State machine" section).
  • The voltage supply for the motor controller must also be switched on for USB operation.

If a USB cable is used for connecting the motor controller to a PC, the motor controller behaves like a removable storage medium. You can therefore store the configuration file or NanoJ program on the motor controller. All changes to files are only applied after the motor controller has been restarted (for example by short disconnection from the voltage supply).

Tip

A frequent occurrence during set up and installation is that a file is updated and then copied back to the motor controller, it is therefore advisable to use a script file that does this work

  • In Windows you can create a text file with file extension bat and the following content :
    copy <SOURCE> <TARGET>
  • For Linux you can create a script with file extension sh and the following content:
    #!/bin/bash
    cp <SOURCE> <TARGET>

Configuration file

General information

Read the "USB port" section first if you have not already done so.

The configuration file cfg.txt has the purpose of preassigning values for the object directory to a specific value at start up. This file is kept in a special syntax to keep access to objects in the object directory as simple as possible. The motor controller evaluates all assignments in the file from the top downwards.

Note
Should you delete the configuration file, the file is recreated (without content) at the next motor controller restart.

Reading and writing the file

To access to the file:

  1. Connect the voltage supply and switch on the voltage supply.
  2. Connect the motor controller to your PC by using the USB cable.
  3. After the PC has recognized the device as a removable storage medium, navigate with the Explorer to the directory for the motor controller. The file "cfg.txt" (in case of a PD4-C the file is named "pd4ccfg.txt") is stored there.
  4. Open this file with a simple text editor, such as Notepad or Vi. Do not use any programs that use text styles (LibreOffice or suchlike).

After you have made changes to the file, take the following action to apply the changes:

  1. Save the file if you have not already done this.
  2. Disconnect the USB cable from the motor controller.
  3. Disconnect the voltage supply from the motor controller for approx. 1 second.
  4. Reconnect the voltage supply. At the next motor controller startup, the new values in the configuration file are read out and applied.

Tip

You can also copy an empty file reset.txt to the motor controller in order to restart the motor controller.

This restarts the motor controller. The file reset.txt is deleted at the restart.

Structure of configuration file

Comments

Lines that start with a semicolon are ignored by the motor controller.

Example

 
; This is a comment line

Assignments

CAUTION
Beforeyou set a value, find out about its data type (see the "Object directory description" section). The motor controller does notvalidate any entries for logic errors!
Values in the object directory can be set with the following syntax:
<Index>:<SubIndex>=<Value>
<Index>
This value corresponds to the index of the object and is interpreted as a hexadecimal number. The value must always have four digits.
<SubIndex>
This value corresponds to the sub-index of the object and is interpreted as a hexadecimal number. The value must always have two digits.
<Value>
The value that is to be written into the object is interpreted as a decimal number. A "0x" is to be added to the front for hexadecimal numbers.
Note
  • There are not to be any empty spaces to the left and right of the equals sign. The following assignments are incorrect:

    6040:00 =5

    6040:00= 5

    6040:00 = 5

  • The number of digits may not be changed. The index must have four digits, the sub-index two. The following assignments are incorrect:

    6040:0=6

    6040=6

  • Empty spaces at the beginning of the line are not admissible.

Example

 
Setting object 6040 h:00 to the value "6":
6040:00=0006

Short-circuit evaluation

DIP switches can only be used for executing certain assignments. The following syntax is used for short-circuit execution:

#<No>:<Assignment>
<No>
The number of the DIP switch printed on the switch is given here. Permissible values are 1 to 4
<Assignment>
The assignment specified here is described in the "Assignments" section.

Example

 

The following code is set by the object 2057 h:00h "Clock Direction Multiplier"):

  • to 1 if DIP switch 1 is switched to "Off".
  • to 2, if the DIP switch is switched to "On" (the previous value is overwritten).
2057:00=00000001 #1:2057:00=00000002

NanoJ program

A NanoJ program may be executed on the motor controller. Carry out the following steps to load and launch a program on the motor controller:

  1. Write and compile your program as described in the "Programming with NanoJ" section.
  2. Connect the voltage supply to the controller and switch on the voltage supply.
  3. Connect the motor controller to your PC by using the USB cable.
  4. After the PC has recognized the device as a removable storage medium, open a file explorer and delete file "vmmcode.usr" on the motor controller
  5. Use the explorer to navigate to the directory with your program. The compiled file has the same name as the source code file, only with the file name extension ".usr". Rename this file to "vmmcode.usr".
  6. Now copy file "vmmcode.usr" to the motor controller.
  7. Disconnect the voltage supply from the motor controller for approx. 1 second.
  8. Reconnect the voltage supply. At the next start of the motor controller, the new NanoJ program is read-in and launched.

Tip

You can also copy an empty file reset.txt to the motor controller in order to restart the motor controller.

This restarts the motor controller. The file reset.txt is deleted at the restart.

Note
  • The NanoJ program on the motor controller must have the file name "vmmcode.usr".
  • If the NanoJ program was deleted, an empty file with name "vmmcode.usr" is created at the next startup.

Tip

Deletion of the old NanoJ program and copying of the new one can be automated with a script file.

  • In Windows you can create a file with file extension bat and the following content:
    Copy <SOURCE PATH>\<OUTPUT>.usr <TARGET>:\vmmcode.usr
    . For example:
    copy c:\test\main.usr n:\vmmcode.usr
  • For Linux you can create a script with file extension sh and the following content:
    #!/bin/bash
    cp <SOURCE PATH>/<OUTPUT>.usr <TARGET PATH>/vmmcode.usr

CANopen

All settings for CANopen can be either written to the file cfg.txt or may get stored with the CANopen storing mechanism (see chapter Save Objects).

The oder of the readout of the data is as follows:
  1. First the values stored via CANopen are applied.
  2. Then the values of the cfg.txt are applied.

Node-ID

The controller starts per with the Node-ID "127" per default. If a different Node-ID is needed, the new value of the Node-ID is written to the object 2009h.

Baud rate

The controller starts per with the baud rate of 1 MBd per default. The baud rate must be put in the object 2005h. See the following table for the options.

Value Baud rate in kBd
dec hex
129 81 10
130 82 20
131 83 50
132 84 125
133 85 250
134 86 500
136 88 1000

Terminating resistor

A switch for the terminating resistor is mounted on the board (see "Terminating resistor (switch S1)"). When set to the position "ON", the lines will be terminated with 120 Ohm.

▶   next

Contents