PD2-CB USB Online Manual

Configuration

General

The following options are available for configuring the controller:

Configuration file
This file can be saved to the controller via the USB connection. For further information, read chapters USB connection and Configuration file.
NanoJ program
This program can be programmed, compiled and then transferred to the controller with NanoJ via USB. For further information, read chapters NanoJ program and Programming with NanoJ.
After connecting to a voltage supply, the controller reads out the configuration in the following order:
  1. The configuration file is read out and processed.
  2. The DIP switches for selecting the special drive modes is/are read out and used as configuration. See chapter Special drive modes (clock-direction and analog speed).
  3. The NanoJ program is started.

USB connection

If the controller is connected to a PC via a USB cable, the controller behaves like a removable storage device. No further drivers are required.

Three files are displayed: the configuration file (cfg.txt), the NanoJ program (vmmcode.usr) and the information file (info.txt), where the serial numbers and firmware version of the product can be found.

You can thereby store the configuration file or the NanoJ program on the controller. The voltage supply of the controller must also be connected during USB operation.

Note:
  • Only use a standard Micro USB cable. Never use a USB cable that manufacturers of mobile phones include with their products. These USB cables could have a different plug shape or pin assignment.
  • Do not save any files on the controller other than those listed below:
    1. cfg.txt
    2. vmmcode.usr
    3. info.bin
    4. reset.txt
    Any other file is deleted when the voltage supply of the controller is switched on!
Tip:

Because it is often necessary during commissioning to copy the same file to the controller following an update, it is recommended that a script file be used to perform this task.

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

Configuration file

General

The cfg.txt configuration file is used to preset values for the object dictionary to a certain value during startup. This file uses a special syntax to make accessing the objects of the object dictionary as easy as possible. The controller evaluates all assignments in the file from top to bottom.

Note: If you delete the configuration file, the controller recreates the file (without content) on the next restart.

Reading and writing the file

How to access the file:

  1. Connect and switch on the voltage supply.
  2. Connect the controller to your PC using the USB cable.
  3. After the PC has detected the device as a removable storage device, navigate in the Explorer to the directory of the controller. File cfg.txt (for a PD4C, the file is named pd4cfg.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 markup (LibreOffice or similar).

After you have made changes to the file, proceed as follows to apply the changes through a restart:

  1. Save the file if you have not yet already done so. The motor stops.
  2. Disconnect the USB cable from the controller.
  3. Disconnect the voltage supply from the controller for approx. 1 second until the power LEDs stop flashing.
  4. Reconnect the voltage supply. When the controller is now restarted, the values in the configuration file are read out and applied.
Tip:

To restart the controller, you can also copy an empty reset.txt file to the controller. This restarts the controller. The reset.txt file is deleted on the next restart.

Structure of the configuration file

Comments

Lines that begin with a semicolon are ignored by the controller.

Example

; This is a comment line

Assignments

Note: Before setting a value, determine its data type (see chapter Description of the object dictionary)! The controller does not validate entries for logical errors!
Values in the object dictionary 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 be specified with four digits.
<Subindex>
This value corresponds to the subindex of the object and is interpreted as a hexadecimal number. The value must always be specified with two digits and can be omitted if the subindex is 00h.
<Value>
The value that is to be written in the object is interpreted as a hexadecimal number. Hexadecimal numbers are to be prefixed with "0x".

You can also set individual bits:

Set bit
3202:00.03=1
Reset bit
3202:00.03=0
Bitwise OR
3202:00|=0x08
Bitwise AND
3202:00&=0x08

Example

Set object 203Bh:01 (rated current) to the value "600" (mA):
203B:01=600
Set object 3202h:00 to the value "8" (activate current reduction while at a standstill in open-loop mode):
3202:00=8
or only set bit 3
3202:00.03=1
Note:
  • There must be no blank characters to the left and right of the equal sign. The following assignments are not correct:

    6040:00 =5

    6040:00= 5

    6040:00 = 5

  • The number of places must not be changed. The index must be four characters long and the subindex two characters long. The following assignments are not correct:

    6040:0=6

    6040=6

  • Blank spaces at the start of the line are not permitted.

Conditional evaluation

The DIP switches can be used to execute only certain assignments. The following syntax is used for conditional execution:

#<No>:<Assignment>
<No>
The number of the DIP switch is entered here as it is printed on the switches. Valid values are 1 to 4
<Assignment>
The assignment is specified here as described in section Assignments.

Example

The following code sets object 2057h: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 can be executed on the controller. To load and start a program on the controller, proceed as follows:

  1. Write and compile your program as described in chapter Programming with NanoJ.
  2. Connect the voltage supply to the controller and switch on the voltage supply.
  3. Connect the controller to your PC using the USB cable.
  4. After the PC has detected the device as a removable storage device, open an Explorer window and delete file vmmcode.usr on the controller.
  5. Navigate in the Explorer to the directory with your program. The compiled file has the same name as the source code file, only with file extension .usr. Rename this file vmmcode.usr.
  6. Copy file vmmcode.usr to the controller.

    To start the NanoJ program the next time the controller is restarted, add the following line to the configuration file:

    2300:00=1
  7. Disconnect the voltage supply from the controller for approx. 1 second until the power LEDs stop flashing.
  8. Reconnect the voltage supply. When the controller now starts, the new NanoJ program is read in and started.
Tip:

To restart the controller, you can also copy an empty reset.txt file to the controller. This restarts the controller. The reset.txt file is deleted on the next restart.

Note:
  • The NanoJ program on the controller must have file name vmmcode.usr.
  • If the NanoJ program was deleted, an empty file named vmmcode.usr is created the next time the controller is started.
Tip:

It is possible to automate the deletion of the old NanoJ program and the copying of the new one with a script file:

  • Under 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
  • Under 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

You can protect your NanoJ program from being read out/copied by activating the hidden attribute of the FAT file system.

▶   next

Contents