Configuration via USB
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.
- The configuration file is read out and processed.
- 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.
- Only use a standard Mini 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:
cfg.txt
vmmcode.usr
info.bin
reset.txt
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.
Reading and writing the file
How to access the file:
- Connect and switch on the voltage supply.
- Connect the controller to your PC using the USB cable.
- 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
is stored there. - 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:
- Save the file if you have not yet already done so. The motor stops.
- Disconnect the USB cable from the controller.
- Disconnect the voltage supply from the controller for approx. 1 second until the power LEDs stop flashing.
- Reconnect the voltage supply. When the controller is now restarted, the values in the configuration file are read out and applied.
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 |
|
|
Assignments
<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.01=1
- Reset bit
-
3202:00.01=0
- Bitwise OR
-
3202:00|=0x01
- Bitwise AND
-
3202:00&=0x01
Example |
|
Set object 203Bh:01 (rated current) to the value "600" (mA):
|
|
Set object 3202h:00 to the value "1" (activate closed-loop mode):
or only set bit 0
|
- 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.
NanoJ program
A NanoJ program can be executed on the controller. To load and start a program on the controller, proceed as follows:
- Write and compile your program as described in chapter Programming with NanoJ.
- Connect the voltage supply to the controller and switch on the voltage supply.
- Connect the controller to your PC using the USB cable.
- After the PC has detected the device as a removable storage device, open an Explorer window and delete file
vmmcode.usr
on the controller. - 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 filevmmcode.usr
. -
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
- Disconnect the voltage supply from the controller for approx. 1 second until the power LEDs stop flashing.
- Reconnect the voltage supply. When the controller now starts, the new NanoJ program is read in and started.
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.
- 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.
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:
For example:copy <SOURCE_PATH>\<OUTPUT>.usr <TARGET>:\vmmcode.usr
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.